g4tools  5.4.0
Classes | Macros | Typedefs | Functions
mesh File Reference
#include "_glu"
#include <cstddef>
#include <cassert>
#include "memalloc"
Include dependency graph for mesh:
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
 
struct  EdgePair
 

Macros

#define tools_glutess_mesh
 
#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

inline GLUvertexstatic_allocVertex ()
 inlined C code : /////////////////////////////////// More...
 
inline GLUfacestatic_allocFace ()
 
inline GLUhalfEdgestatic_MakeEdge (GLUhalfEdge *eNext)
 
inline void static_Splice (GLUhalfEdge *a, GLUhalfEdge *b)
 
inline void static_MakeVertex (GLUvertex *newVertex, GLUhalfEdge *eOrig, GLUvertex *vNext)
 
inline void static_MakeFace (GLUface *newFace, GLUhalfEdge *eOrig, GLUface *fNext)
 
inline void static_KillEdge (GLUhalfEdge *eDel)
 
inline void static_KillVertex (GLUvertex *vDel, GLUvertex *newOrg)
 
inline void static_KillFace (GLUface *fDel, GLUface *newLface)
 
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)
 
void __gl_meshZapFace (GLUface *fZap)
 
GLUmesh__gl_meshNewMesh (void)
 
GLUmesh__gl_meshUnion (GLUmesh *mesh1, GLUmesh *mesh2)
 
void __gl_meshDeleteMesh (GLUmesh *mesh)
 
void __gl_meshCheckMesh (GLUmesh *mesh)
 

Macro Definition Documentation

◆ Dnext

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

Definition at line 127 of file mesh.

◆ Dprev

#define Dprev   Lnext->Sym

Definition at line 125 of file mesh.

◆ Dst

#define Dst   Sym->Org

Definition at line 121 of file mesh.

◆ Lprev

#define Lprev   Onext->Sym

Definition at line 124 of file mesh.

◆ Oprev

#define Oprev   Sym->Lnext

Definition at line 123 of file mesh.

◆ Rface

#define Rface   Sym->Lface

Definition at line 120 of file mesh.

◆ Rnext

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

Definition at line 128 of file mesh.

◆ Rprev

#define Rprev   Sym->Onext

Definition at line 126 of file mesh.

◆ tools_glutess_mesh

#define tools_glutess_mesh

Definition at line 4 of file mesh.

Typedef Documentation

◆ ActiveRegion

typedef struct ActiveRegion ActiveRegion

Definition at line 1 of file mesh.

◆ GLUface

typedef struct GLUface GLUface

Definition at line 1 of file mesh.

◆ GLUhalfEdge

typedef struct GLUhalfEdge GLUhalfEdge

Definition at line 1 of file mesh.

◆ GLUmesh

typedef struct GLUmesh GLUmesh

Definition at line 1 of file mesh.

◆ GLUvertex

typedef struct GLUvertex GLUvertex

Definition at line 1 of file mesh.

Function Documentation

◆ __gl_meshAddEdgeVertex()

GLUhalfEdge* __gl_meshAddEdgeVertex ( GLUhalfEdge eOrg)
inline

Definition at line 625 of file mesh.

626 {
627  GLUhalfEdge *eNewSym;
628  GLUhalfEdge *eNew = static_MakeEdge( eOrg );
629  if (eNew == NULL) return NULL;
630 
631  eNewSym = eNew->Sym;
632 
633  /* Connect the new edge appropriately */
634  static_Splice( eNew, eOrg->Lnext );
635 
636  /* Set the vertex and face information */
637  eNew->Org = eOrg->Dst;
638  {
639  GLUvertex *newVertex= static_allocVertex();
640  if (newVertex == NULL) return NULL;
641 
642  static_MakeVertex( newVertex, eNewSym, eNew->Org );
643  }
644  eNew->Lface = eNewSym->Lface = eOrg->Lface;
645 
646  return eNew;
647 }

◆ __gl_meshCheckMesh()

void __gl_meshCheckMesh ( GLUmesh mesh)
inline

Definition at line 917 of file mesh.

