ReactOS  0.4.14-dev-358-gbef841c
mesh.h File Reference
#include <GL/glu.h>
Include dependency graph for mesh.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  GLUvertex
 
struct  GLUface
 
struct  GLUhalfEdge
 
struct  GLUmesh
 

Macros

#define Rface   Sym->Lface
 
#define Dst   Sym->Org
 
#define Oprev   Sym->Lnext
 
#define Lprev   Onext->Sym
 
#define Dprev   Lnext->Sym
 
#define Rprev   Sym->Onext
 
#define Dnext   Rprev->Sym /* 3 pointers */
 
#define Rnext   Oprev->Sym /* 3 pointers */
 

Typedefs

typedef struct GLUmesh GLUmesh
 
typedef struct GLUvertex GLUvertex
 
typedef struct GLUface GLUface
 
typedef struct GLUhalfEdge GLUhalfEdge
 
typedef struct ActiveRegion ActiveRegion
 

Functions

GLUhalfEdge__gl_meshMakeEdge (GLUmesh *mesh)
 
int __gl_meshSplice (GLUhalfEdge *eOrg, GLUhalfEdge *eDst)
 
int __gl_meshDelete (GLUhalfEdge *eDel)
 
GLUhalfEdge__gl_meshAddEdgeVertex (GLUhalfEdge *eOrg)
 
GLUhalfEdge__gl_meshSplitEdge (GLUhalfEdge *eOrg)
 
GLUhalfEdge__gl_meshConnect (GLUhalfEdge *eOrg, GLUhalfEdge *eDst)
 
GLUmesh__gl_meshNewMesh (void)
 
GLUmesh__gl_meshUnion (GLUmesh *mesh1, GLUmesh *mesh2)
 
void __gl_meshDeleteMesh (GLUmesh *mesh)
 
void __gl_meshZapFace (GLUface *fZap)
 
void __gl_meshCheckMesh (GLUmesh *mesh)
 

Macro Definition Documentation

◆ Dnext

#define Dnext   Rprev->Sym /* 3 pointers */

Definition at line 159 of file mesh.h.

◆ Dprev

#define Dprev   Lnext->Sym

Definition at line 157 of file mesh.h.

◆ Dst

#define Dst   Sym->Org

Definition at line 153 of file mesh.h.

◆ Lprev

#define Lprev   Onext->Sym

Definition at line 156 of file mesh.h.

◆ Oprev

#define Oprev   Sym->Lnext

Definition at line 155 of file mesh.h.

◆ Rface

#define Rface   Sym->Lface

Definition at line 152 of file mesh.h.

◆ Rnext

#define Rnext   Oprev->Sym /* 3 pointers */

Definition at line 160 of file mesh.h.

◆ Rprev

#define Rprev   Sym->Onext

Definition at line 158 of file mesh.h.

Typedef Documentation

◆ ActiveRegion

Definition at line 46 of file mesh.h.

◆ GLUface

Definition at line 43 of file mesh.h.

◆ GLUhalfEdge

Definition at line 44 of file mesh.h.

◆ GLUmesh

Definition at line 40 of file mesh.h.

◆ GLUvertex

Definition at line 42 of file mesh.h.

Function Documentation

◆ __gl_meshAddEdgeVertex()

GLUhalfEdge* __gl_meshAddEdgeVertex ( GLUhalfEdge eOrg)

Definition at line 446 of file mesh.c.

447 {
448  GLUhalfEdge *eNewSym;
449  GLUhalfEdge *eNew = MakeEdge( eOrg );
450  if (eNew == NULL) return NULL;
451 
452  eNewSym = eNew->Sym;
453 
454  /* Connect the new edge appropriately */
455  Splice( eNew, eOrg->Lnext );
456 
457  /* Set the vertex and face information */
458  eNew->Org = eOrg->Dst;
459  {
460  GLUvertex *newVertex= allocVertex();
461  if (newVertex == NULL) return NULL;
462 
463  MakeVertex( newVertex, eNewSym, eNew->Org );
464  }
465  eNew->Lface = eNewSym->Lface = eOrg->Lface;
466 
467  return eNew;
468 }
static void Splice(GLUhalfEdge *a, GLUhalfEdge *b)
Definition: mesh.c:117
GLUhalfEdge * Lnext
Definition: mesh.h:142
GLUvertex * Org
Definition: mesh.h:143
static GLUhalfEdge * MakeEdge(GLUhalfEdge *eNext)
Definition: mesh.c:69
smooth NULL
Definition: ftsmooth.c:416
GLUface * Lface
Definition: mesh.h:144
GLUhalfEdge * Sym
Definition: mesh.h:140
static GLUvertex * allocVertex()
Definition: mesh.c:48
static void MakeVertex(GLUvertex *newVertex, GLUhalfEdge *eOrig, GLUvertex *vNext)
Definition: mesh.c:134

