DART  6.6.2
tri_tri_intersection_test.hpp File Reference
#include <math.h>

Go to the source code of this file.

Macros

#define FABS(x)   ((float)fabs(x)) /* implement as is fastest on your machine */
 
#define USE_EPSILON_TEST   TRUE
 
#define EPSILON   0.000001
 
#define NO_CONTACT   0
 
#define COPLANAR_CONTACT   -1
 
#define INTERIAL_CONTACT   1
 
#define CROSS(dest, v1, v2)
 
#define DOT(v1, v2)   (v1[0]*v2[0]+v1[1]*v2[1]+v1[2]*v2[2])
 
#define SUB(dest, v1, v2)   dest[0]=v1[0]-v2[0]; dest[1]=v1[1]-v2[1]; dest[2]=v1[2]-v2[2];
 
#define ADD(dest, v1, v2)   dest[0]=v1[0]+v2[0]; dest[1]=v1[1]+v2[1]; dest[2]=v1[2]+v2[2];
 
#define MULT(dest, v, factor)   dest[0]=factor*v[0]; dest[1]=factor*v[1]; dest[2]=factor*v[2];
 
#define DIV(dest, v1, v2)   dest[0]=v1[0]/v2[0]; dest[1]=v1[1]/2[1]; dest[2]=v1[2]/v2[2];
 
#define SET(dest, src)   dest[0]=src[0]; dest[1]=src[1]; dest[2]=src[2];
 
#define SORT(a, b)
 
#define SWAP(a, b)
 
#define ISECT(VV0, VV1, VV2, D0, D1, D2, isect0, isect1)
 
#define COMPUTE_INTERVALS(VV0, VV1, VV2, D0, D1, D2, D0D1, D0D2, isect0, isect1)
 

Functions

void edge_tri_intersect (float V0[3], float V1[3], float DV0, float DV1, float V[3])
 
int tri_tri_intersect (float V0[3], float V1[3], float V2[3], float U0[3], float U1[3], float U2[3], float res1[3], float res2[3])
 

Macro Definition Documentation

◆ ADD

#define ADD (   dest,
  v1,
  v2 
)    dest[0]=v1[0]+v2[0]; dest[1]=v1[1]+v2[1]; dest[2]=v1[2]+v2[2];

◆ COMPUTE_INTERVALS

#define COMPUTE_INTERVALS (   VV0,
  VV1,
  VV2,
  D0,
  D1,
  D2,
  D0D1,
  D0D2,
  isect0,
  isect1 
)
Value:
if(D0D1>0.0f) \
{ \
/* here we know that D0D2<=0.0 */ \
/* that is D0, D1 are on the same side, D2 on the other or on the plane */ \
ISECT(VV2,VV0,VV1,D2,D0,D1,isect0,isect1); \
} \
else if(D0D2>0.0f) \
{ \
/* here we know that d0d1<=0.0 */ \
ISECT(VV1,VV0,VV2,D1,D0,D2,isect0,isect1); \
} \
else if(D1*D2>0.0f || D0!=0.0f) \
{ \
/* here we know that d0d1<=0.0 or that D0!=0.0 */ \
ISECT(VV0,VV1,VV2,D0,D1,D2,isect0,isect1); \
} \
else if(D1!=0.0f) \
{ \
ISECT(VV1,VV0,VV2,D1,D0,D2,isect0,isect1); \
} \
else if(D2!=0.0f) \
{ \
ISECT(VV2,VV0,VV1,D2,D0,D1,isect0,isect1); \
} \
else \
{ \
/* triangles are coplanar */ \
return COPLANAR_CONTACT; \
}
#define COPLANAR_CONTACT
Definition: tri_tri_intersection_test.hpp:48

◆ COPLANAR_CONTACT

#define COPLANAR_CONTACT   -1

◆ CROSS

#define CROSS (   dest,
  v1,
  v2 
)
Value:
dest[0]=v1[1]*v2[2]-v1[2]*v2[1]; \
dest[1]=v1[2]*v2[0]-v1[0]*v2[2]; \
dest[2]=v1[0]*v2[1]-v1[1]*v2[0];

◆ DIV

#define DIV (   dest,
  v1,
  v2 
)    dest[0]=v1[0]/v2[0]; dest[1]=v1[1]/2[1]; dest[2]=v1[2]/v2[2];

◆ DOT

#define DOT (   v1,
  v2 
)    (v1[0]*v2[0]+v1[1]*v2[1]+v1[2]*v2[2])

◆ EPSILON

#define EPSILON   0.000001

◆ FABS

#define FABS (   x)    ((float)fabs(x)) /* implement as is fastest on your machine */

◆ INTERIAL_CONTACT

#define INTERIAL_CONTACT   1

◆ ISECT

#define ISECT (   VV0,
  VV1,
  VV2,
  D0,
  D1,
  D2,
  isect0,
  isect1 
)
Value:
isect0=VV0+(VV1-VV0)*D0/(D0-D1); \
isect1=VV0+(VV2-VV0)*D0/(D0-D2);

◆ MULT

#define MULT (   dest,
  v,
  factor 
)    dest[0]=factor*v[0]; dest[1]=factor*v[1]; dest[2]=factor*v[2];

◆ NO_CONTACT

#define NO_CONTACT   0

◆ SET

#define SET (   dest,
  src 
)    dest[0]=src[0]; dest[1]=src[1]; dest[2]=src[2];

◆ SORT

#define SORT (   a,
 
)
Value:
if(a>b) \
{ \
float c; \
c=a; \
a=b; \
b=c; \
}

◆ SUB

#define SUB (   dest,
  v1,
  v2 
)    dest[0]=v1[0]-v2[0]; dest[1]=v1[1]-v2[1]; dest[2]=v1[2]-v2[2];

◆ SWAP

#define SWAP (   a,
 
)
Value:
{ \
float c; \
c=a; \
a=b; \
b=c; \
}

◆ USE_EPSILON_TEST

#define USE_EPSILON_TEST   TRUE

Function Documentation

◆ edge_tri_intersect()

void edge_tri_intersect ( float  V0[3],
float  V1[3],
float  DV0,
float  DV1,
float  V[3] 
)
inline

◆ tri_tri_intersect()

int tri_tri_intersect ( float  V0[3],
float  V1[3],
float  V2[3],
float  U0[3],
float  U1[3],
float  U2[3],
float  res1[3],
float  res2[3] 
)
inline