918 {
919  GLUface *fHead = &mesh->fHead;
920  GLUvertex *vHead = &mesh->vHead;
921  GLUhalfEdge *eHead = &mesh->eHead;
922  GLUface *f, *fPrev;
923  GLUvertex *v, *vPrev;
924  GLUhalfEdge *e, *ePrev;
925 
926  fPrev = fHead;
927  for( fPrev = fHead ; (f = fPrev->next) != fHead; fPrev = f) {
928  assert( f->prev == fPrev );
929  e = f->anEdge;
930  do {
931  assert( e->Sym != e );
932  assert( e->Sym->Sym == e );
933  assert( e->Lnext->Onext->Sym == e );
934  assert( e->Onext->Sym->Lnext == e );
935  assert( e->Lface == f );
936  e = e->Lnext;
937  } while( e != f->anEdge );
938  }
939  assert( f->prev == fPrev && f->anEdge == NULL && f->data == NULL );
940 
941  vPrev = vHead;
942  for( vPrev = vHead ; (v = vPrev->next) != vHead; vPrev = v) {
943  assert( v->prev == vPrev );
944  e = v->anEdge;
945  do {
946  assert( e->Sym != e );
947  assert( e->Sym->Sym == e );
948  assert( e->Lnext->Onext->Sym == e );
949  assert( e->Onext->Sym->Lnext == e );
950  assert( e->Org == v );
951  e = e->Onext;
952  } while( e != v->anEdge );
953  }
954  assert( v->prev == vPrev && v->anEdge == NULL && v->data == NULL );
955 
956  ePrev = eHead;
957  for( ePrev = eHead ; (e = ePrev->next) != eHead; ePrev = e) {
958  assert( e->Sym->next == ePrev->Sym );
959  assert( e->Sym != e );
960  assert( e->Sym->Sym == e );
961  assert( e->Org != NULL );
962  assert( e->Dst != NULL );
963  assert( e->Lnext->Onext->Sym == e );
964  assert( e->Onext->Sym->Lnext == e );
965  }
966  assert( e->Sym->next == ePrev->Sym
967  && e->Sym == &mesh->eHeadSym
968  && e->Sym->Sym == e
969  && e->Org == NULL && e->Dst == NULL
970  && e->Lface == NULL && e->Rface == NULL );
971 }

◆ __gl_meshConnect()

GLUhalfEdge* __gl_meshConnect ( GLUhalfEdge eOrg,
GLUhalfEdge eDst 
)
inline

Definition at line 687 of file mesh.

688 {
689  GLUhalfEdge *eNewSym;
690  int joiningLoops = TOOLS_GLU_FALSE;
691  GLUhalfEdge *eNew = static_MakeEdge( eOrg );
692  if (eNew == NULL) return NULL;
693 
694  eNewSym = eNew->Sym;
695 
696  if( eDst->Lface != eOrg->Lface ) {
697  /* We are connecting two disjoint loops -- destroy eDst->Lface */
698  joiningLoops = TOOLS_GLU_TRUE;
699  static_KillFace( eDst->Lface, eOrg->Lface );
700  }
701 
702  /* Connect the new edge appropriately */
703  static_Splice( eNew, eOrg->Lnext );
704  static_Splice( eNewSym, eDst );
705 
706  /* Set the vertex and face information */
707  eNew->Org = eOrg->Dst;
708  eNewSym->Org = eDst->Org;
709  eNew->Lface = eNewSym->Lface = eOrg->Lface;
710 
711  /* Make sure the old face points to a valid half-edge */
712  eOrg->Lface->anEdge = eNewSym;
713 
714  if( ! joiningLoops ) {
715  GLUface *newFace= static_allocFace();
716  if (newFace == NULL) return NULL;
717 
718  /* We split one loop into two -- the new loop is eNew->Lface */
719  static_MakeFace( newFace, eNew, eOrg->Lface );
720  }
721  return eNew;
722 }

◆ __gl_meshDelete()

int __gl_meshDelete ( GLUhalfEdge eDel)
inline

Definition at line 560 of file mesh.