Referenced by __gl_meshSplitEdge().

◆ __gl_meshCheckMesh()

void __gl_meshCheckMesh ( GLUmesh mesh)

Definition at line 742 of file mesh.c.

743 {
744  GLUface *fHead = &mesh->fHead;
745  GLUvertex *vHead = &mesh->vHead;
746  GLUhalfEdge *eHead = &mesh->eHead;
747  GLUface *f, *fPrev;
748  GLUvertex *v, *vPrev;
749  GLUhalfEdge *e, *ePrev;
750 
751  fPrev = fHead;
752  for( fPrev = fHead ; (f = fPrev->next) != fHead; fPrev = f) {
753  assert( f->prev == fPrev );
754  e = f->anEdge;
755  do {
756  assert( e->Sym != e );
757  assert( e->Sym->Sym == e );
758  assert( e->Lnext->Onext->Sym == e );
759  assert( e->Onext->Sym->Lnext == e );
760  assert( e->Lface == f );
761  e = e->Lnext;
762  } while( e != f->anEdge );
763  }
764  assert( f->prev == fPrev && f->anEdge == NULL && f->data == NULL );
765 
766  vPrev = vHead;
767  for( vPrev = vHead ; (v = vPrev->next) != vHead; vPrev = v) {
768  assert( v->prev == vPrev );
769  e = v->anEdge;
770  do {
771  assert( e->Sym != e );
772  assert( e->Sym->Sym == e );
773  assert( e->Lnext->Onext->Sym == e );
774  assert( e->Onext->Sym->Lnext == e );
775  assert( e->Org == v );
776  e = e->Onext;
777  } while( e != v->anEdge );
778  }
779  assert( v->prev == vPrev && v->anEdge == NULL && v->data == NULL );
780 
781  ePrev = eHead;
782  for( ePrev = eHead ; (e = ePrev->next) != eHead; ePrev = e) {
783  assert( e->Sym->next == ePrev->Sym );
784  assert( e->Sym != e );
785  assert( e->Sym->Sym == e );
786  assert( e->Org != NULL );
787  assert( e->Dst != NULL );
788  assert( e->Lnext->Onext->Sym == e );
789  assert( e->Onext->Sym->Lnext == e );
790  }
791  assert( e->Sym->next == ePrev->Sym
792  && e->Sym == &mesh->eHeadSym
793  && e->Sym->Sym == e
794  && e->Org == NULL && e->Dst == NULL
795  && e->Lface == NULL && e->Rface == NULL );
796 }
#define assert(x)
Definition: debug.h:53
GLUface * next
Definition: mesh.h:127
GLUvertex vHead
Definition: mesh.h:164
Definition: mesh.h:126
GLUhalfEdge eHeadSym
Definition: mesh.h:167
#define e
Definition: ke_i.h:82
GLUface fHead
Definition: mesh.h:165
smooth NULL
Definition: ftsmooth.c:416
GLUhalfEdge eHead
Definition: mesh.h:166
GLfloat f
Definition: glext.h:7540
GLUhalfEdge * Sym
Definition: mesh.h:140
GLUhalfEdge * next
Definition: mesh.h:139
const GLdouble * v
Definition: gl.h:2040
GLUvertex * next
Definition: mesh.h:115
struct define * next
Definition: compiler.c:65
#define f
Definition: ke_i.h:83

Referenced by __gl_computeInterior(), and gluTessEndPolygon().

◆ __gl_meshConnect()

GLUhalfEdge* __gl_meshConnect ( GLUhalfEdge eOrg,
GLUhalfEdge eDst 
)

Definition at line 508 of file mesh.c.

