00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #ifndef __GU_TriIntersect_h__
00038 #define __GU_TriIntersect_h__
00039
00040 #include "GU_API.h"
00041
00042 #include <UT/UT_Vector3.h>
00043 class bvTriangle;
00044
00045 class GU_API GU_TriIntersect
00046 {
00047 public:
00048 GU_TriIntersect();
00049 virtual ~GU_TriIntersect();
00050
00051
00052 bool intersect(const bvTriangle tris[2], bool cantContact,
00053 float tol);
00054
00055 protected:
00056
00057
00058
00059
00060
00061
00062 virtual void edgeEdgeCallback(const UT_Vector3 &hitpt,
00063 const UT_Vector3 &normal,
00064 const UT_Vector3 &ea,
00065 const UT_Vector3 &eb,
00066 int va0, int va1, int vb0, int vb1) = 0;
00067
00068
00069
00070
00071 virtual void vertexFaceCallback(const UT_Vector3 &hitpt,
00072 const UT_Vector3 &normal,
00073 bool isJustTouching,
00074 int face, int vid) = 0;
00075
00076
00077
00078 virtual void faceFaceCallback(const UT_Vector3 &hitpt1,
00079 const UT_Vector3 &hitpt2,
00080 const UT_Vector3 &normal1,
00081 const UT_Vector3 &normal2) = 0;
00082
00083 private:
00084
00085 GU_TriIntersect(const GU_TriIntersect &);
00086 GU_TriIntersect &operator=(const GU_TriIntersect &);
00087
00088 void intersectEdges(const bvTriangle *t, int i0, int i1,
00089 int &hits, float tol);
00090 void intersectPoints(const bvTriangle *t,
00091 int &hits, float tol, bool cantContact);
00092 static void eliminateLargestComponent(const UT_Vector3 &v, int &i0,
00093 int &i1, int &i2);
00094 static void getOddPoints(const float tPS[2][3], int *odd, int *cvt,
00095 int *nvt, float tol);
00096 void intersectEdgesWithLine(const bvTriangle *t, float *tPC,
00097 float tPS[2][3], int &hits, float tol,
00098 bool cantContact);
00099 };
00100
00101 #endif
00102