561 {
562  GLUhalfEdge *eDelSym = eDel->Sym;
563  int joiningLoops = TOOLS_GLU_FALSE;
564 
565  /* First step: disconnect the origin vertex eDel->Org. We make all
566  * changes to get a consistent mesh in this "intermediate" state.
567  */
568  if( eDel->Lface != eDel->Rface ) {
569  /* We are joining two loops into one -- remove the left face */
570  joiningLoops = TOOLS_GLU_TRUE;
571  static_KillFace( eDel->Lface, eDel->Rface );
572  /* G.Barrand : note : Coverity says that there is a problem using eDel->Lface->anEdge in the below,
573  but it appears that at the out of the upper static_KillFace() call (then here), eDel->Lface before
574  (the pointer freeed) is not the same than after (then here). */
575  }
576 
577  if( eDel->Onext == eDel ) {
578  static_KillVertex( eDel->Org, NULL );
579  } else {
580  /* Make sure that eDel->Org and eDel->Rface point to valid half-edges */
581  eDel->Rface->anEdge = eDel->Oprev;
582  eDel->Org->anEdge = eDel->Onext;
583 
584  static_Splice( eDel, eDel->Oprev );
585  if( ! joiningLoops ) {
586  GLUface *newFace= static_allocFace();
587  if (newFace == NULL) return 0;
588 
589  /* We are splitting one loop into two -- create a new loop for eDel. */
590  static_MakeFace( newFace, eDel, eDel->Lface );
591  }
592  }
593 
594  /* Claim: the mesh is now in a consistent state, except that eDel->Org
595  * may have been deleted. Now we disconnect eDel->Dst.
596  */
597  if( eDelSym->Onext == eDelSym ) {
598  static_KillVertex( eDelSym->Org, NULL );
599  static_KillFace( eDelSym->Lface, NULL );
600  } else {
601  /* Make sure that eDel->Dst and eDel->Lface point to valid half-edges */
602  eDel->Lface->anEdge = eDelSym->Oprev;
603  eDelSym->Org->anEdge = eDelSym->Onext;
604  static_Splice( eDelSym, eDelSym->Oprev );
605  }
606 
607  /* Any isolated vertices or faces have already been freed. */
608  static_KillEdge( eDel );
609 
610  return 1;
611 }

◆ __gl_meshDeleteMesh()

void __gl_meshDeleteMesh ( GLUmesh mesh)
inline

Definition at line 890 of file mesh.

891 {
892  GLUface *f, *fNext;
893  GLUvertex *v, *vNext;
894  GLUhalfEdge *e, *eNext;
895 
896  for( f = mesh->fHead.next; f != &mesh->fHead; f = fNext ) {
897  fNext = f->next;
898  memFree( f );
899  }
900 
901  for( v = mesh->vHead.next; v != &mesh->vHead; v = vNext ) {
902  vNext = v->next;
903  memFree( v );
904  }
905 
906  for( e = mesh->eHead.next; e != &mesh->eHead; e = eNext ) {
907  /* One call frees both e and e->Sym (see EdgePair above) */
908  eNext = e->next;
909  memFree( e );
910  }
911 
912  memFree( mesh );
913 }

◆ __gl_meshMakeEdge()

GLUhalfEdge* __gl_meshMakeEdge ( GLUmesh mesh)
inline

Definition at line 451 of file mesh.

452 {
453  GLUvertex *newVertex1= static_allocVertex();
454  GLUvertex *newVertex2= static_allocVertex();
455  GLUface *newFace= static_allocFace();
456  GLUhalfEdge *e;
457 
458  /* if any one is null then all get freed */
459  if (newVertex1 == NULL || newVertex2 == NULL || newFace == NULL) {
460  if (newVertex1 != NULL) memFree(newVertex1);
461  if (newVertex2 != NULL) memFree(newVertex2);
462  if (newFace != NULL) memFree(newFace);
463  return NULL;
464  }
465 
466  e = static_MakeEdge( &mesh->eHead );
467  if (e == NULL) {
468  memFree(newVertex1);
469  memFree(newVertex2);
470  memFree(newFace);
471  return NULL;
472  }
473 
474  static_MakeVertex( newVertex1, e, &mesh->vHead );
475  static_MakeVertex( newVertex2, e->Sym, &mesh->vHead );
476  static_MakeFace( newFace, e, &mesh->fHead );
477  return e;
478 }

◆ __gl_meshNewMesh()

GLUmesh* __gl_meshNewMesh ( void  )
inline

Definition at line 782 of file mesh.