509 {
510  GLUhalfEdge *eNewSym;
511  int joiningLoops = FALSE;
512  GLUhalfEdge *eNew = MakeEdge( eOrg );
513  if (eNew == NULL) return NULL;
514 
515  eNewSym = eNew->Sym;
516 
517  if( eDst->Lface != eOrg->Lface ) {
518  /* We are connecting two disjoint loops -- destroy eDst->Lface */
519  joiningLoops = TRUE;
520  KillFace( eDst->Lface, eOrg->Lface );
521  }
522 
523  /* Connect the new edge appropriately */
524  Splice( eNew, eOrg->Lnext );
525  Splice( eNewSym, eDst );
526 
527  /* Set the vertex and face information */
528  eNew->Org = eOrg->Dst;
529  eNewSym->Org = eDst->Org;
530  eNew->Lface = eNewSym->Lface = eOrg->Lface;
531 
532  /* Make sure the old face points to a valid half-edge */
533  eOrg->Lface->anEdge = eNewSym;
534 
535  if( ! joiningLoops ) {
536  GLUface *newFace= allocFace();
537  if (newFace == NULL) return NULL;
538 
539  /* We split one loop into two -- the new loop is eNew->Lface */
540  MakeFace( newFace, eNew, eOrg->Lface );
541  }
542  return eNew;
543 }
static void Splice(GLUhalfEdge *a, GLUhalfEdge *b)
Definition: mesh.c:117
GLUhalfEdge * Lnext
Definition: mesh.h:142
#define FALSE
Definition: mesh.c:45
GLUvertex * Org
Definition: mesh.h:143
static void MakeFace(GLUface *newFace, GLUhalfEdge *eOrig, GLUface *fNext)
Definition: mesh.c:168
Definition: mesh.h:126
static GLUhalfEdge * MakeEdge(GLUhalfEdge *eNext)
Definition: mesh.c:69
static GLUface * allocFace()
Definition: mesh.c:53
GLUhalfEdge * anEdge
Definition: mesh.h:129
smooth NULL
Definition: ftsmooth.c:416
static void KillFace(GLUface *fDel, GLUface *newLface)
Definition: mesh.c:248
GLUface * Lface
Definition: mesh.h:144
GLUhalfEdge * Sym
Definition: mesh.h:140
#define TRUE
Definition: mesh.c:42

Referenced by __gl_meshTessellateMonoRegion(), ConnectLeftVertex(), ConnectRightVertex(), FinishLeftRegions(), and TopLeftRegion().

◆ __gl_meshDelete()

int __gl_meshDelete ( GLUhalfEdge eDel)

Definition at line 384 of file mesh.c.

385 {
386  GLUhalfEdge *eDelSym = eDel->Sym;
387  int joiningLoops = FALSE;
388 
389  /* First step: disconnect the origin vertex eDel->Org. We make all
390  * changes to get a consistent mesh in this "intermediate" state.
391  */
392  if( eDel->Lface != eDel->Rface ) {
393  /* We are joining two loops into one -- remove the left face */
394  joiningLoops = TRUE;
395  KillFace( eDel->Lface, eDel->Rface );
396  }
397 
398  if( eDel->Onext == eDel ) {
399  KillVertex( eDel->Org, NULL );
400  } else {
401  /* Make sure that eDel->Org and eDel->Rface point to valid half-edges */
402  eDel->Rface->anEdge = eDel->Oprev;
403  eDel->Org->anEdge = eDel->Onext;
404 
405  Splice( eDel, eDel->Oprev );
406  if( ! joiningLoops ) {
407  GLUface *newFace= allocFace();
408  if (newFace == NULL) return 0;
409 
410  /* We are splitting one loop into two -- create a new loop for eDel. */
411  MakeFace( newFace, eDel, eDel->Lface );
412  }
413  }
414 
415  /* Claim: the mesh is now in a consistent state, except that eDel->Org
416  * may have been deleted. Now we disconnect eDel->Dst.
417  */
418  if( eDelSym->Onext == eDelSym ) {
419  KillVertex( eDelSym->Org, NULL );
420  KillFace( eDelSym->Lface, NULL );
421  } else {
422  /* Make sure that eDel->Dst and eDel->Lface point to valid half-edges */
423  eDel->Lface->anEdge = eDelSym->Oprev;
424  eDelSym->Org->anEdge = eDelSym->Onext;
425  Splice( eDelSym, eDelSym->Oprev );
426  }
427 
428  /* Any isolated vertices or faces have already been freed. */
429  KillEdge( eDel );
430 
431  return 1;
432 }
static void Splice(GLUhalfEdge *a, GLUhalfEdge *b)
Definition: mesh.c:117
#define FALSE
Definition: mesh.c:45
GLUvertex * Org
Definition: mesh.h:143
static void KillVertex(GLUvertex *vDel, GLUvertex *newOrg)
Definition: mesh.c:224
static void MakeFace(GLUface *newFace, GLUhalfEdge *eOrig, GLUface *fNext)
Definition: mesh.c:168
Definition: mesh.h:126
static GLUface * allocFace()
Definition: mesh.c:53
GLUhalfEdge * anEdge
Definition: mesh.h:129
smooth NULL
Definition: ftsmooth.c:416
GLUhalfEdge * Onext
Definition: mesh.h:141
static void KillFace(GLUface *fDel, GLUface *newLface)
Definition: mesh.c:248
GLUface * Lface
Definition: mesh.h:144
static void KillEdge(GLUhalfEdge *eDel)
Definition: mesh.c:204
GLUhalfEdge * Sym
Definition: mesh.h:140
#define TRUE
Definition: mesh.c:42
GLUhalfEdge * anEdge
Definition: mesh.h:117

