#include <math.h>
#include <gfx/Triangle3>
#include <gfx/Plane>
Include dependency graph for Triangle3.cpp:
Go to the source code of this file.
Namespaces | |
namespace | gfx |
Defines | |
#define | FABS(x) (base::abs(x)) /* implement as is fastest on your machine */ |
#define | USE_EPSILON_TEST TRUE |
#define | EPSILON 0.000001 |
#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 | SET(dest, src) dest[0]=src[0]; dest[1]=src[1]; dest[2]=src[2]; |
#define | SORT(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) |
#define | EDGE_EDGE_TEST(V0, U0, U1) |
#define | EDGE_AGAINST_TRI_EDGES(V0, V1, U0, U1, U2) |
#define | POINT_IN_TRI(V0, U0, U1, U2) |
#define | NEWCOMPUTE_INTERVALS(VV0, VV1, VV2, D0, D1, D2, D0D1, D0D2, A, B, C, X0, X1) |
#define | SORT2(a, b, smallest) |
#define | COMPUTE_INTERVALS_ISECTLINE(VERT0, VERT1, VERT2, VV0, VV1, VV2, D0, D1, D2, D0D1, D0D2, isect0, isect1, isectpoint0, isectpoint1) |
Functions | |
int | coplanar_tri_tri (Real N[3], Real V0[3], Real V1[3], Real V2[3], Real U0[3], Real U1[3], Real U2[3]) |
int | tri_tri_intersect (Real V0[3], Real V1[3], Real V2[3], Real U0[3], Real U1[3], Real U2[3]) |
int | NoDivTriTriIsect (Real V0[3], Real V1[3], Real V2[3], Real U0[3], Real U1[3], Real U2[3]) |
void | isect2 (Real VTX0[3], Real VTX1[3], Real VTX2[3], Real VV0, Real VV1, Real VV2, Real D0, Real D1, Real D2, Real *isect0, Real *isect1, Real isectpoint0[3], Real isectpoint1[3]) |
int | compute_intervals_isectline (Real VERT0[3], Real VERT1[3], Real VERT2[3], Real VV0, Real VV1, Real VV2, Real D0, Real D1, Real D2, Real D0D1, Real D0D2, Real *isect0, Real *isect1, Real isectpoint0[3], Real isectpoint1[3]) |
int | tri_tri_intersect_with_isectline (Real V0[3], Real V1[3], Real V2[3], Real U0[3], Real U1[3], Real U2[3], int *coplanar, Real isectpt1[3], Real isectpt2[3]) |
|
Definition at line 766 of file Triangle3.cpp. Referenced by isect2(). |
|
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_tri_tri(N1,V0,V1,V2,U0,U1,U2); \ } Definition at line 787 of file Triangle3.cpp. Referenced by tri_tri_intersect(). |
|
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 */ \ isect2(VERT2,VERT0,VERT1,VV2,VV0,VV1,D2,D0,D1,&isect0,&isect1,isectpoint0,isectpoint1); \ } Definition at line 1240 of file Triangle3.cpp. |
|
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]; Definition at line 757 of file Triangle3.cpp. Referenced by NoDivTriTriIsect(), tri_tri_intersect(), and tri_tri_intersect_with_isectline(). |
|
Definition at line 762 of file Triangle3.cpp. Referenced by NoDivTriTriIsect(), tri_tri_intersect(), and tri_tri_intersect_with_isectline(). |
|
Value: { \ Real Ax,Ay,Bx,By,Cx,Cy,e,d,f; \ Ax=V1[i0]-V0[i0]; \ Ay=V1[i1]-V0[i1]; \ /* test edge U0,U1 against V0,V1 */ \ EDGE_EDGE_TEST(V0,U0,U1); \ /* test edge U1,U2 against V0,V1 */ \ EDGE_EDGE_TEST(V0,U1,U2); \ /* test edge U2,U1 against V0,V1 */ \ EDGE_EDGE_TEST(V0,U2,U0); \ } Definition at line 843 of file Triangle3.cpp. Referenced by coplanar_tri_tri(). |
|
Value: Bx=U0[i0]-U1[i0]; \ By=U0[i1]-U1[i1]; \ Cx=V0[i0]-U0[i0]; \ Cy=V0[i1]-U0[i1]; \ f=Ay*Bx-Ax*By; \ d=By*Cx-Bx*Cy; \ if((f>0 && d>=0 && d<=f) || (f<0 && d<=0 && d>=f)) \ { \ e=Ax*Cy-Ay*Cx; \ if(f>0) \ { \ if(e>=0 && e<=f) return 1; \ } \ else \ { \ if(e<=0 && e>=f) return 1; \ } \ } Definition at line 823 of file Triangle3.cpp. |
|
Definition at line 753 of file Triangle3.cpp. |
|
Definition at line 745 of file Triangle3.cpp. Referenced by NoDivTriTriIsect(). |
|
Value: isect0=VV0+(VV1-VV0)*D0/(D0-D1); \ isect1=VV0+(VV2-VV0)*D0/(D0-D2); Definition at line 782 of file Triangle3.cpp. |
|
Definition at line 768 of file Triangle3.cpp. Referenced by isect2(). |
|
Definition at line 1027 of file Triangle3.cpp. Referenced by NoDivTriTriIsect(). |
|
Value: { \ Real a,b,c,d0,d1,d2; \ /* is T1 completly inside T2? */ \ /* check if V0 is inside tri(U0,U1,U2) */ \ a=U1[i1]-U0[i1]; \ b=-(U1[i0]-U0[i0]); \ c=-a*U0[i0]-b*U0[i1]; \ d0=a*V0[i0]+b*V0[i1]+c; \ \ a=U2[i1]-U1[i1]; \ b=-(U2[i0]-U1[i0]); \ c=-a*U1[i0]-b*U1[i1]; \ d1=a*V0[i0]+b*V0[i1]+c; \ \ a=U0[i1]-U2[i1]; \ b=-(U0[i0]-U2[i0]); \ c=-a*U2[i0]-b*U2[i1]; \ d2=a*V0[i0]+b*V0[i1]+c; \ if(d0*d1>0.0) \ { \ if(d0*d2>0.0) return 1; \ } \ } Definition at line 856 of file Triangle3.cpp. Referenced by coplanar_tri_tri(). |
|
Definition at line 770 of file Triangle3.cpp. Referenced by tri_tri_intersect_with_isectline(). |
|
Value: if(a>b) \ { \ Real c; \ c=a; \ a=b; \ b=c; \ } Definition at line 773 of file Triangle3.cpp. Referenced by NoDivTriTriIsect(), and tri_tri_intersect(). |
|
Value: if(a>b) \ { \ Real c; \ c=a; \ a=b; \ b=c; \ smallest=1; \ } \ else smallest=0; Definition at line 1173 of file Triangle3.cpp. Referenced by tri_tri_intersect_with_isectline(). |
|
Definition at line 764 of file Triangle3.cpp. Referenced by isect2(), NoDivTriTriIsect(), tri_tri_intersect(), and tri_tri_intersect_with_isectline(). |
|
Definition at line 752 of file Triangle3.cpp. |
|
Definition at line 1203 of file Triangle3.cpp. References isect2(). Referenced by tri_tri_intersect_with_isectline(). |
|
Definition at line 881 of file Triangle3.cpp. References EDGE_AGAINST_TRI_EDGES, and POINT_IN_TRI. Referenced by tri_tri_intersect_with_isectline(). |
|
Definition at line 1185 of file Triangle3.cpp. References ADD, MULT, and SUB. Referenced by compute_intervals_isectline(), NoDivTriTriIsect(), tri_tri_intersect(), and tri_tri_intersect_with_isectline(). |
|
Definition at line 1062 of file Triangle3.cpp. References CROSS, DOT, E1, E2, EPSILON, f, FABS, isect2(), NEWCOMPUTE_INTERVALS, SORT, and SUB. |
|
Definition at line 931 of file Triangle3.cpp. References COMPUTE_INTERVALS, CROSS, DOT, E1, E2, EPSILON, isect2(), SORT, and SUB. |
|
Definition at line 1274 of file Triangle3.cpp. References compute_intervals_isectline(), coplanar_tri_tri(), CROSS, DOT, E1, E2, EPSILON, isect2(), SET, SORT2, and SUB. |