783 {
784  GLUvertex *v;
785  GLUface *f;
786  GLUhalfEdge *e;
787  GLUhalfEdge *eSym;
788  GLUmesh *mesh = (GLUmesh *)memAlloc( sizeof( GLUmesh ));
789  if (mesh == NULL) {
790  return NULL;
791  }
792 
793  v = &mesh->vHead;
794  f = &mesh->fHead;
795  e = &mesh->eHead;
796  eSym = &mesh->eHeadSym;
797 
798  v->next = v->prev = v;
799  v->anEdge = NULL;
800  v->data = NULL;
801 
802  f->next = f->prev = f;
803  f->anEdge = NULL;
804  f->data = NULL;
805  f->trail = NULL;
806  f->marked = TOOLS_GLU_FALSE;
807  f->inside = TOOLS_GLU_FALSE;
808 
809  e->next = e;
810  e->Sym = eSym;
811  e->Onext = NULL;
812  e->Lnext = NULL;
813  e->Org = NULL;
814  e->Lface = NULL;
815  e->winding = 0;
816  e->activeRegion = NULL;
817 
818  eSym->next = eSym;
819  eSym->Sym = e;
820  eSym->Onext = NULL;
821  eSym->Lnext = NULL;
822  eSym->Org = NULL;
823  eSym->Lface = NULL;
824  eSym->winding = 0;
825  eSym->activeRegion = NULL;
826 
827  return mesh;
828 }

◆ __gl_meshSplice()

int __gl_meshSplice ( GLUhalfEdge eOrg,
GLUhalfEdge eDst 
)
inline

Definition at line 504 of file mesh.

505 {
506  int joiningLoops = TOOLS_GLU_FALSE;
507  int joiningVertices = TOOLS_GLU_FALSE;
508 
509  if( eOrg == eDst ) return 1;
510 
511  if( eDst->Org != eOrg->Org ) {
512  /* We are merging two disjoint vertices -- destroy eDst->Org */
513  joiningVertices = TOOLS_GLU_TRUE;
514  static_KillVertex( eDst->Org, eOrg->Org );
515  }
516  if( eDst->Lface != eOrg->Lface ) {
517  /* We are connecting two disjoint loops -- destroy eDst->Lface */
518  joiningLoops = TOOLS_GLU_TRUE;
519  static_KillFace( eDst->Lface, eOrg->Lface );
520  }
521 
522  /* Change the edge structure */
523  static_Splice( eDst, eOrg );
524 
525  if( ! joiningVertices ) {
526  GLUvertex *newVertex= static_allocVertex();
527  if (newVertex == NULL) return 0;
528 
529  /* We split one vertex into two -- the new vertex is eDst->Org.
530  * Make sure the old vertex points to a valid half-edge.
531  */
532  static_MakeVertex( newVertex, eDst, eOrg->Org );
533  eOrg->Org->anEdge = eOrg;
534  }
535  if( ! joiningLoops ) {
536  GLUface *newFace= static_allocFace();
537  if (newFace == NULL) return 0;
538 
539  /* We split one loop into two -- the new loop is eDst->Lface.
540  * Make sure the old face points to a valid half-edge.
541  */
542  static_MakeFace( newFace, eDst, eOrg->Lface );
543  eOrg->Lface->anEdge = eOrg;
544  }
545 
546  return 1;
547 }

◆ __gl_meshSplitEdge()

GLUhalfEdge* __gl_meshSplitEdge ( GLUhalfEdge eOrg)
inline

Definition at line 654 of file mesh.

655 {
656  GLUhalfEdge *eNew;
657  GLUhalfEdge *tempHalfEdge= __gl_meshAddEdgeVertex( eOrg );
658  if (tempHalfEdge == NULL) return NULL;
659 
660  eNew = tempHalfEdge->Sym;
661 
662  /* Disconnect eOrg from eOrg->Dst and connect it to eNew->Org */
663  static_Splice( eOrg->Sym, eOrg->Sym->Oprev );
664  static_Splice( eOrg->Sym, eNew );
665 
666  /* Set the vertex and face information */
667  eOrg->Dst = eNew->Org;
668  eNew->Dst->anEdge = eNew->Sym; /* may have pointed to eOrg->Sym */
669  eNew->Rface = eOrg->Rface;
670  eNew->winding = eOrg->winding; /* copy old winding information */
671  eNew->Sym->winding = eOrg->Sym->winding;
672 
673  return eNew;
674 }

◆ __gl_meshUnion()

GLUmesh* __gl_meshUnion ( GLUmesh mesh1,
GLUmesh mesh2 
)
inline

Definition at line 834 of file mesh.