Referenced by __gl_meshSetWindingNumber(), AddRightEdges(), ConnectLeftDegenerate(), FixUpperEdge(), RemoveDegenerateEdges(), RemoveDegenerateFaces(), and WalkDirtyRegions().

◆ __gl_meshDeleteMesh()

void __gl_meshDeleteMesh ( GLUmesh mesh)

Definition at line 711 of file mesh.c.

712 {
713  GLUface *f, *fNext;
714  GLUvertex *v, *vNext;
715  GLUhalfEdge *e, *eNext;
716 
717  for( f = mesh->fHead.next; f != &mesh->fHead; f = fNext ) {
718  fNext = f->next;
719  memFree( f );
720  }
721 
722  for( v = mesh->vHead.next; v != &mesh->vHead; v = vNext ) {
723  vNext = v->next;
724  memFree( v );
725  }
726 
727  for( e = mesh->eHead.next; e != &mesh->eHead; e = eNext ) {
728  /* One call frees both e and e->Sym (see EdgePair above) */
729  eNext = e->next;
730  memFree( e );
731  }
732 
733  memFree( mesh );
734 }
GLUface * next
Definition: mesh.h:127
GLUvertex vHead
Definition: mesh.h:164
Definition: mesh.h:126
#define e
Definition: ke_i.h:82
GLUface fHead
Definition: mesh.h:165
GLUhalfEdge eHead
Definition: mesh.h:166
GLfloat f
Definition: glext.h:7540
#define memFree
Definition: memalloc.h:41
GLUhalfEdge * next
Definition: mesh.h:139
const GLdouble * v
Definition: gl.h:2040
GLUvertex * next
Definition: mesh.h:115
struct define * next
Definition: compiler.c:65
#define f
Definition: ke_i.h:83

Referenced by gluTessEndPolygon(), and MakeDormant().

◆ __gl_meshMakeEdge()

GLUhalfEdge* __gl_meshMakeEdge ( GLUmesh mesh)

Definition at line 275 of file mesh.c.

276 {
277  GLUvertex *newVertex1= allocVertex();
278  GLUvertex *newVertex2= allocVertex();
279  GLUface *newFace= allocFace();
280  GLUhalfEdge *e;
281 
282  /* if any one is null then all get freed */
283  if (newVertex1 == NULL || newVertex2 == NULL || newFace == NULL) {
284  if (newVertex1 != NULL) memFree(newVertex1);
285  if (newVertex2 != NULL) memFree(newVertex2);
286  if (newFace != NULL) memFree(newFace);
287  return NULL;
288  }
289 
290  e = MakeEdge( &mesh->eHead );
291  if (e == NULL) {
292  memFree(newVertex1);
293  memFree(newVertex2);
294  memFree(newFace);
295  return NULL;
296  }
297 
298  MakeVertex( newVertex1, e, &mesh->vHead );
299  MakeVertex( newVertex2, e->Sym, &mesh->vHead );
300  MakeFace( newFace, e, &mesh->fHead );
301  return e;
302 }
static void MakeFace(GLUface *newFace, GLUhalfEdge *eOrig, GLUface *fNext)
Definition: mesh.c:168
GLUvertex vHead
Definition: mesh.h:164
Definition: mesh.h:126
static GLUhalfEdge * MakeEdge(GLUhalfEdge *eNext)
Definition: mesh.c:69
static GLUface * allocFace()
Definition: mesh.c:53
#define e
Definition: ke_i.h:82
GLUface fHead
Definition: mesh.h:165
smooth NULL
Definition: ftsmooth.c:416
GLUhalfEdge eHead
Definition: mesh.h:166
#define memFree
Definition: memalloc.h:41
static GLUvertex * allocVertex()
Definition: mesh.c:48
static void MakeVertex(GLUvertex *newVertex, GLUhalfEdge *eOrig, GLUvertex *vNext)
Definition: mesh.c:134

