Namespaces | Defines | Functions

/home/hauberg/Dokumenter/Capture/humim-tracker-0.1/src/OpenTissue/OpenTissue/collision/intersect/intersect_triangle_triangle_interval_overlap.h File Reference

#include <OpenTissue/configuration.h>
#include <OpenTissue/core/math/math_precision.h>
#include <cmath>
#include <math.h>

Go to the source code of this file.

Namespaces

namespace  OpenTissue
namespace  OpenTissue::intersect
namespace  OpenTissue::intersect::Moller
namespace  OpenTissue::intersect::Moller::detail
namespace  OpenTissue::intersect::Moller::old_stuff_soon_dies

Defines

#define FABS(x)   ((float)std::fabs(x))
#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

template<typename vector3_type , typename real_type >
bool OpenTissue::intersect::Moller::detail::edge_edge_test (vector3_type const &V0, vector3_type const &U0, vector3_type const &U1, unsigned int i0, unsigned int i1, real_type Ax, real_type Ay)
template<typename vector3_type , typename real_type >
bool OpenTissue::intersect::Moller::detail::edge_against_tri_edges (vector3_type const &V0, vector3_type const &V1, vector3_type const &U0, vector3_type const &U1, vector3_type const &U2, unsigned int i0, unsigned int i1)
template<typename vector3_type , typename real_type >
bool OpenTissue::intersect::Moller::detail::point_in_tri (vector3_type const &V0 vector3_type const &U0, vector3_type const &U1, vector3_type const &U2, unsigned int i0, unsigned int i1)
template<typename vector3_type >
bool OpenTissue::intersect::Moller::detail::coplanar_tri_tri (vector3_type const &N, vector3_type const &V0, vector3_type const &V1, vector3_type const &V2, vector3_type const &U0, vector3_type const &U1, vector3_type const &U2)
template<typename vector3_type , typename real_type >
void OpenTissue::intersect::Moller::detail::isect2 (vector3_type const &VTX0, vector3_type const &VTX1, vector3_type const &VTX2, real_type VV0, real_type VV1, real_type VV2, real_type D0, real_type D1, real_type D2, real_type &isect0, real_type &isect1, vector3_type &isectpoint0, vector3_type &isectpoint1)
template<typename vector3_type , typename real_type >
bool OpenTissue::intersect::Moller::detail::compute_intervals_isectline (vector3_type const &VERT0, vector3_type const &VERT1, vector3_type const &VERT2, real_type VV0, real_type VV1, real_type VV2, real_type D0, real_type D1, real_type D2, real_type D0D1, real_type D0D2, real_type &isect0, real_type &isect1, vector3_type &isectpoint0, vector3_type &isectpoint1)
template<typename vector3_type >
bool OpenTissue::intersect::Moller::detail::triangle_triangle_interval_overlap (vector3_type const &V0, vector3_type const &V1, vector3_type const &V2, vector3_type const &U0, vector3_type const &U1, vector3_type const &U2, bool &coplanar, vector3_type &isectpt1, vector3_type &isectpt2, bool epsilon_test=true)
template<typename triangle_type >
bool OpenTissue::intersect::Moller::triangle_triangle_interval_overlap (triangle_type const &t0, triangle_type const &t1, bool epsilon_test=true)
template<typename triangle_type , typename vector3_type >
bool OpenTissue::intersect::Moller::triangle_triangle_interval_overlap (triangle_type const &t0, triangle_type const &t1, bool &coplanar, vector3_type &p0, vector3_type &p1, bool epsilon_test=true)
template<typename vector3_type >
bool OpenTissue::intersect::Moller::triangle_triangle_interval_overlap (vector3_type const &v0, vector3_type const &v1, vector3_type const &v2, vector3_type const &u0, vector3_type const &u1, vector3_type const &u2, bool epsilon_test=true)
template<typename vector3_type >
bool OpenTissue::intersect::Moller::triangle_triangle_interval_overlap (vector3_type const &v0, vector3_type const &v1, vector3_type const &v2, vector3_type const &u0, vector3_type const &u1, vector3_type const &u2, bool &coplanar, vector3_type &p0, vector3_type &p1, bool epsilon_test=true)
bool OpenTissue::intersect::Moller::old_stuff_soon_dies::wrapNoDivTriTriIntersect (const Triangle &triA, const Triangle &triB)
bool OpenTissue::intersect::Moller::old_stuff_soon_dies::wrapTriTriIntersectLine (const Triangle &triA, const Triangle &triB, bool &coplanar, Vector3< double > &pt1, Vector3< double > &pt2)
bool OpenTissue::intersect::Moller::old_stuff_soon_dies::wrapTriTriIntersect (const Triangle &triA, const Triangle &triB)
bool OpenTissue::intersect::Moller::old_stuff_soon_dies::NoDivTriTriIsect (float V0[3], float V1[3], float V2[3], float U0[3], float U1[3], float U2[3])
bool OpenTissue::intersect::Moller::old_stuff_soon_dies::tri_tri_intersect_with_isectline (float V0[3], float V1[3], float V2[3], float U0[3], float U1[3], float U2[3], int *coplanar, float isectpt1[3], float isectpt2[3])
bool OpenTissue::intersect::Moller::old_stuff_soon_dies::tri_tri_intersect (float V0[3], float V1[3], float V2[3], float U0[3], float U1[3], float U2[3])
bool OpenTissue::intersect::Moller::old_stuff_soon_dies::coplanar_tri_tri (float N[3], float V0[3], float V1[3], float V2[3], float U0[3], float U1[3], float U2[3])
void OpenTissue::intersect::Moller::old_stuff_soon_dies::isect2 (float VTX0[3], float VTX1[3], float VTX2[3], float VV0, float VV1, float VV2, float D0, float D1, float D2, float *isect0, float *isect1, float isectpoint0[3], float isectpoint1[3])
bool OpenTissue::intersect::Moller::old_stuff_soon_dies::compute_intervals_isectline (float VERT0[3], float VERT1[3], float VERT2[3], float VV0, float VV1, float VV2, float D0, float D1, float D2, float D0D1, float D0D2, float *isect0, float *isect1, float isectpoint0[3], float isectpoint1[3])