835 {
836  GLUface *f1 = &mesh1->fHead;
837  GLUvertex *v1 = &mesh1->vHead;
838  GLUhalfEdge *e1 = &mesh1->eHead;
839  GLUface *f2 = &mesh2->fHead;
840  GLUvertex *v2 = &mesh2->vHead;
841  GLUhalfEdge *e2 = &mesh2->eHead;
842 
843  /* Add the faces, vertices, and edges of mesh2 to those of mesh1 */
844  if( f2->next != f2 ) {
845  f1->prev->next = f2->next;
846  f2->next->prev = f1->prev;
847  f2->prev->next = f1;
848  f1->prev = f2->prev;
849  }
850 
851  if( v2->next != v2 ) {
852  v1->prev->next = v2->next;
853  v2->next->prev = v1->prev;
854  v2->prev->next = v1;
855  v1->prev = v2->prev;
856  }
857 
858  if( e2->next != e2 ) {
859  e1->Sym->next->Sym->next = e2->next;
860  e2->next->Sym->next = e1->Sym->next;
861  e2->Sym->next->Sym->next = e1;
862  e1->Sym->next = e2->Sym->next;
863  }
864 
865  memFree( mesh2 );
866  return mesh1;
867 }

◆ __gl_meshZapFace()

void __gl_meshZapFace ( GLUface fZap)
inline

Definition at line 734 of file mesh.

735 {
736  GLUhalfEdge *eStart = fZap->anEdge;
737  GLUhalfEdge *e, *eNext, *eSym;
738  GLUface *fPrev, *fNext;
739 
740  /* walk around face, deleting edges whose right face is also NULL */
741  eNext = eStart->Lnext;
742  do {
743  e = eNext;
744  eNext = e->Lnext;
745 
746  e->Lface = NULL;
747  if( e->Rface == NULL ) {
748  /* delete the edge -- see __gl_MeshDelete above */
749 
750  if( e->Onext == e ) {
751  static_KillVertex( e->Org, NULL );
752  } else {
753  /* Make sure that e->Org points to a valid half-edge */
754  e->Org->anEdge = e->Onext;
755  static_Splice( e, e->Oprev );
756  }
757  eSym = e->Sym;
758  if( eSym->Onext == eSym ) {
759  static_KillVertex( eSym->Org, NULL );
760  } else {
761  /* Make sure that eSym->Org points to a valid half-edge */
762  eSym->Org->anEdge = eSym->Onext;
763  static_Splice( eSym, eSym->Oprev );
764  }
765  static_KillEdge( e );
766  }
767  } while( e != eStart );
768 
769  /* delete from circular doubly-linked list */
770  fPrev = fZap->prev;
771  fNext = fZap->next;
772  fNext->prev = fPrev;
773  fPrev->next = fNext;
774 
775  memFree( fZap );
776 }

◆ static_allocFace()

inline GLUface* static_allocFace ( )

Definition at line 229 of file mesh.

230 {
231  return (GLUface *)memAlloc( sizeof( GLUface ));
232 }

◆ static_allocVertex()

inline GLUvertex* static_allocVertex ( )

inlined C code : ///////////////////////////////////

Definition at line 224 of file mesh.

225 {
226  return (GLUvertex *)memAlloc( sizeof( GLUvertex ));
227 }

◆ static_KillEdge()

inline void static_KillEdge ( GLUhalfEdge eDel)

Definition at line 380 of file mesh.

381 {
382  GLUhalfEdge *ePrev, *eNext;
383 
384  /* Half-edges are allocated in pairs, see EdgePair above */
385  if( eDel->Sym < eDel ) { eDel = eDel->Sym; }
386 
387  /* delete from circular doubly-linked list */
388  eNext = eDel->next;
389  ePrev = eDel->Sym->next;
390  eNext->Sym->next = ePrev;
391  ePrev->Sym->next = eNext;
392 
393  memFree( eDel );
394 }

◆ static_KillFace()

inline void static_KillFace ( GLUface fDel,
GLUface newLface 
)

Definition at line 424 of file mesh.

425 {
426  GLUhalfEdge *e, *eStart = fDel->anEdge;
427  GLUface *fPrev, *fNext;
428 
429  /* change the left face of all affected edges */
430  e = eStart;
431  do {
432  e->Lface = newLface;
433  e = e->Lnext;
434  } while( e != eStart );
435 
436  /* delete from circular doubly-linked list */
437  fPrev = fDel->prev;
438  fNext = fDel->next;
439  fNext->prev = fPrev;
440  fPrev->next = fNext;
441 
442  memFree( fDel );
443 }

