ESyS-Particle  2.3.2
Plane3D.h
Go to the documentation of this file.
1 
2 // //
3 // Copyright (c) 2003-2014 by The University of Queensland //
4 // Centre for Geoscience Computing //
5 // http://earth.uq.edu.au/centre-geoscience-computing //
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 __PLANE3D_H
14 #define __PLANE3D_H
15 
16 //-- Project includes --
17 #include "Foundation/vec3.h"
18 
28 class Plane3D
29 {
30  protected:
31  Vec3 U,V ;
32  bool force3D ;
33  Vec3 Dir ;
35 
36  void Create() ;
37  public:
38  Plane3D();
39  Plane3D(const Vec3& iDir,const Vec3& iPos);
40  Plane3D(const Vec3& iU,const Vec3& iV,const Vec3& iPos);
41 
42  virtual ~Plane3D() {}
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  {
61  }
62 }
63 
64 #endif // __PLANE3D_H