Referenced by AddSentinel(), and AddVertex().

◆ __gl_meshNewMesh()

GLUmesh* __gl_meshNewMesh ( void  )

Definition at line 603 of file mesh.c.

604 {
605  GLUvertex *v;
606  GLUface *f;
607  GLUhalfEdge *e;
608  GLUhalfEdge *eSym;
609  GLUmesh *mesh = (GLUmesh *)memAlloc( sizeof( GLUmesh ));
610  if (mesh == NULL) {
611  return NULL;
612  }
613 
614  v = &mesh->vHead;
615  f = &mesh->fHead;
616  e = &mesh->eHead;
617  eSym = &mesh->eHeadSym;
618 
619  v->next = v->prev = v;
620  v->anEdge = NULL;
621  v->data = NULL;
622 
623  f->next = f->prev = f;
624  f->anEdge = NULL;
625  f->data = NULL;
626  f->trail = NULL;
627  f->marked = FALSE;
628  f->inside = FALSE;
629 
630  e->next = e;
631  e->Sym = eSym;
632  e->Onext = NULL;
633  e->Lnext = NULL;
634  e->Org = NULL;
635  e->Lface = NULL;
636  e->winding = 0;
637  e->activeRegion = NULL;
638 
639  eSym->next = eSym;
640  eSym->Sym = e;
641  eSym->Onext = NULL;
642  eSym->Lnext = NULL;
643  eSym->Org = NULL;
644  eSym->Lface = NULL;
645  eSym->winding = 0;
646  eSym->activeRegion = NULL;
647 
648  return mesh;
649 }
ActiveRegion * activeRegion
Definition: mesh.h:147
Definition: mesh.h:163
GLUhalfEdge * Lnext
Definition: mesh.h:142
#define FALSE
Definition: mesh.c:45
GLUvertex * Org
Definition: mesh.h:143
GLUvertex vHead
Definition: mesh.h:164
Definition: mesh.h:126
GLUhalfEdge eHeadSym
Definition: mesh.h:167
#define e
Definition: ke_i.h:82
GLUface fHead
Definition: mesh.h:165
smooth NULL
Definition: ftsmooth.c:416
GLUhalfEdge eHead
Definition: mesh.h:166
GLUhalfEdge * Onext
Definition: mesh.h:141
GLUface * Lface
Definition: mesh.h:144
GLfloat f
Definition: glext.h:7540
int winding
Definition: mesh.h:148
GLUhalfEdge * Sym
Definition: mesh.h:140
GLUhalfEdge * next
Definition: mesh.h:139
const GLdouble * v
Definition: gl.h:2040
struct define * next
Definition: compiler.c:65
#define f
Definition: ke_i.h:83
#define memAlloc
Definition: memalloc.h:48

Referenced by EmptyCache().

◆ __gl_meshSplice()

int __gl_meshSplice ( GLUhalfEdge eOrg,
GLUhalfEdge eDst 
)

Definition at line 328 of file mesh.c.

