ML Reference
MeVis/Foundation/Sources/MLLinearAlgebra/mlPlane.h
Go to the documentation of this file.
00001 // **InsertLicense** code
00002 //----------------------------------------------------------------------------------
00004 
00008 //----------------------------------------------------------------------------------
00009 #ifndef __mlPlane_H
00010 #define __mlPlane_H
00011 
00012 #include "mlLinearAlgebraSystem.h"
00013 #include "mlVector3.h"
00014 
00015 ML_LA_START_NAMESPACE
00016 
00018   class Line;
00019 
00020   //----------------------------------------------------------------------------
00022   //----------------------------------------------------------------------------
00023   class ML_LINEAR_ALGEBRA_EXPORT Plane {
00024 
00025   public:
00026 
00028     Plane();
00029 
00032     Plane(const Vector3& normal, MLdouble distance);
00033 
00036     Plane(const Vector3& p0, const Vector3& p1, const Vector3& p2);
00037 
00040     Plane(const Vector3& normal, const Vector3& point);
00041 
00043     Vector3 getClosestPoint(const Vector3 &point) const;
00044 
00047     bool intersect(const Line& l, Vector3& intersection) const;
00048 
00051     bool isInHalfSpace(const Vector3& point) const;
00052 
00054     MLdouble getDistance(const Vector3 &point) const;
00055 
00057     const Vector3& getNormal() const;
00058 
00061     bool setNormal(const Vector3 &n);
00062 
00064     void setDistance(double d);
00065 
00067     inline MLdouble getDistanceFromOrigin() const { return _distance; }
00068 
00073     MLSign edgeIntersect(const Vector3 &v1,
00074                          const Vector3 &v2,
00075                          Vector3 &intersectPos) const;
00076   private:
00078     MLdouble _distance;
00079 
00081     Vector3  _normal;
00082   };
00083 
00084 ML_LA_END_NAMESPACE
00085 
00086 #endif // __mlPlane_H