3 #define LOCAL_EPSILON 0.000001f 15 #define EDGE_EDGE_TEST(V0, U0, U1) \ 16 Bx = U0[i0] - U1[i0]; \ 17 By = U0[i1] - U1[i1]; \ 18 Cx = V0[i0] - U0[i0]; \ 19 Cy = V0[i1] - U0[i1]; \ 22 if((f>0.0f && d>=0.0f && d<=f) || (f<0.0f && d<=0.0f && d>=f)) \ 24 const float e=Ax*Cy - Ay*Cx; \ 27 if(e>=0.0f && e<=f) return TRUE; \ 31 if(e<=0.0f && e>=f) return TRUE; \ 36 #define EDGE_AGAINST_TRI_EDGES(V0, V1, U0, U1, U2) \ 38 float Bx,By,Cx,Cy,d,f; \ 39 const float Ax = V1[i0] - V0[i0]; \ 40 const float Ay = V1[i1] - V0[i1]; \ 42 EDGE_EDGE_TEST(V0, U0, U1); \ 44 EDGE_EDGE_TEST(V0, U1, U2); \ 46 EDGE_EDGE_TEST(V0, U2, U0); \ 50 #define POINT_IN_TRI(V0, U0, U1, U2) \ 54 float a = U1[i1] - U0[i1]; \ 55 float b = -(U1[i0] - U0[i0]); \ 56 float c = -a*U0[i0] - b*U0[i1]; \ 57 float d0 = a*V0[i0] + b*V0[i1] + c; \ 59 a = U2[i1] - U1[i1]; \ 60 b = -(U2[i0] - U1[i0]); \ 61 c = -a*U1[i0] - b*U1[i1]; \ 62 const float d1 = a*V0[i0] + b*V0[i1] + c; \ 64 a = U0[i1] - U2[i1]; \ 65 b = -(U0[i0] - U2[i0]); \ 66 c = -a*U2[i0] - b*U2[i1]; \ 67 const float d2 = a*V0[i0] + b*V0[i1] + c; \ 70 if(d0*d2>0.0f) return TRUE; \ 124 #define NEWCOMPUTE_INTERVALS(VV0, VV1, VV2, D0, D1, D2, D0D1, D0D2, A, B, C, X0, X1) \ 130 A=VV2; B=(VV0 - VV2)*D2; C=(VV1 - VV2)*D2; X0=D2 - D0; X1=D2 - D1; \ 135 A=VV1; B=(VV0 - VV1)*D1; C=(VV2 - VV1)*D1; X0=D1 - D0; X1=D1 - D2; \ 137 else if(D1*D2>0.0f || D0!=0.0f) \ 140 A=VV0; B=(VV1 - VV0)*D0; C=(VV2 - VV0)*D0; X0=D0 - D1; X1=D0 - D2; \ 144 A=VV1; B=(VV0 - VV1)*D1; C=(VV2 - VV1)*D1; X0=D1 - D0; X1=D1 - D2; \ 148 A=VV2; B=(VV0 - VV2)*D2; C=(VV1 - VV2)*D2; X0=D2 - D0; X1=D2 - D1; \ 153 return CoplanarTriTri(N1, V0, V1, V2, U0, U1, U2); \ 195 i0[0] = V0.
x; i0[1] = V0.
y; i0[2] = V0.
z;
196 i1[0] = V1.
x; i1[1] = V1.
y; i1[2] = V1.
z;
197 i2[0] = V2.
x; i2[1] = V2.
y; i2[2] = V2.
z;
199 p0[0] = U0.
x; p0[1] = U0.
y; p0[2] = U0.
z;
200 p1[0] = U1.
x; p1[1] = U1.
y; p1[2] = U1.
z;
201 p2[0] = U2.
x; p2[1] = U2.
y; p2[2] = U2.
z;
const AABBCollisionNode * mNowNode0
BOOL TriTriOverlap(const Point &V0, const Point &V1, const Point &V2, const Point &U0, const Point &U1, const Point &U2)
udword mNbPrimPrimTests
Number of Primitive-Primitive tests.
hrp::CollisionPairInserterBase * collisionPairInserter
#define EDGE_AGAINST_TRI_EDGES(V0, V1, U0, U1, U2)
TO BE DOCUMENTED.
const MeshInterface * mIMesh0
User-defined mesh interface for object0.
virtual int detectTriTriOverlap(const Vector3 &P1, const Vector3 &P2, const Vector3 &P3, const Vector3 &Q1, const Vector3 &Q2, const Vector3 &Q3, collision_data *col_p)=0
detect collsiion between triangles
int BOOL
Another boolean type.
#define POINT_IN_TRI(V0, U0, U1, U2)
TO BE DOCUMENTED.
const AABBCollisionNode * mNowNode1
BOOL CoplanarTriTri(const Point &n, const Point &v0, const Point &v1, const Point &v2, const Point &u0, const Point &u1, const Point &u2)
TO BE DOCUMENTED.
virtual int apply(const Opcode::AABBCollisionNode *b1, const Opcode::AABBCollisionNode *b2, int id1, int id2, int num_of_i_points, Vector3 i_points[4], Vector3 &n_vector, double depth, Vector3 &n1, Vector3 &m1, int ctype, Opcode::MeshInterface *mesh1, Opcode::MeshInterface *mesh2)=0
refine collision information using neighboring triangls
const MeshInterface * mIMesh1
User-defined mesh interface for object1.