329 {
330  int joiningLoops = FALSE;
331  int joiningVertices = FALSE;
332 
333  if( eOrg == eDst ) return 1;
334 
335  if( eDst->Org != eOrg->Org ) {
336  /* We are merging two disjoint vertices -- destroy eDst->Org */
337  joiningVertices = TRUE;
338  KillVertex( eDst->Org, eOrg->Org );
339  }
340  if( eDst->Lface != eOrg->Lface ) {
341  /* We are connecting two disjoint loops -- destroy eDst->Lface */
342  joiningLoops = TRUE;
343  KillFace( eDst->Lface, eOrg->Lface );
344  }
345 
346  /* Change the edge structure */
347  Splice( eDst, eOrg );
348 
349  if( ! joiningVertices ) {
350  GLUvertex *newVertex= allocVertex();
351  if (newVertex == NULL) return 0;
352 
353  /* We split one vertex into two -- the new vertex is eDst->Org.
354  * Make sure the old vertex points to a valid half-edge.
355  */
356  MakeVertex( newVertex, eDst, eOrg->Org );
357  eOrg->Org->anEdge = eOrg;
358  }
359  if( ! joiningLoops ) {
360  GLUface *newFace= allocFace();
361  if (newFace == NULL) return 0;
362 
363  /* We split one loop into two -- the new loop is eDst->Lface.
364  * Make sure the old face points to a valid half-edge.
365  */
366  MakeFace( newFace, eDst, eOrg->Lface );
367  eOrg->Lface->anEdge = eOrg;
368  }
369 
370  return 1;
371 }
static void Splice(GLUhalfEdge *a, GLUhalfEdge *b)
Definition: mesh.c:117
#define FALSE
Definition: mesh.c:45
GLUvertex * Org
Definition: mesh.h:143
static void KillVertex(GLUvertex *vDel, GLUvertex *newOrg)
Definition: mesh.c:224
static void MakeFace(GLUface *newFace, GLUhalfEdge *eOrig, GLUface *fNext)
Definition: mesh.c:168
Definition: mesh.h:126
static GLUface * allocFace()
Definition: mesh.c:53
GLUhalfEdge * anEdge
Definition: mesh.h:129
smooth NULL
Definition: ftsmooth.c:416
static void KillFace(GLUface *fDel, GLUface *newLface)
Definition: mesh.c:248
GLUface * Lface
Definition: mesh.h:144
#define TRUE
Definition: mesh.c:42
GLUhalfEdge * anEdge
Definition: mesh.h:117
static GLUvertex * allocVertex()
Definition: mesh.c:48
static void MakeVertex(GLUvertex *newVertex, GLUhalfEdge *eOrig, GLUvertex *vNext)
Definition: mesh.c:134

Referenced by AddRightEdges(), AddVertex(), CheckForIntersect(), CheckForLeftSplice(), CheckForRightSplice(), ConnectLeftDegenerate(), ConnectRightVertex(), FinishLeftRegions(), and SpliceMergeVertices().

◆ __gl_meshSplitEdge()

GLUhalfEdge* __gl_meshSplitEdge ( GLUhalfEdge eOrg)

Definition at line 475 of file mesh.c.

476 {
477  GLUhalfEdge *eNew;
478  GLUhalfEdge *tempHalfEdge= __gl_meshAddEdgeVertex( eOrg );
479  if (tempHalfEdge == NULL) return NULL;
480 
481  eNew = tempHalfEdge->Sym;
482 
483  /* Disconnect eOrg from eOrg->Dst and connect it to eNew->Org */
484  Splice( eOrg->Sym, eOrg->Sym->Oprev );
485  Splice( eOrg->Sym, eNew );
486 
487  /* Set the vertex and face information */
488  eOrg->Dst = eNew->Org;
489  eNew->Dst->anEdge = eNew->Sym; /* may have pointed to eOrg->Sym */
490  eNew->Rface = eOrg->Rface;
491  eNew->winding = eOrg->winding; /* copy old winding information */
492  eNew->Sym->winding = eOrg->Sym->winding;
493 
494  return eNew;
495 }
static void Splice(GLUhalfEdge *a, GLUhalfEdge *b)
Definition: mesh.c:117
GLUvertex * Org
Definition: mesh.h:143
smooth NULL
Definition: ftsmooth.c:416
GLUhalfEdge * __gl_meshAddEdgeVertex(GLUhalfEdge *eOrg)
Definition: mesh.c:446
int winding
Definition: mesh.h:148
GLUhalfEdge * Sym
Definition: mesh.h:140

Referenced by AddVertex(), CheckForIntersect(), CheckForLeftSplice(), CheckForRightSplice(), and ConnectLeftDegenerate().

◆ __gl_meshUnion()

GLUmesh* __gl_meshUnion ( GLUmesh mesh1,
GLUmesh mesh2 
)

Definition at line 655 of file mesh.c.