◆ static_KillVertex()

inline void static_KillVertex ( GLUvertex vDel,
GLUvertex newOrg 
)

Definition at line 400 of file mesh.

401 {
402  GLUhalfEdge *e, *eStart = vDel->anEdge;
403  GLUvertex *vPrev, *vNext;
404 
405  /* change the origin of all affected edges */
406  e = eStart;
407  do {
408  e->Org = newOrg;
409  e = e->Onext;
410  } while( e != eStart );
411 
412  /* delete from circular doubly-linked list */
413  vPrev = vDel->prev;
414  vNext = vDel->next;
415  vNext->prev = vPrev;
416  vPrev->next = vNext;
417 
418  memFree( vDel );
419 }

◆ static_MakeEdge()

inline GLUhalfEdge* static_MakeEdge ( GLUhalfEdge eNext)

Definition at line 245 of file mesh.

246 {
247  GLUhalfEdge *e;
248  GLUhalfEdge *eSym;
249  GLUhalfEdge *ePrev;
250  EdgePair *pair = (EdgePair *)memAlloc( sizeof( EdgePair ));
251  if (pair == NULL) return NULL;
252 
253  e = &pair->e;
254  eSym = &pair->eSym;
255 
256  /* Make sure eNext points to the first edge of the edge pair */
257  if( eNext->Sym < eNext ) { eNext = eNext->Sym; }
258 
259  /* Insert in circular doubly-linked list before eNext.
260  * Note that the prev pointer is stored in Sym->next.
261  */
262  ePrev = eNext->Sym->next;
263  eSym->next = ePrev;
264  ePrev->Sym->next = e;
265  e->next = eNext;
266  eNext->Sym->next = eSym;
267 
268  e->Sym = eSym;
269  e->Onext = e;
270  e->Lnext = eSym;
271  e->Org = NULL;
272  e->Lface = NULL;
273  e->winding = 0;
274  e->activeRegion = NULL;
275 
276  eSym->Sym = e;
277  eSym->Onext = eSym;
278  eSym->Lnext = e;
279  eSym->Org = NULL;
280  eSym->Lface = NULL;
281  eSym->winding = 0;
282  eSym->activeRegion = NULL;
283 
284  return e;
285 }

◆ static_MakeFace()

inline void static_MakeFace ( GLUface newFace,
GLUhalfEdge eOrig,
GLUface fNext 
)

Definition at line 344 of file mesh.

345 {
346  GLUhalfEdge *e;
347  GLUface *fPrev;
348  GLUface *fNew = newFace;
349 
350  assert(fNew != NULL);
351 
352  /* insert in circular doubly-linked list before fNext */
353  fPrev = fNext->prev;
354  fNew->prev = fPrev;
355  fPrev->next = fNew;
356  fNew->next = fNext;
357  fNext->prev = fNew;
358 
359  fNew->anEdge = eOrig;
360  fNew->data = NULL;
361  fNew->trail = NULL;
362  fNew->marked = TOOLS_GLU_FALSE;
363 
364  /* The new face is marked "inside" if the old one was. This is a
365  * convenience for the common case where a face has been split in two.
366  */
367  fNew->inside = fNext->inside;
368 
369  /* fix other edges on this face loop */
370  e = eOrig;
371  do {
372  e->Lface = fNew;
373  e = e->Lnext;
374  } while( e != eOrig );
375 }

◆ static_MakeVertex()

inline void static_MakeVertex ( GLUvertex newVertex,
GLUhalfEdge eOrig,
GLUvertex vNext 
)

Definition at line 310 of file mesh.

312 {
313  GLUhalfEdge *e;
314  GLUvertex *vPrev;
315  GLUvertex *vNew = newVertex;
316 
317  assert(vNew != NULL);
318 
319  /* insert in circular doubly-linked list before vNext */
320  vPrev = vNext->prev;
321  vNew->prev = vPrev;
322  vPrev->next = vNew;
323  vNew->next = vNext;
324  vNext->prev = vNew;
325 
326  vNew->anEdge = eOrig;
327  vNew->data = NULL;
328  /* leave coords, s, t undefined */
329 
330  /* fix other edges on this vertex loop */
331  e = eOrig;
332  do {
333  e->Org = vNew;
334  e = e->Onext;
335  } while( e != eOrig );
336 }

