00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef __BV_Overlap_h__
00016 #define __BV_Overlap_h__
00017
00018 #include "BV_API.h"
00019 #include <SYS/SYS_Types.h>
00020 #include <UT/UT_Vector3.h>
00021 class UT_Matrix3;
00022
00023 class BV_API bvTriangle {
00024 public:
00025 void computeNormal();
00026 void transform(const UT_Matrix3 &R, const UT_Vector3 &T);
00027
00028 UT_Vector3 myP[3], myNormal;
00029 };
00030
00031 class BV_API bvQuad {
00032 public:
00033
00034
00035
00036 bool dissect(bvTriangle &ta,
00037 bvTriangle &tb,
00038 bool °en) const;
00039
00040 bool isCoplanar() const;
00041 UT_Vector3 myP[4];
00042 };
00043
00044
00045
00046 class BV_API BV_Overlap
00047 {
00048 public:
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058 static bool doCoplanarTriTriOverlap(const bvTriangle &tri1,
00059 const bvTriangle &tri2,
00060 fpreal tol = 0.0f);
00061
00062
00063 static bool doTriTriOverlap(const bvTriangle &tri1,
00064 const bvTriangle &tri2,
00065 fpreal tol=0.0f);
00066
00067
00068 static bool doTriTriOverlap(const bvTriangle &tri1,
00069 const bvTriangle &tri2,
00070 bool &coplanar,
00071 UT_Vector3 &isectpt1,
00072 UT_Vector3 &isectpt2,
00073 fpreal tol=0.0f);
00074
00075
00076 static bool doCoplanarQuadQuadOverlap(const bvQuad &q1,
00077 const bvQuad &q2,
00078 fpreal tol=0.0f);
00079
00080
00081 static bool doPlaneBoxOverlap(const UT_Vector3& normal,
00082 const fpreal d,
00083 const UT_Vector3& maxbox,
00084 fpreal tol = 0.0f);
00085
00086
00087
00088
00089 static bool doTriBoxOverlap(const bvTriangle &tri,
00090 const UT_Vector3 &ra,
00091 const UT_Matrix3 &R,
00092 const UT_Vector3 &T,
00093
00094 bool lite=false);
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104 static bool doBoxBoxOverlap(const UT_Vector3 &ra,
00105 const UT_Vector3 &rb,
00106 const UT_Matrix3 &R,
00107 const UT_Vector3 &T,
00108 fpreal tol=0.f,
00109 bool lite=false);
00110
00111
00112
00113 static void calcAABB(const UT_Vector3 &ra,
00114 const UT_DMatrix4 &xform,
00115 UT_Vector3 &rnew,
00116 UT_Vector3 &Tnew);
00117 static void calcAABB(const UT_Vector3 &ra,
00118 const UT_DMatrix4 &xform,
00119 const UT_Matrix3 &R,
00120 const UT_Vector3 &T,
00121 UT_Vector3 &rnew,
00122 UT_Vector3 &Tnew);
00123
00124
00125
00126
00127 static bool doBoxBoxOverlap(const UT_Vector3 &ra,
00128 const UT_Vector3 &rb,
00129 const UT_DMatrix4 &xform1,
00130 const UT_DMatrix4 &xform2,
00131 const UT_Matrix3 &R,
00132 const UT_Vector3 &T,
00133 fpreal tol,
00134 bool lite = false,
00135 bool useOBB = true);
00136
00137 private:
00138 static bool doCoplanarTriTriOverlap(const UT_Vector3& n,
00139 const UT_Vector3& v0,
00140 const UT_Vector3& v1,
00141 const UT_Vector3& v2,
00142 const UT_Vector3& u0,
00143 const UT_Vector3& u1,
00144 const UT_Vector3& u2);
00145
00146 };
00147
00148 #endif
00149
00150