00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __UT_Plane_h__
00022 #define __UT_Plane_h__
00023
00024 #include "UT_API.h"
00025 #include <iostream.h>
00026 #include "UT_Vector3.h"
00027
00028 class UT_Matrix3;
00029 class UT_DMatrix4;
00030
00031 class UT_API UT_Plane {
00032 public:
00033
00034
00035 enum UT_PlaneType { UT_PLANE_XY, UT_PLANE_YZ, UT_PLANE_XZ };
00036
00037
00038 UT_Plane(UT_PlaneType p=UT_PLANE_XY);
00039 UT_Plane(const UT_Vector3 &apoint, const UT_Vector3 &nmlVec, int norm=1);
00040 UT_Plane(const UT_Vector3 &p0, const UT_Vector3 &p1, const UT_Vector3 &p2);
00041 UT_Plane(const UT_Vector4 &p);
00042 UT_Plane(const UT_Plane &p);
00043
00044 virtual ~UT_Plane(void);
00045
00046
00047
00048
00049
00050 UT_Vector3 intersect(const UT_Vector3 &p, const UT_Vector3 &v) const;
00051 int intersectLine(const UT_Vector3 &p, const UT_Vector3 &v,
00052 UT_Vector3 &hit) const;
00053 int intersectRay(const UT_Vector3 &p, const UT_Vector3 &v,
00054 UT_Vector3 &hit) const;
00055
00056
00057
00058
00059 int intersectLine(const UT_Vector3 &offsetPt,
00060 const UT_Vector3 &p, const UT_Vector3 &v,
00061 UT_Vector3 &hit) const;
00062 int intersectRay(const UT_Vector3 &offsetPt,
00063 const UT_Vector3 &p, const UT_Vector3 &v,
00064 UT_Vector3 &hit) const;
00065
00066
00067
00068 UT_Vector3 project(const UT_Vector3 &p) const;
00069 fpreal project(const UT_Vector3 &p, UT_Vector3 &projection) const;
00070
00071
00072 void symmetry(UT_Vector3 &p);
00073
00074
00075 int contains(const UT_Vector3 &p) const;
00076
00077
00078
00079 int side(const UT_Vector3 &p) const;
00080
00081
00082 UT_Vector3 &point(void) { return thePoint; }
00083 const UT_Vector3 &point(void) const { return thePoint; }
00084 UT_Vector3 &normal(void) { return theNormal; }
00085 const UT_Vector3 &normal(void) const { return theNormal; }
00086
00087
00088 virtual void negate(void);
00089
00090
00091 virtual void rotate(UT_Vector3 &axis, fpreal theta, int norm=1);
00092 virtual void rotate(UT_Axis3::axis a, fpreal theta);
00093
00094
00095
00096 virtual void transform(const UT_Matrix4 &matx);
00097 virtual void transform( UT_Matrix4 &matx);
00098 virtual void transform(const UT_DMatrix4 &matx);
00099 virtual void transform( UT_DMatrix4 &matx);
00100
00101
00102 UT_Plane &operator=(const UT_Plane &p)
00103 {
00104 if (this != &p)
00105 {
00106 thePoint = p.thePoint;
00107 theNormal = p.theNormal;
00108 }
00109 return *this;
00110 }
00111
00112
00113 void shiftOffset(fpreal byFactor)
00114 {
00115 thePoint += (theNormal * byFactor);
00116 }
00117
00118
00119 virtual const char *className() const;
00120
00121 protected:
00122 private:
00123
00124 UT_Vector3 thePoint;
00125 UT_Vector3 theNormal;
00126 };
00127
00128 #endif