Define Documentation

#define ADD (   dest,
  v1,
  v2 
)    dest[0]=v1[0]+v2[0]; dest[1]=v1[1]+v2[1]; dest[2]=v1[2]+v2[2];
#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_tri_tri(N1,V0,V1,V2,U0,U1,U2);      \
        }
#define COMPUTE_INTERVALS_ISECTLINE (   VERT0,
  VERT1,
  VERT2,
  VV0,
  VV1,
  VV2,
  D0,
  D1,
  D2,
  D0D1,
  D0D2,
  isect0,
  isect1,
  isectpoint0,
  isectpoint1 
)
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);          \
        }
#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];
#define DOT (   v1,
  v2 
)    (v1[0]*v2[0]+v1[1]*v2[1]+v1[2]*v2[2])
#define EDGE_AGAINST_TRI_EDGES (   V0,
  V1,
  U0,
  U1,
  U2 
)
Value:
{                                              \
        float 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);                    \
        }
#define EDGE_EDGE_TEST (   V0,
  U0,
  U1 
)
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;                      \
        }                                                 \
        }
#define EPSILON   0.000001
#define FABS (   x  )     ((float)std::fabs(x))
#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);
#define MULT (   dest,
  v,
  factor 
)    dest[0]=factor*v[0]; dest[1]=factor*v[1]; dest[2]=factor*v[2];
#define NEWCOMPUTE_INTERVALS (   VV0,
  VV1,
  VV2,
  D0,
  D1,
  D2,
  D0D1,
  D0D2,
  A,
  B,
  C,
  X0,
  X1 
)
#define POINT_IN_TRI (   V0,
  U0,
  U1,
  U2 
)
Value:
{                                           \
        float 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;                 \
        }                                         \
        }
#define SET (   dest,
  src 
)    dest[0]=src[0]; dest[1]=src[1]; dest[2]=src[2];
#define SORT (   a,
  b 
)
Value:
if(a>b)    \
        {          \
        float MACROTEMP; \
        MACROTEMP=a;     \
        a=b;     \
        b=MACROTEMP;     \
        }
#define SORT2 (   a,
  b,
  smallest 
)
Value:
if(a>b)         \
        {             \
        float MACRO_C;\
        MACRO_C=a;    \
        a=b;          \
        b=MACRO_C;    \
        smallest=1;   \
        }             \
  else smallest=0;
#define SUB (   dest,
  v1,
  v2 
)    dest[0]=v1[0]-v2[0]; dest[1]=v1[1]-v2[1]; dest[2]=v1[2]-v2[2];
#define USE_EPSILON_TEST   TRUE