ESyS-Particle  4.0.1
Plane.h
00001 
00002 //                                                         //
00003 // Copyright (c) 2003-2011 by The University of Queensland //
00004 // Earth Systems Science Computational Centre (ESSCC)      //
00005 // http://www.uq.edu.au/esscc                              //
00006 //                                                         //
00007 // Primary Business: Brisbane, Queensland, Australia       //
00008 // Licensed under the Open Software License version 3.0    //
00009 // http://www.opensource.org/licenses/osl-3.0.php          //
00010 //                                                         //
00012 
00013 #ifndef __PLANE_H
00014 #define __PLANE_H
00015 
00016 //-- Project includes --
00017 #include "Foundation/vec3.h"
00018 
00028 class Plane
00029 {
00030  protected:
00031   Vec3 U,V ;
00032   bool force3D ;
00033   Vec3 Dir ;  
00034   Vec3 Pos ;
00035   
00036   void Create() ;
00037  public:
00038   Plane();
00039   Plane(const Vec3& iDir,const Vec3& iPos);
00040   Plane(const Vec3& iU,const Vec3& iV,const Vec3& iPos);
00041     
00042   virtual ~Plane() {}
00043     
00044   virtual double sep(const Vec3&) const;
00045   virtual double dist(const Vec3&) ; // signed separation according to Direction of the normal
00046   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.
00047 
00048   inline Vec3 GetU() const { return U; } ; // return U (for planes in a 2D space (ie. line)  U is in the space)
00049   inline Vec3 GetV() const { return V; } ; // V is null if this is a 2D space.
00050   inline const Vec3 &GetW() const { return Dir; } ; // The normal
00051   inline Vec3 getNormal() const { return Dir; } ;
00052   inline const Vec3 &GetO() const { return Pos; } ;
00053   inline Vec3 getPos() const { return Pos; } ;
00054 } ;
00055 
00056 namespace esys
00057 {
00058   namespace lsm
00059   {
00060     typedef ::Plane Plane;
00061   }
00062 }
00063 
00064 #endif // __PLANE_H