ESyS-Particle  4.0.1
Plane.h
1 
2 // //
3 // Copyright (c) 2003-2011 by The University of Queensland //
4 // Earth Systems Science Computational Centre (ESSCC) //
5 // http://www.uq.edu.au/esscc //
6 // //
7 // Primary Business: Brisbane, Queensland, Australia //
8 // Licensed under the Open Software License version 3.0 //
9 // http://www.opensource.org/licenses/osl-3.0.php //
10 // //
12 
13 #ifndef __PLANE_H
14 #define __PLANE_H
15 
16 //-- Project includes --
17 #include "Foundation/vec3.h"
18 
28 class Plane
29 {
30  protected:
31  Vec3 U,V ;
32  bool force3D ;
33  Vec3 Dir ;
34  Vec3 Pos ;
35 
36  void Create() ;
37  public:
38  Plane();
39  Plane(const Vec3& iDir,const Vec3& iPos);
40  Plane(const Vec3& iU,const Vec3& iV,const Vec3& iPos);
41 
42  virtual ~Plane() {}
43 
44  virtual double sep(const Vec3&) const;
45  virtual double dist(const Vec3&) ; // signed separation according to Direction of the normal
46  virtual Vec3 ToClosest(const Vec3& M) {return dist(M)*Dir; } ; // return the vector PM where P is the closest point to M on the surface.
47 
48  inline Vec3 GetU() const { return U; } ; // return U (for planes in a 2D space (ie. line) U is in the space)
49  inline Vec3 GetV() const { return V; } ; // V is null if this is a 2D space.
50  inline const Vec3 &GetW() const { return Dir; } ; // The normal
51  inline Vec3 getNormal() const { return Dir; } ;
52  inline const Vec3 &GetO() const { return Pos; } ;
53  inline Vec3 getPos() const { return Pos; } ;
54 } ;
55 
56 namespace esys
57 {
58  namespace lsm
59  {
60  typedef ::Plane Plane;
61  }
62 }
63 
64 #endif // __PLANE_H