Polygon.cc File Reference

#include <esg/Definitions.h>
#include <esg/geometry/Polygon.h>
#include <esg/mesh/PolygonMesh.h>

Go to the source code of this file.

Defines

#define ESG_EDGE_EDGE_TEST(V0, U0, U1)
#define ESG_EDGE_AGAINST_TRI_EDGES(V0, V1, U0, U1, U2)
#define ESG_COMPUTE_INTERVALS(VV0, VV1, VV2, D0, D1, D2, D0D1, D0D2, A, B, C, X0, X1)
#define ESG_SORT(a, b)   if (a>b) { double c; c=a; a=b; b=c; }

Functions

 for (register unsigned i=2;i< _nVert;i++)

Variables

return proj


Define Documentation

#define ESG_COMPUTE_INTERVALS VV0,
VV1,
VV2,
D0,
D1,
D2,
D0D1,
D0D2,
A,
B,
C,
X0,
X1   ) 
 

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 */ \
            A=VV2; B=(VV0-VV2)*D2; C=(VV1-VV2)*D2; X0=D2-D0; X1=D2-D1; \
        } else if(D0D2>0.0f) { \
            /* here we know that d0d1<=0.0 */ \
            A=VV1; B=(VV0-VV1)*D1; C=(VV2-VV1)*D1; X0=D1-D0; X1=D1-D2; \
        } else if(D1*D2>0.0f || D0!=0.0f) { \
            /* here we know that d0d1<=0.0 or that D0!=0.0 */ \
            A=VV0; B=(VV1-VV0)*D0; C=(VV2-VV0)*D0; X0=D0-D1; X1=D0-D2; \
        } else if(D1!=0.0f) { \
            A=VV1; B=(VV0-VV1)*D1; C=(VV2-VV1)*D1; X0=D1-D0; X1=D1-D2; \
        } else if(D2!=0.0f) { \
            A=VV2; B=(VV0-VV2)*D2; C=(VV1-VV2)*D2; X0=D2-D0; X1=D2-D1; \
        } else { \
            /* triangles are coplanar */ \
            return _coplanar_tri_collision(p,                             \
                                           p2Vertex0,p2Vertex1,p2Vertex2, \
                                           p2Vertex0,p2Vertex1,p2Vertex2);\
        } \
}

Definition at line 324 of file Polygon.cc.

Referenced by Polygon::_triTriCollision().

#define ESG_EDGE_AGAINST_TRI_EDGES V0,
V1,
U0,
U1,
U2   ) 
 

Value:

{                                                              \
  double Ax=0.0,Ay=0.0,Bx=0.0,By=0.0,Cx=0.0,Cy=0.0,e,d,f;      \
  switch (p._edgeProjection) {                                 \
  case Polygon::XY: Ax = V1.x - V0.x; Ay = V1.y - V0.y; break; \
  case Polygon::YZ: Ax = V1.y - V0.y; Ay = V1.z - V0.z; break; \
  case Polygon::XZ: Ax = V1.x - V0.x; Ay = V1.z - V0.z; break; \
  case Polygon::NONE_PROJ: return false;                       \
  }                                                            \
  /* test edge U0,U1 against V0,V1 */                          \
  ESG_EDGE_EDGE_TEST(V0,U0,U1);                                \
  /* test edge U1,U2 against V0,V1 */                          \
  ESG_EDGE_EDGE_TEST(V0,U1,U2);                                \
  /* test edge U2,U1 against V0,V1 */                          \
  ESG_EDGE_EDGE_TEST(V0,U2,U0);                                \
}

Definition at line 285 of file Polygon.cc.

Referenced by Polygon::_coplanar_tri_collision().

#define ESG_EDGE_EDGE_TEST V0,
U0,
U1   ) 
 

Value:

switch (_edgeProjection) {                          \
  case Polygon::XY: Bx=U0.x-U1.x;By=U0.y-U1.y;Cx=V0.x-U0.x;Cy=V0.y-U0.y;break;\
  case Polygon::YZ: Bx=U0.y-U1.y;By=U0.z-U1.z;Cx=V0.y-U0.y;Cy=V0.z-U0.z;break;\
  case Polygon::XZ: Bx=U0.x-U1.x;By=U0.z-U1.z;Cx=V0.x-U0.x;Cy=V0.z-U0.z;break;\
  case Polygon::NONE_PROJ: return false;              \
  }                                                   \
  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 true;                   \
    }                                                 \
    else                                              \
    {                                                 \
      if(e<=0 && e>=f) return true;                   \
    }                                                 \
  }

Definition at line 263 of file Polygon.cc.

#define ESG_SORT a,
 )     if (a>b) { double c; c=a; a=b; b=c; }
 

Definition at line 349 of file Polygon.cc.

Referenced by Polygon::_triTriCollision().


Function Documentation

for  ) 
 

Definition at line 122 of file Polygon.cc.

Referenced by FDH14::RotInfo::recompute().


Variable Documentation

return proj
 

Definition at line 151 of file Polygon.cc.


Generated on Wed Jun 28 12:24:33 2006 for esg by  doxygen 1.4.6