◆ static_Splice()

inline void static_Splice ( GLUhalfEdge a,
GLUhalfEdge b 
)

Definition at line 293 of file mesh.

294 {
295  GLUhalfEdge *aOnext = a->Onext;
296  GLUhalfEdge *bOnext = b->Onext;
297 
298  aOnext->Sym->Lnext = b;
299  bOnext->Sym->Lnext = a;
300  a->Onext = bOnext;
301  b->Onext = aOnext;
302 }
GLUmesh::fHead
GLUface fHead
Definition: mesh:133
memFree
#define memFree
Definition: memalloc:42
static_KillVertex
inline void static_KillVertex(GLUvertex *vDel, GLUvertex *newOrg)
Definition: mesh:400
GLUvertex::prev
GLUvertex * prev
Definition: mesh:84
static_allocVertex
inline GLUvertex * static_allocVertex()
inlined C code : ///////////////////////////////////
Definition: mesh:224
GLUmesh::eHead
GLUhalfEdge eHead
Definition: mesh:134
GLUvertex::next
GLUvertex * next
Definition: mesh:83
EdgePair::eSym
GLUhalfEdge eSym
Definition: mesh:239
GLUmesh
Definition: mesh:131
GLUface::prev
GLUface * prev
Definition: mesh:96
GLUmesh::vHead
GLUvertex vHead
Definition: mesh:132
GLUhalfEdge::Lnext
GLUhalfEdge * Lnext
Definition: mesh:110
static_Splice
inline void static_Splice(GLUhalfEdge *a, GLUhalfEdge *b)
Definition: mesh:293
GLUface::marked
GLUboolean marked
Definition: mesh:102
memAlloc
#define memAlloc
Definition: memalloc:40
GLUhalfEdge
Definition: mesh:106
static_MakeEdge
inline GLUhalfEdge * static_MakeEdge(GLUhalfEdge *eNext)
Definition: mesh:245
GLUvertex::data
void * data
Definition: mesh:86
GLUhalfEdge::Sym
GLUhalfEdge * Sym
Definition: mesh:108
static_KillEdge
inline void static_KillEdge(GLUhalfEdge *eDel)
Definition: mesh:380
GLUhalfEdge::winding
int winding
Definition: mesh:116
TOOLS_GLU_TRUE
#define TOOLS_GLU_TRUE
Definition: _glu:82
GLUhalfEdge::activeRegion
ActiveRegion * activeRegion
Definition: mesh:115
GLUhalfEdge::next
GLUhalfEdge * next
Definition: mesh:107
GLUmesh::eHeadSym
GLUhalfEdge eHeadSym
Definition: mesh:135
GLUhalfEdge::Onext
GLUhalfEdge * Onext
Definition: mesh:109
TOOLS_GLU_FALSE
#define TOOLS_GLU_FALSE
Definition: _glu:81
GLUvertex::anEdge
GLUhalfEdge * anEdge
Definition: mesh:85
GLUface::trail
GLUface * trail
Definition: mesh:101
GLUface::data
void * data
Definition: mesh:98
GLUvertex
Definition: mesh:82
GLUface::inside
GLUboolean inside
Definition: mesh:103
EdgePair::e
GLUhalfEdge e
Definition: mesh:239
static_MakeVertex
inline void static_MakeVertex(GLUvertex *newVertex, GLUhalfEdge *eOrig, GLUvertex *vNext)
Definition: mesh:310
GLUhalfEdge::Lface
GLUface * Lface
Definition: mesh:112
GLUface
Definition: mesh:94
GLUhalfEdge::Org
GLUvertex * Org
Definition: mesh:111
GLUface::next
GLUface * next
Definition: mesh:95
__gl_meshAddEdgeVertex
GLUhalfEdge * __gl_meshAddEdgeVertex(GLUhalfEdge *eOrg)
Definition: mesh:625
static_KillFace
inline void static_KillFace(GLUface *fDel, GLUface *newLface)
Definition: mesh:424
EdgePair
Definition: mesh:239
static_allocFace
inline GLUface * static_allocFace()
Definition: mesh:229
static_MakeFace
inline void static_MakeFace(GLUface *newFace, GLUhalfEdge *eOrig, GLUface *fNext)
Definition: mesh:344
GLUface::anEdge
GLUhalfEdge * anEdge
Definition: mesh:97