www.cemf.ir
plane.cpp
Go to the documentation of this file.
1 /*------------------------------- phasicFlow ---------------------------------
2  O C enter of
3  O O E ngineering and
4  O O M ultiscale modeling of
5  OOOOOOO F luid flow
6 ------------------------------------------------------------------------------
7  Copyright (C): www.cemf.ir
8  email: hamid.r.norouzi AT gmail.com
9 ------------------------------------------------------------------------------
10 Licence:
11  This file is part of phasicFlow code. It is a free software for simulating
12  granular and multiphase flows. You can redistribute it and/or modify it under
13  the terms of GNU General Public License v3 or any other later versions.
14 
15  phasicFlow is distributed to help others in their research in the field of
16  granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the
17  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 
19 -----------------------------------------------------------------------------*/
20 
21 #include "plane.hpp"
22 
24 (
25  const realx3& p1,
26  const realx3& p2,
27  const realx3& p3,
28  const realx3& p4
29 )
30 :
31  infinitePlane(p1,p2,p3),
32  p1_(p1),
33  p2_(p2),
34  p3_(p3),
35  p4_(p4)
36 {
37 
38  if(!pointOnPlane(p4))
39  {
41  "points "<< realx4x3(p1,p2,p3,p4)<<" do not form a planner surface"<<endl;
42  fatalExit;
43  }
44 }
45 
46 
48 {
49  auto pp1 = line(normal_, p1_, true).point(distance);
50  auto pp2 = line(normal_, p2_, true).point(distance);
51  auto pp3 = line(normal_, p3_, true).point(distance);
52  auto pp4 = line(normal_, p4_, true).point(distance);
53 
54  return plane(pp1, pp2, pp3, pp4);
55 }
56 
58  const realx3 &p1,
59  const realx3 &p2,
60  const realx3 &p3,
61  const realx3 &p4)
62 {
63  if( !validPlane3(p1,p2,p3)) return false;
64  if( !infinitePlane(p1,p2,p3).pointOnPlane(p4)) return false;
65  return true;
66 }
pFlow::infinitePlane::normal_
realx3 normal_
normal vector
Definition: infinitePlane.hpp:37
pFlow::plane::p4_
realx3 p4_
Fourth point.
Definition: plane.hpp:46
pFlow::real
float real
Definition: builtinTypes.hpp:45
pFlow::realx4x3
quadruple< realx3 > realx4x3
Definition: types.hpp:51
fatalExit
#define fatalExit
Fatal exit.
Definition: error.hpp:98
pFlow::plane
Definition: plane.hpp:30
pFlow::line
Definition: line.hpp:36
pFlow::plane::plane
INLINE_FUNCTION_HD plane()
Definition: plane.hpp:51
pFlow::infinitePlane
Definition: infinitePlane.hpp:32
pFlow::plane::p3_
realx3 p3_
Third point.
Definition: plane.hpp:43
pFlow::plane::p1_
realx3 p1_
First point.
Definition: plane.hpp:37
pFlow::endl
iOstream & endl(iOstream &os)
Add newline and flush stream.
Definition: iOstream.hpp:341
pFlow::plane::validPlane4
static bool validPlane4(const realx3 &p1, const realx3 &p2, const realx3 &p3, const realx3 &p4)
Definition: plane.cpp:57
plane.hpp
pFlow::plane::parallelPlane
plane parallelPlane(real distance) const
Definition: plane.cpp:47
fatalErrorInFunction
#define fatalErrorInFunction
Report a fatal error and function name and exit the application.
Definition: error.hpp:77
pFlow::line::point
INLINE_FUNCTION_HD realx3 point(real t) const
Definition: line.hpp:102
pFlow::plane::p2_
realx3 p2_
Second point.
Definition: plane.hpp:40
pFlow::triple< real >