56#ifdef FOR_TRITE_TEST_PROGRAM
59#define DebugEvent( tess )
94#define MAX(x,y) ((x) >= (y) ? (x) : (y))
95#define MIN(x,y) ((x) <= (y) ? (x) : (y))
100#define AddWinding(eDst,eSrc) (eDst->winding += eSrc->winding, \
101 eDst->Sym->winding += eSrc->Sym->winding)
128 if( e1->Dst == event ) {
129 if( e2->Dst == event ) {
140 if( e2->Dst == event ) {
195 if (
e == NULL)
return NULL;
209 }
while( reg->
eUp->Dst == dst );
224 if (regNew == NULL) longjmp(tess->
env,1);
226 regNew->
eUp = eNewUp;
229 if (regNew->
nodeUp == NULL) longjmp(tess->
env,1);
250 return (
n >= 2) || (
n <= -2);
303 ePrev = regFirst->
eUp;
304 while( regPrev != regLast ) {
308 if(
e->Org != ePrev->
Org ) {
323 if (
e == NULL) longjmp(tess->
env,1);
356 int firstTime =
TRUE;
364 }
while (
e != eLast );
370 if( eTopLeft == NULL ) {
378 if(
e->Org != ePrev->
Org )
break;
380 if(
e->Onext != ePrev ) {
413 void *data[4],
GLfloat weights[4],
int needed )
418 coords[0] = isect->
coords[0];
419 coords[1] = isect->
coords[1];
420 coords[2] = isect->
coords[2];
424 if( isect->
data == NULL ) {
426 isect->
data = data[0];
445 void *data[4] = { NULL, NULL, NULL, NULL };
446 GLfloat weights[4] = { 0.5, 0.5, 0.0, 0.0 };
467 weights[0] = 0.5 * t2 / (
t1 + t2);
468 weights[1] = 0.5 *
t1 / (
t1 + t2);
469 isect->
coords[0] += weights[0]*
org->coords[0] + weights[1]*dst->
coords[0];
470 isect->
coords[1] += weights[0]*
org->coords[1] + weights[1]*dst->
coords[1];
471 isect->
coords[2] += weights[0]*
org->coords[2] + weights[1]*dst->
coords[2];
487 data[0] = orgUp->
data;
488 data[1] = dstUp->
data;
489 data[2] = orgLo->
data;
490 data[3] = dstLo->
data;
540 }
else if( eUp->
Org != eLo->
Org ) {
581 assert( !
VertEq( eUp->Dst, eLo->Dst ));
583 if(
VertLeq( eUp->Dst, eLo->Dst )) {
589 if (
e == NULL) longjmp(tess->
env,1);
591 e->Lface->inside = regUp->
inside;
598 if (
e == NULL) longjmp(tess->
env,1);
600 e->Rface->inside = regUp->
inside;
628 assert( !
VertEq( dstLo, dstUp ));
631 assert( orgUp != tess->
event && orgLo != tess->
event );
634 if( orgUp == orgLo )
return FALSE;
636 tMinUp =
MIN( orgUp->
t, dstUp->
t );
637 tMaxLo =
MAX( orgLo->
t, dstLo->
t );
638 if( tMinUp > tMaxLo )
return FALSE;
651 assert(
MIN( orgUp->
t, dstUp->
t ) <= isect.
t );
652 assert( isect.
t <=
MAX( orgLo->
t, dstLo->
t ));
653 assert(
MIN( dstLo->
s, dstUp->
s ) <= isect.
s );
654 assert( isect.
s <=
MAX( orgLo->
s, orgUp->
s ));
672 orgMin =
VertLeq( orgUp, orgLo ) ? orgUp : orgLo;
673 if(
VertLeq( orgMin, &isect )) {
678 if(
VertEq( &isect, orgUp ) ||
VertEq( &isect, orgLo )) {
693 if( dstLo == tess->
event ) {
698 if (regUp == NULL) longjmp(tess->
env,1);
704 if( dstUp == tess->
event ) {
711 regLo->
eUp = eLo->Oprev;
747 eUp->
Org->
s = isect.
s;
748 eUp->
Org->
t = isect.
t;
753 longjmp(tess->
env,1);
775 while( regLo->
dirty ) {
779 if( ! regUp->
dirty ) {
782 if( regUp == NULL || ! regUp->
dirty ) {
791 if( eUp->Dst != eLo->Dst ) {
812 if( eUp->
Org != eLo->
Org ) {
813 if( eUp->Dst != eLo->Dst
815 && (eUp->Dst == tess->
event || eLo->Dst == tess->
event) )
836 if( eUp->
Org == eLo->
Org && eUp->Dst == eLo->Dst ) {
886 int degenerate =
FALSE;
888 if( eUp->Dst != eLo->Dst ) {
898 if (regUp == NULL) longjmp(tess->
env,1);
922 if (eNew == NULL) longjmp(tess->
env,1);
939#define TOLERANCE_NONZERO FALSE
953 if(
VertEq(
e->Org, vEvent )) {
962 if( !
VertEq(
e->Dst, vEvent )) {
981 eTopRight = reg->
eUp->
Sym;
982 eTopLeft = eLast = eTopRight->
Onext;
987 assert( eTopLeft != eTopRight );
990 eTopRight = eTopLeft->Oprev;
1033 if(
EdgeSign( eUp->Dst, vEvent, eUp->
Org ) == 0 ) {
1041 reg =
VertLeq( eLo->Dst, eUp->Dst ) ? regUp : regLo;
1044 if( reg == regUp ) {
1046 if (eNew == NULL) longjmp(tess->
env,1);
1049 if (tempHalfEdge == NULL) longjmp(tess->
env,1);
1051 eNew = tempHalfEdge->
Sym;
1077 tess->
event = vEvent;
1085 while(
e->activeRegion == NULL ) {
1102 if (regUp == NULL) longjmp(tess->
env,1);
1104 eTopLeft = reg->
eUp;
1112 if( eBottomLeft->
Onext == eTopLeft ) {
1126#define SENTINEL_COORD (4 * GLU_TESS_MAX_COORD)
1136 if (reg == NULL) longjmp(tess->
env,1);
1139 if (
e == NULL) longjmp(tess->
env,1);
1154 if (reg->
nodeUp == NULL) longjmp(tess->
env,1);
1166 if (tess->
dict == NULL) longjmp(tess->
env,1);
1189 assert( ++fixedEdges == 1 );
1208 for(
e = eHead->
next;
e != eHead;
e = eNext ) {
1212 if(
VertEq(
e->Org,
e->Dst ) &&
e->Lnext->Lnext !=
e ) {
1220 if( eLnext->
Lnext ==
e ) {
1224 if( eLnext == eNext || eLnext == eNext->
Sym ) { eNext = eNext->
next; }
1227 if(
e == eNext ||
e == eNext->
Sym ) { eNext = eNext->
next; }
1244 if (pq == NULL)
return 0;
1247 for(
v = vHead->
next;
v != vHead;
v =
v->next ) {
1249 if (
v->pqHandle == LONG_MAX)
break;
1251 if (
v != vHead || !
pqInit( pq ) ) {
1290 assert(
e->Lnext !=
e );
1292 if(
e->Lnext->Lnext ==
e ) {
1328 if( vNext == NULL || !
VertEq( vNext,
v ))
break;
#define GLU_TESS_WINDING_NONZERO
#define GLU_TESS_WINDING_POSITIVE
#define GLU_TESS_WINDING_NEGATIVE
#define GLU_TESS_WINDING_ODD
#define GLU_TESS_NEED_COMBINE_CALLBACK
#define GLU_TESS_WINDING_ABS_GEQ_TWO
typedef void((*Func_t)())
#define dictInsert(dict, key)
#define dictDeleteDict(dict)
#define dictSearch(dict, key)
#define dictDelete(dict, node)
#define dictInsertBefore(dict, node, key)
#define dictNewDict(frame, leq)
void __gl_edgeIntersect(GLUvertex *o1, GLUvertex *d1, GLUvertex *o2, GLUvertex *d2, GLUvertex *v)
int __gl_vertLeq(GLUvertex *u, GLUvertex *v)
#define EdgeSign(u, v, w)
#define EdgeEval(u, v, w)
GLUhalfEdge * __gl_meshMakeEdge(GLUmesh *mesh)
GLUhalfEdge * __gl_meshSplitEdge(GLUhalfEdge *eOrg)
void __gl_meshCheckMesh(GLUmesh *mesh)
GLUhalfEdge * __gl_meshConnect(GLUhalfEdge *eOrg, GLUhalfEdge *eDst)
int __gl_meshDelete(GLUhalfEdge *eDel)
int __gl_meshSplice(GLUhalfEdge *eOrg, GLUhalfEdge *eDst)
#define pqNewPriorityQ(leq)
#define pqDeletePriorityQ(pq)
#define pqDelete(pq, handle)
#define pqInsert(pq, key)
ActiveRegion * activeRegion
static void InitEdgeDict(GLUtesselator *tess)
static int FixUpperEdge(ActiveRegion *reg, GLUhalfEdge *newEdge)
#define AddWinding(eDst, eSrc)
static GLboolean IsWindingInside(GLUtesselator *tess, int n)
static void RemoveDegenerateEdges(GLUtesselator *tess)
static int CheckForRightSplice(GLUtesselator *tess, ActiveRegion *regUp)
static void CallCombine(GLUtesselator *tess, GLUvertex *isect, void *data[4], GLfloat weights[4], int needed)
static int RemoveDegenerateFaces(GLUmesh *mesh)
int __gl_computeInterior(GLUtesselator *tess)
static GLUhalfEdge * FinishLeftRegions(GLUtesselator *tess, ActiveRegion *regFirst, ActiveRegion *regLast)
static void FinishRegion(GLUtesselator *tess, ActiveRegion *reg)
static void SweepEvent(GLUtesselator *tess, GLUvertex *vEvent)
static ActiveRegion * TopLeftRegion(ActiveRegion *reg)
static ActiveRegion * AddRegionBelow(GLUtesselator *tess, ActiveRegion *regAbove, GLUhalfEdge *eNewUp)
static int InitPriorityQ(GLUtesselator *tess)
static void AddRightEdges(GLUtesselator *tess, ActiveRegion *regUp, GLUhalfEdge *eFirst, GLUhalfEdge *eLast, GLUhalfEdge *eTopLeft, GLboolean cleanUp)
static void GetIntersectData(GLUtesselator *tess, GLUvertex *isect, GLUvertex *orgUp, GLUvertex *dstUp, GLUvertex *orgLo, GLUvertex *dstLo)
static void DeleteRegion(GLUtesselator *tess, ActiveRegion *reg)
static void VertexWeights(GLUvertex *isect, GLUvertex *org, GLUvertex *dst, GLfloat *weights)
static ActiveRegion * TopRightRegion(ActiveRegion *reg)
static void WalkDirtyRegions(GLUtesselator *tess, ActiveRegion *regUp)
static void ConnectLeftVertex(GLUtesselator *tess, GLUvertex *vEvent)
static int CheckForIntersect(GLUtesselator *tess, ActiveRegion *regUp)
static int EdgeLeq(GLUtesselator *tess, ActiveRegion *reg1, ActiveRegion *reg2)
static void ConnectRightVertex(GLUtesselator *tess, ActiveRegion *regUp, GLUhalfEdge *eBottomLeft)
static void DoneEdgeDict(GLUtesselator *tess)
static void ComputeWinding(GLUtesselator *tess, ActiveRegion *reg)
static void ConnectLeftDegenerate(GLUtesselator *tess, ActiveRegion *regUp, GLUvertex *vEvent)
static int CheckForLeftSplice(GLUtesselator *tess, ActiveRegion *regUp)
static void DonePriorityQ(GLUtesselator *tess)
#define TOLERANCE_NONZERO
static void SpliceMergeVertices(GLUtesselator *tess, GLUhalfEdge *e1, GLUhalfEdge *e2)
static void AddSentinel(GLUtesselator *tess, GLdouble t)
#define CALL_ERROR_OR_ERROR_DATA(a)
#define CALL_COMBINE_OR_COMBINE_DATA(a, b, c, d)
#define org(otri, vertexptr)