656 {
657  GLUface *f1 = &mesh1->fHead;
658  GLUvertex *v1 = &mesh1->vHead;
659  GLUhalfEdge *e1 = &mesh1->eHead;
660  GLUface *f2 = &mesh2->fHead;
661  GLUvertex *v2 = &mesh2->vHead;
662  GLUhalfEdge *e2 = &mesh2->eHead;
663 
664  /* Add the faces, vertices, and edges of mesh2 to those of mesh1 */
665  if( f2->next != f2 ) {
666  f1->prev->next = f2->next;
667  f2->next->prev = f1->prev;
668  f2->prev->next = f1;
669  f1->prev = f2->prev;
670  }
671 
672  if( v2->next != v2 ) {
673  v1->prev->next = v2->next;
674  v2->next->prev = v1->prev;
675  v2->prev->next = v1;
676  v1->prev = v2->prev;
677  }
678 
679  if( e2->next != e2 ) {
680  e1->Sym->next->Sym->next = e2->next;
681  e2->next->Sym->next = e1->Sym->next;
682  e2->Sym->next->Sym->next = e1;
683  e1->Sym->next = e2->Sym->next;
684  }
685 
686  memFree( mesh2 );
687  return mesh1;
688 }
GLUvertex vHead
Definition: mesh.h:164
Definition: mesh.h:126
GLUface fHead
Definition: mesh.h:165
GLUhalfEdge eHead
Definition: mesh.h:166
GLUhalfEdge * Sym
Definition: mesh.h:140
#define memFree
Definition: memalloc.h:41
GLfloat GLfloat GLfloat v2
Definition: glext.h:6063
#define f1(x, y, z)
Definition: sha1.c:30
GLUhalfEdge * next
Definition: mesh.h:139
struct define * next
Definition: compiler.c:65
int f2(S1 &, S2 &)
GLfloat GLfloat v1
Definition: glext.h:6062

◆ __gl_meshZapFace()

void __gl_meshZapFace ( GLUface fZap)

Definition at line 555 of file mesh.c.

556 {
557  GLUhalfEdge *eStart = fZap->anEdge;
558  GLUhalfEdge *e, *eNext, *eSym;
559  GLUface *fPrev, *fNext;
560 
561  /* walk around face, deleting edges whose right face is also NULL */
562  eNext = eStart->Lnext;
563  do {
564  e = eNext;
565  eNext = e->Lnext;
566 
567  e->Lface = NULL;
568  if( e->Rface == NULL ) {
569  /* delete the edge -- see __gl_MeshDelete above */
570 
571  if( e->Onext == e ) {
572  KillVertex( e->Org, NULL );
573  } else {
574  /* Make sure that e->Org points to a valid half-edge */
575  e->Org->anEdge = e->Onext;
576  Splice( e, e->Oprev );
577  }
578  eSym = e->Sym;
579  if( eSym->Onext == eSym ) {
580  KillVertex( eSym->Org, NULL );
581  } else {
582  /* Make sure that eSym->Org points to a valid half-edge */
583  eSym->Org->anEdge = eSym->Onext;
584  Splice( eSym, eSym->Oprev );
585  }
586  KillEdge( e );
587  }
588  } while( e != eStart );
589 
590  /* delete from circular doubly-linked list */
591  fPrev = fZap->prev;
592  fNext = fZap->next;
593  fNext->prev = fPrev;
594  fPrev->next = fNext;
595 
596  memFree( fZap );
597 }
static void Splice(GLUhalfEdge *a, GLUhalfEdge *b)
Definition: mesh.c:117
GLUface * prev
Definition: mesh.h:128
GLUhalfEdge * Lnext
Definition: mesh.h:142
GLUvertex * Org
Definition: mesh.h:143
static void KillVertex(GLUvertex *vDel, GLUvertex *newOrg)
Definition: mesh.c:224
GLUface * next
Definition: mesh.h:127
Definition: mesh.h:126
GLUhalfEdge * anEdge
Definition: mesh.h:129
#define e
Definition: ke_i.h:82
smooth NULL
Definition: ftsmooth.c:416
GLUhalfEdge * Onext
Definition: mesh.h:141
static void KillEdge(GLUhalfEdge *eDel)
Definition: mesh.c:204
#define memFree
Definition: memalloc.h:41
GLUhalfEdge * anEdge
Definition: mesh.h:117

Referenced by __gl_meshDiscardExterior().