Chaste  Release::2018.1
triangle.cpp File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <sys/time.h>
+ Include dependency graph for triangle.cpp:

Go to the source code of this file.

Classes

struct  otri
 
struct  osub
 
struct  badsubseg
 
struct  badtriang
 
struct  flipstacker
 
struct  event
 
struct  splaynode
 
struct  memorypool
 
struct  mesh
 
struct  behavior
 

Macros

#define REAL   double
 
#define INEXACT   /* Nothing */
 
#define FILENAMESIZE   2048
 
#define INPUTLINESIZE   1024
 
#define TRIPERBLOCK   4092 /* Number of triangles allocated at once. */
 
#define SUBSEGPERBLOCK   508 /* Number of subsegments allocated at once. */
 
#define VERTEXPERBLOCK   4092 /* Number of vertices allocated at once. */
 
#define VIRUSPERBLOCK   1020 /* Number of virus triangles allocated at once. */
 
#define BADSUBSEGPERBLOCK   252
 
#define BADTRIPERBLOCK   4092
 
#define FLIPSTACKERPERBLOCK   252
 
#define SPLAYNODEPERBLOCK   508
 
#define INPUTVERTEX   0
 
#define SEGMENTVERTEX   1
 
#define FREEVERTEX   2
 
#define DEADVERTEX   -32768
 
#define UNDEADVERTEX   -32767
 
#define VOID   int
 
#define SAMPLEFACTOR   11
 
#define SAMPLERATE   10
 
#define PI   3.141592653589793238462643383279502884197169399375105820974944592308
 
#define SQUAREROOTTWO   1.4142135623730950488016887242096980785696718753769480732
 
#define ONETHIRD   0.333333333333333333333333333333333333333333333333333333333333
 
#define decode(ptr, otri)
 
#define encode(otri)   (triangle) ((unsigned long) (otri).tri | (unsigned long) (otri).orient)
 
#define sym(otri1, otri2)
 
#define symself(otri)
 
#define lnext(otri1, otri2)
 
#define lnextself(otri)   (otri).orient = plus1mod3[(otri).orient]
 
#define lprev(otri1, otri2)
 
#define lprevself(otri)   (otri).orient = minus1mod3[(otri).orient]
 
#define onext(otri1, otri2)
 
#define onextself(otri)
 
#define oprev(otri1, otri2)
 
#define oprevself(otri)
 
#define dnext(otri1, otri2)
 
#define dnextself(otri)
 
#define dprev(otri1, otri2)
 
#define dprevself(otri)
 
#define rnext(otri1, otri2)
 
#define rnextself(otri)
 
#define rprev(otri1, otri2)
 
#define rprevself(otri)
 
#define org(otri, vertexptr)   vertexptr = (vertex) (otri).tri[plus1mod3[(otri).orient] + 3]
 
#define dest(otri, vertexptr)   vertexptr = (vertex) (otri).tri[minus1mod3[(otri).orient] + 3]
 
#define apex(otri, vertexptr)   vertexptr = (vertex) (otri).tri[(otri).orient + 3]
 
#define setorg(otri, vertexptr)   (otri).tri[plus1mod3[(otri).orient] + 3] = (triangle) vertexptr
 
#define setdest(otri, vertexptr)   (otri).tri[minus1mod3[(otri).orient] + 3] = (triangle) vertexptr
 
#define setapex(otri, vertexptr)   (otri).tri[(otri).orient + 3] = (triangle) vertexptr
 
#define bond(otri1, otri2)
 
#define dissolve(otri)   (otri).tri[(otri).orient] = (triangle) m->dummytri
 
#define otricopy(otri1, otri2)
 
#define otriequal(otri1, otri2)
 
#define infect(otri)
 
#define uninfect(otri)
 
#define infected(otri)   (((unsigned long) (otri).tri[6] & (unsigned long) 2l) != 0l)
 
#define elemattribute(otri, attnum)   ((REAL *) (otri).tri)[m->elemattribindex + (attnum)]
 
#define setelemattribute(otri, attnum, value)   ((REAL *) (otri).tri)[m->elemattribindex + (attnum)] = value
 
#define areabound(otri)   ((REAL *) (otri).tri)[m->areaboundindex]
 
#define setareabound(otri, value)   ((REAL *) (otri).tri)[m->areaboundindex] = value
 
#define deadtri(tria)   ((tria)[1] == (triangle) NULL)
 
#define killtri(tria)
 
#define sdecode(sptr, osub)
 
#define sencode(osub)   (subseg) ((unsigned long) (osub).ss | (unsigned long) (osub).ssorient)
 
#define ssym(osub1, osub2)
 
#define ssymself(osub)   (osub).ssorient = 1 - (osub).ssorient
 
#define spivot(osub1, osub2)
 
#define spivotself(osub)
 
#define snext(osub1, osub2)
 
#define snextself(osub)
 
#define sorg(osub, vertexptr)   vertexptr = (vertex) (osub).ss[2 + (osub).ssorient]
 
#define sdest(osub, vertexptr)   vertexptr = (vertex) (osub).ss[3 - (osub).ssorient]
 
#define setsorg(osub, vertexptr)   (osub).ss[2 + (osub).ssorient] = (subseg) vertexptr
 
#define setsdest(osub, vertexptr)   (osub).ss[3 - (osub).ssorient] = (subseg) vertexptr
 
#define segorg(osub, vertexptr)   vertexptr = (vertex) (osub).ss[4 + (osub).ssorient]
 
#define segdest(osub, vertexptr)   vertexptr = (vertex) (osub).ss[5 - (osub).ssorient]
 
#define setsegorg(osub, vertexptr)   (osub).ss[4 + (osub).ssorient] = (subseg) vertexptr
 
#define setsegdest(osub, vertexptr)   (osub).ss[5 - (osub).ssorient] = (subseg) vertexptr
 
#define mark(osub)   (* (int *) ((osub).ss + 8))
 
#define setmark(osub, value)   * (int *) ((osub).ss + 8) = value
 
#define sbond(osub1, osub2)
 
#define sdissolve(osub)   (osub).ss[(osub).ssorient] = (subseg) m->dummysub
 
#define subsegcopy(osub1, osub2)
 
#define subsegequal(osub1, osub2)
 
#define deadsubseg(sub)   ((sub)[1] == (subseg) NULL)
 
#define killsubseg(sub)
 
#define tspivot(otri, osub)
 
#define stpivot(osub, otri)
 
#define tsbond(otri, osub)
 
#define tsdissolve(otri)   (otri).tri[6 + (otri).orient] = (triangle) m->dummysub
 
#define stdissolve(osub)   (osub).ss[6 + (osub).ssorient] = (subseg) m->dummytri
 
#define vertexmark(vx)   ((int *) (vx))[m->vertexmarkindex]
 
#define setvertexmark(vx, value)   ((int *) (vx))[m->vertexmarkindex] = value
 
#define vertextype(vx)   ((int *) (vx))[m->vertexmarkindex + 1]
 
#define setvertextype(vx, value)   ((int *) (vx))[m->vertexmarkindex + 1] = value
 
#define vertex2tri(vx)   ((triangle *) (vx))[m->vertex2triindex]
 
#define setvertex2tri(vx, value)   ((triangle *) (vx))[m->vertex2triindex] = value
 
#define STARTINDEX   1
 
#define Absolute(a)   ((a) >= 0.0 ? (a) : -(a))
 
#define Fast_Two_Sum_Tail(a, b, x, y)
 
#define Fast_Two_Sum(a, b, x, y)
 
#define Two_Sum_Tail(a, b, x, y)
 
#define Two_Sum(a, b, x, y)
 
#define Two_Diff_Tail(a, b, x, y)
 
#define Two_Diff(a, b, x, y)
 
#define Split(a, ahi, alo)
 
#define Two_Product_Tail(a, b, x, y)
 
#define Two_Product(a, b, x, y)
 
#define Two_Product_Presplit(a, b, bhi, blo, x, y)
 
#define Square_Tail(a, x, y)
 
#define Square(a, x, y)
 
#define Two_One_Sum(a1, a0, b, x2, x1, x0)
 
#define Two_One_Diff(a1, a0, b, x2, x1, x0)
 
#define Two_Two_Sum(a1, a0, b1, b0, x3, x2, x1, x0)
 
#define Two_Two_Diff(a1, a0, b1, b0, x3, x2, x1, x0)
 
#define Two_One_Product(a1, a0, b, x3, x2, x1, x0)
 

Typedefs

typedef REAL ** triangle
 
typedef REAL ** subseg
 
typedef REAL * vertex
 

Enumerations

enum  locateresult { INTRIANGLE, ONEDGE, ONVERTEX, OUTSIDE }
 
enum  insertvertexresult { SUCCESSFULVERTEX, ENCROACHINGVERTEX, VIOLATINGVERTEX, DUPLICATEVERTEX }
 
enum  finddirectionresult { WITHIN, LEFTCOLLINEAR, RIGHTCOLLINEAR }
 

Functions

char * readline ()
 
char * findfield ()
 
int triunsuitable (triorg, tridest, triapex, area) vertex triorg
 
 if (maxlen > 0.05 *(triorg[0]*triorg[0]+triorg[1]*triorg[1])+0.02)
 
void triexit (status) int status
 
VOID * trimalloc (size) int size
 
 if (memptr==(VOID *) NULL)
 
 return (memptr)
 
void trifree (memptr) VOID *memptr
 
void syntax ()
 
void info ()
 
void internalerror ()
 
void parsecommandline (argc, argv, b) int argc
 
 for (i=STARTINDEX;i< argc;i++)
 
 if (b->innodefilename[0]== '\0')
 
 if (!strcmp(&b->innodefilename[strlen(b->innodefilename)-5],".node"))
 
 if (!strcmp(&b->innodefilename[strlen(b->innodefilename)-5],".poly"))
 
 if (!strcmp(&b->innodefilename[strlen(b->innodefilename)-4],".ele"))
 
 if (!strcmp(&b->innodefilename[strlen(b->innodefilename)-5],".area"))
 
 if (b->goodangle==1.0)
 
b goodangle * if (b->refine &&b->noiterationnum)
 
 if (!b->refine &&!b->poly)
 
 if (b->refine||!b->poly)
 
 if (b->weighted &&(b->poly||b->quality))
 
 if (b->jettison &&b->nonodewritten &&!b->quiet)
 
 strcpy (b->inpolyfilename, b->innodefilename)
 
 strcpy (workstring, b->innodefilename)
 
 while (workstring[j]!= '\0')
 
 if (increment > 0)
 
else if (increment==0)
 
 sprintf (b->outnodefilename, workstring, meshnumber+1)
 
 strcat (b->outnodefilename,".node")
 
 strcat (b->outpolyfilename,".poly")
 
 strcat (b->outelefilename,".ele")
 
 strcat (b->edgefilename,".edge")
 
 strcat (b->vnodefilename,".v.node")
 
 strcat (b->vedgefilename,".v.edge")
 
 strcat (b->neighborfilename,".neigh")
 
 strcat (b->offfilename,".off")
 
 strcat (b->areafilename,".area")
 
void printtriangle (m, b, t) struct mesh *m
 
 printf ("triangle x%lx with orientation %d:\n",(unsigned long) t->tri, t->orient)
 
 decode (t->tri[0], printtri)
 
 if (printtri.tri==m->dummytri)
 
 decode (t->tri[1], printtri)
 
 decode (t->tri[2], printtri)
 
 if (printvertex==(vertex) NULL) printf(" Origin[%d]
 
called is pointed to *void dummyinit (m, b, trianglebytes, subsegbytes) struct mesh *m
 
void initializevertexpool (m, b) struct mesh *m
 
poolinit & m (REAL)
 
void initializetrisubpools (m, b) struct mesh *m
 
else if (m->eextras+b->regionattrib > 0)
 
 if ((b->voronoi||b->neighbors)&&(trisize< 6 *sizeof(triangle)+sizeof(int)))
 
poolinit & m (2 *m->invertices-2) > TRIPERBLOCK?(2 *m->invertices-2):TRIPERBLOCK, 4
 
void triangledealloc (m, dyingtriangle) struct mesh *m
 
pooldealloc & m (VOID *) dyingtriangle
 
triangle * triangletraverse (m) struct mesh *m
 
 if (newtriangle==(triangle *) NULL)
 
 while (deadtri(newtriangle))
 
void subsegdealloc (m, dyingsubseg) struct mesh *m
 
subseg * subsegtraverse (m) struct mesh *m
 
 if (newsubseg==(subseg *) NULL)
 
 while (deadsubseg(newsubseg))
 
void vertexdealloc (m, dyingvertex) struct mesh *m
 
vertex vertextraverse (m) struct mesh *m
 
 if (newvertex==(vertex) NULL)
 
 while (vertextype(newvertex)==DEADVERTEX)
 
void badsubsegdealloc (m, dyingseg) struct mesh *m
 
struct badsubsegbadsubsegtraverse (m) struct mesh *m
 
 if (newseg==(struct badsubseg *) NULL)
 
 while (newseg->subsegorg==(vertex) NULL)
 
vertex getvertex (m, b, number) struct mesh *m
 
 if (current+m->vertices.itemsfirstblock<=number)
 
return() vertex (foundvertex+m->vertices.itembytes *(number-current))
 
void triangledeinit (m, b) struct mesh *m
 
 trifree ((VOID *) m->dummytribase)
 
void maketriangle (m, b, newotri) struct mesh *m
 
 for (i=0;i< m->eextras;i++)
 
void makesubseg (m, newsubseg) struct mesh *m
 
void exactinit ()
 
int fast_expansion_sum_zeroelim (elen, e, flen, f, h) int elen
 
 if ((fnow > enow)==(fnow >-enow))
 
 if ((eindex< elen)&&(findex< flen))
 
 while (eindex< elen)
 
 if ((Q!=0.0)||(hindex==0))
 
int scale_expansion_zeroelim (elen, e, b, h) int elen
 
 Split (b, bhi, blo)
 
 Two_Product_Presplit (e[0], b, bhi, blo, Q, hh)
 
 if (hh!=0)
 
REAL estimate (elen, e) int elen
 
REAL counterclockwiseadapt (pa, pb, pc, detsum) vertex pa
 
 Two_Product (acx, bcy, detleft, detlefttail)
 
 Two_Product (acy, bcx, detright, detrighttail)
 
 Two_Two_Diff (detleft, detlefttail, detright, detrighttail, B3, B[2], B[1], B[0])
 
 if ((det >=errbound)||(-det >=errbound))
 
 Two_Diff_Tail (pa[0], pc[0], acx, acxtail)
 
 Two_Diff_Tail (pb[0], pc[0], bcx, bcxtail)
 
 Two_Diff_Tail (pa[1], pc[1], acy, acytail)
 
 Two_Diff_Tail (pb[1], pc[1], bcy, bcytail)
 
 if ((acxtail==0.0)&&(acytail==0.0)&&(bcxtail==0.0)&&(bcytail==0.0))
 
 Two_Product (acxtail, bcy, s1, s0)
 
 Two_Product (acytail, bcx, t1, t0)
 
 Two_Two_Diff (s1, s0, t1, t0, u3, u[2], u[1], u[0])
 
 Two_Product (acx, bcytail, s1, s0)
 
 Two_Product (acy, bcxtail, t1, t0)
 
 Two_Product (acxtail, bcytail, s1, s0)
 
 Two_Product (acytail, bcxtail, t1, t0)
 
 return (D[Dlength-1])
 
REAL counterclockwise (m, b, pa, pb, pc) struct mesh *m
 
 if (detleft > 0.0)
 
else if (detleft< 0.0)
 
REAL incircleadapt (pa, pb, pc, pd, permanent) vertex pa
 
 Two_Product (bdx, cdy, bdxcdy1, bdxcdy0)
 
 Two_Product (cdx, bdy, cdxbdy1, cdxbdy0)
 
 Two_Two_Diff (bdxcdy1, bdxcdy0, cdxbdy1, cdxbdy0, bc3, bc[2], bc[1], bc[0])
 
 Two_Product (cdx, ady, cdxady1, cdxady0)
 
 Two_Product (adx, cdy, adxcdy1, adxcdy0)
 
 Two_Two_Diff (cdxady1, cdxady0, adxcdy1, adxcdy0, ca3, ca[2], ca[1], ca[0])
 
 Two_Product (adx, bdy, adxbdy1, adxbdy0)
 
 Two_Product (bdx, ady, bdxady1, bdxady0)
 
 Two_Two_Diff (adxbdy1, adxbdy0, bdxady1, bdxady0, ab3, ab[2], ab[1], ab[0])
 
 Two_Diff_Tail (pa[0], pd[0], adx, adxtail)
 
 Two_Diff_Tail (pa[1], pd[1], ady, adytail)
 
 Two_Diff_Tail (pb[0], pd[0], bdx, bdxtail)
 
 Two_Diff_Tail (pb[1], pd[1], bdy, bdytail)
 
 Two_Diff_Tail (pc[0], pd[0], cdx, cdxtail)
 
 Two_Diff_Tail (pc[1], pd[1], cdy, cdytail)
 
 if ((adxtail==0.0)&&(bdxtail==0.0)&&(cdxtail==0.0)&&(adytail==0.0)&&(bdytail==0.0)&&(cdytail==0.0))
 
 if ((bdxtail!=0.0)||(bdytail!=0.0)||(cdxtail!=0.0)||(cdytail!=0.0))
 
 if ((cdxtail!=0.0)||(cdytail!=0.0)||(adxtail!=0.0)||(adytail!=0.0))
 
 if ((adxtail!=0.0)||(adytail!=0.0)||(bdxtail!=0.0)||(bdytail!=0.0))
 
 if (adxtail!=0.0)
 
 if (adytail!=0.0)
 
 if (bdxtail!=0.0)
 
 if (bdytail!=0.0)
 
 if (cdxtail!=0.0)
 
 if (cdytail!=0.0)
 
 if ((adxtail!=0.0)||(adytail!=0.0))
 
 if ((bdxtail!=0.0)||(bdytail!=0.0))
 
 if ((cdxtail!=0.0)||(cdytail!=0.0))
 
REAL incircle (m, b, pa, pb, pc, pd) struct mesh *m
 
 if ((det > errbound)||(-det > errbound))
 
REAL orient3dadapt (pa, pb, pc, pd, aheight, bheight, cheight, dheight, permanent) vertex pa
 
 Two_Diff_Tail (aheight, dheight, adheight, adheighttail)
 
 Two_Diff_Tail (bheight, dheight, bdheight, bdheighttail)
 
 Two_Diff_Tail (cheight, dheight, cdheight, cdheighttail)
 
 if ((adxtail==0.0)&&(bdxtail==0.0)&&(cdxtail==0.0)&&(adytail==0.0)&&(bdytail==0.0)&&(cdytail==0.0)&&(adheighttail==0.0)&&(bdheighttail==0.0)&&(cdheighttail==0.0))
 
 if (adxtail==0.0)
 
 if (adheighttail!=0.0)
 
 if (bdheighttail!=0.0)
 
 if (cdheighttail!=0.0)
 
REAL orient3d (m, b, pa, pb, pc, pd, aheight, bheight, cheight, dheight) struct mesh *m
 
REAL nonregular (m, b, pa, pb, pc, pd) struct mesh *m
 
 if ((dodist< aodist)&&(dodist< dadist))
 
void triangleinit (m) struct mesh *m
 
unsigned long randomnation (choices) unsigned int choices
 
return randomseed (714025l/choices+1)
 
void checkmesh (m, b) struct mesh *m
 
 if (!b->quiet)
 
 while (triangleloop.tri!=(triangle *) NULL)
 
 if (horrors==0)
 
void checkdelaunay (m, b) struct mesh *m
 
void enqueuebadtriang (m, b, badtri) struct mesh *m
 
 if (b->verbose > 2)
 
 if (badtri->key >=1.0)
 
 while (length > 2.0)
 
 if (posexponent)
 
 if (m->queuefront[queuenumber]==(struct badtriang *) NULL)
 
void enqueuebadtri (m, b, enqtri, minedge, enqapex, enqorg, enqdest) struct mesh *m
 
 enqueuebadtriang (m, b, newbad)
 
struct badtriangdequeuebadtriang (m) struct mesh *m
 
 if (result==m->queuetail[m->firstnonemptyq])
 
int checkseg4encroach (m, b, testsubseg) struct mesh *m
 
 if (neighbortri.tri!=m->dummytri)
 
 stpivot (testsym, neighbortri)
 
 if (encroached &&(!b->nobisect||((b->nobisect==1)&&(sides==2))))
 
void testtriangle (m, b, testtri) struct mesh *m
 
 if ((apexlen< orglen)&&(apexlen< destlen))
 
 if (b->vararea||b->fixedarea||b->usertest)
 
 if (angle > b->goodangle)
 
void makevertexmap (m, b) struct mesh *m
 
enum locateresult preciselocate (m, b, searchpoint, searchtri, stopatsubsegment) struct mesh *m
 
 while (1)
 
enum locateresult locate (m, b, searchpoint, searchtri) struct mesh *m
 
 if (m->recenttri.tri!=(triangle *) NULL)
 
 while (SAMPLEFACTOR *m->samples *m->samples *m->samples< m->triangles.items)
 
 while (totalsamplesleft > 0)
 
 if ((torg[0]==searchpoint[0])&&(torg[1]==searchpoint[1]))
 
 if ((tdest[0]==searchpoint[0])&&(tdest[1]==searchpoint[1]))
 
else if (ahead==0.0)
 
return preciselocate (m, b, searchpoint, searchtri, 0)
 
void insertsubseg (m, b, tri, subsegmark) struct mesh *m
 
 if (vertexmark(triorg)==0)
 
 if (vertexmark(tridest)==0)
 
 if (newsubseg.ss==m->dummysub)
 
 apex (top, farvertex)
 
 lprev (top, topleft)
 
 sym (topleft, toplcasing)
 
 lnext (top, topright)
 
 sym (topright, toprcasing)
 
 sym (botleft, botlcasing)
 
 sym (botright, botrcasing)
 
 bond (topleft, botlcasing)
 
 bond (botleft, botrcasing)
 
 bond (botright, toprcasing)
 
 bond (topright, toplcasing)
 
 if (m->checksegments)
 
 setorg (top, botvertex)
 
 setdest (top, farvertex)
 
 setapex (top, leftvertex)
 
void unflip (m, b, flipedge) struct mesh *m
 
 bond (topleft, toprcasing)
 
 bond (botleft, toplcasing)
 
 bond (botright, botlcasing)
 
 bond (topright, botrcasing)
 
 setorg (top, farvertex)
 
 setdest (top, botvertex)
 
 setapex (top, rightvertex)
 
enum insertvertexresult insertvertex (m, b, newvertex, searchtri, splitseg, segmentflaws, triflaws) struct mesh *m
 
 if (b->verbose > 1)
 
 if (splitseg==(struct osub *) NULL)
 
 if (intersect==ONVERTEX)
 
 if ((intersect==ONEDGE)||(intersect==OUTSIDE))
 
 lprev (horiz, botright)
 
 maketriangle (m, b,&newbotleft)
 
 org (horiz, rightvertex)
 
 dest (horiz, leftvertex)
 
 apex (horiz, botvertex)
 
 setorg (newbotleft, leftvertex)
 
 setdest (newbotleft, botvertex)
 
 setapex (newbotleft, newvertex)
 
 setorg (newbotright, botvertex)
 
 setdest (newbotright, rightvertex)
 
 setapex (newbotright, newvertex)
 
 setapex (horiz, newvertex)
 
 bond (newbotleft, botlcasing)
 
 bond (newbotright, botrcasing)
 
 lnextself (newbotleft)
 
 lprevself (newbotright)
 
 bond (newbotleft, newbotright)
 
 bond (botleft, newbotleft)
 
 bond (botright, newbotright)
 
 org (horiz, first)
 
void triangulatepolygon (m, b, firstedge, lastedge, edgecount, doflip, triflaws) struct mesh *m
 
 dest (besttri, bestvertex)
 
 otricopy (besttri, testtri)
 
 if (bestnumber > 1)
 
 if (doflip)
 
 otricopy (besttri,*lastedge)
 
void deletevertex (m, b, deltri) struct mesh *m
 
 vertexdealloc (m, delvertex)
 
 while (!otriequal(*deltri, countingtri))
 
 if (edgecount > 3)
 
 sym (lefttri, leftcasing)
 
 oprev (deltriright, righttri)
 
 sym (righttri, rightcasing)
 
 bond (deltriright, rightcasing)
 
 tspivot (lefttri, leftsubseg)
 
 if (leftsubseg.ss!=m->dummysub)
 
 tspivot (righttri, rightsubseg)
 
 if (rightsubseg.ss!=m->dummysub)
 
 org (lefttri, neworg)
 
 triangledealloc (m, lefttri.tri)
 
 triangledealloc (m, righttri.tri)
 
void undovertex (m, b) struct mesh *m
 
 while (m->lastflip!=(struct flipstacker *) NULL)
 
void vertexsort (sortarray, arraysize) vertex *sortarray
 
 if (arraysize==2)
 
 if (left > 1)
 
void vertexmedian (sortarray, arraysize, median, axis) vertex *sortarray
 
 if (left > median)
 
void alternateaxes (sortarray, arraysize, axis) vertex *sortarray
 
 if (arraysize<=3)
 
 vertexmedian (sortarray, arraysize, divider, axis)
 
 if (arraysize-divider >=2)
 
void mergehulls (m, b, farleft, innerleft, innerright, farright, axis) struct mesh *m
 
 if (b->dwyer &&(axis==1))
 
 if (counterclockwise(m, b, innerleftdest, innerleftapex, innerrightorg) > 0.0)
 
 if (counterclockwise(m, b, innerrightapex, innerrightorg, innerleftdest) > 0.0)
 
 while (changemade)
 
 bond (baseedge,*innerleft)
 
 lnextself (baseedge)
 
 setorg (baseedge, innerrightorg)
 
 setdest (baseedge, innerleftdest)
 
 if (innerleftdest==farleftpt)
 
 if (innerrightorg==farrightpt)
 
 apex (leftcand, upperleft)
 
 apex (rightcand, upperright)
 
void divconqrecurse (m, b, sortarray, vertices, axis, farleft, farright) struct mesh *m
 
 if (vertices==2)
 
 divconqrecurse (m, b, sortarray, divider, 1-axis, farleft,&innerleft)
 
 divconqrecurse (m, b,&sortarray[divider], vertices-divider, 1-axis,&innerright, farright)
 
 mergehulls (m, b, farleft,&innerleft,&innerright, farright, axis)
 
long removeghosts (m, b, startghost) struct mesh *m
 
 symself (searchedge)
 
 lnext (dissolveedge, deadtriangle)
 
 lprevself (dissolveedge)
 
 symself (dissolveedge)
 
 dissolve (dissolveedge)
 
 sym (deadtriangle, dissolveedge)
 
 triangledealloc (m, deadtriangle.tri)
 
 while (!otriequal(dissolveedge,*startghost))
 
long divconqdelaunay (m, b) struct mesh *m
 
 vertexsort (sortarray, m->invertices)
 
 for (j=1;j< m->invertices;j++)
 
 divconqrecurse (m, b, sortarray, i, 0,&hullleft,&hullright)
 
 trifree ((VOID *) sortarray)
 
return removeghosts (m, b,&hullleft)
 
void boundingbox (m, b) struct mesh *m
 
 if (m->ymax-m->ymin > width)
 
 if (width==0.0)
 
 setorg (inftri, m->infvertex1)
 
 setdest (inftri, m->infvertex2)
 
 setapex (inftri, m->infvertex3)
 
long removebox (m, b) struct mesh *m
 
 symself (nextedge)
 
 lprev (nextedge, finaledge)
 
 lnextself (nextedge)
 
 lprev (nextedge, searchedge)
 
 lnext (nextedge, checkedge)
 
 symself (checkedge)
 
 if (checkedge.tri==m->dummytri)
 
 while (!otriequal(nextedge, finaledge))
 
 triangledealloc (m, finaledge.tri)
 
long incrementaldelaunay (m, b) struct mesh *m
 
 while (vertexloop!=(vertex) NULL)
 
void eventheapinsert (heap, heapsize, newevent) struct event **heap
 
 while (notdone)
 
void eventheapify (heap, heapsize, eventnum) struct event **heap
 
void eventheapdelete (heap, heapsize, eventnum) struct event **heap
 
 if (eventnum > 0)
 
 eventheapify (heap, heapsize-1, eventnum)
 
void createeventheap (m, eventheap, events, freeevents) struct mesh *m
 
int rightofhyperbola (m, fronttri, newsite) struct mesh *m
 
 if ((leftvertex[1]< rightvertex[1])||((leftvertex[1]==rightvertex[1])&&(leftvertex[0]< rightvertex[0])))
 
REAL circletop (m, pa, pb, pc, ccwabc) struct mesh *m
 
return pc (xac *bclen2-xbc *aclen2+sqrt(aclen2 *bclen2 *ablen2))/(2.0 *ccwabc)
 
void check4deadevent (checktri, freeevents, eventheap, heapsize) struct otri *checktri
 
 if (eventvertex!=(vertex) NULL)
 
struct splaynodesplay (m, splaytree, searchpoint, searchtri) struct mesh *m
 
 if (splaytree==(struct splaynode *) NULL)
 
 dest (splaytree->keyedge, checkvertex)
 
 if (checkvertex==splaytree->keydest)
 
 if (lefttree==(struct splaynode *) NULL)
 
else if (righttree==(struct splaynode *) NULL)
 
else if (lefttree->rchild==(struct splaynode *) NULL)
 
else if (righttree->lchild==(struct splaynode *) NULL)
 
 while (leftright->rchild!=(struct splaynode *) NULL)
 
struct splaynodesplayinsert (m, splayroot, newkey, searchpoint) struct mesh *m
 
 if (splayroot==(struct splaynode *) NULL)
 
else if (rightofhyperbola(m,&splayroot->keyedge, searchpoint))
 
struct splaynodecircletopinsert (m, b, splayroot, newkey, pa, pb, pc, topy) struct mesh *m
 
return splayinsert (m, splay(m, splayroot,(vertex) searchpoint,&dummytri), newkey,(vertex) searchpoint)
 
struct splaynodefrontlocate (m, splayroot, bottommost, searchvertex, searchtri, farright) struct mesh *m
 
 while (!farrightflag &&rightofhyperbola(m, searchtri, searchvertex))
 
long sweeplinedelaunay (m, b) struct mesh *m
 
poolinit & m (struct splaynode), SPLAYNODEPERBLOCK, SPLAYNODEPERBLOCK, 0
 
 createeventheap (m,&eventheap,&events,&freeevents)
 
 bond (lefttri, righttri)
 
 lnextself (lefttri)
 
 lprevself (righttri)
 
 eventheapdelete (eventheap, heapsize, 0)
 
 if ((firstvertex[0]==secondvertex[0])&&(firstvertex[1]==secondvertex[1]))
 
 while ((firstvertex[0]==secondvertex[0])&&(firstvertex[1]==secondvertex[1]))
 
 setorg (lefttri, firstvertex)
 
 setdest (lefttri, secondvertex)
 
 setorg (righttri, secondvertex)
 
 setdest (righttri, firstvertex)
 
 lprev (lefttri, bottommost)
 
 while (heapsize > 0)
 
 lprevself (bottommost)
 
long delaunay (m, b) struct mesh *m
 
 if (m->triangles.items==0)
 
long reconstruct (m, b, elefilename, areafilename, polyfilename, polyfile) struct mesh *m
 
 if (elefile==(FILE *) NULL)
 
 for (elementnumber=1;elementnumber<=m->inelements;elementnumber++)
 
 fclose (elefile)
 
enum finddirectionresult finddirection (m, b, searchtri, searchpoint) struct mesh *m
 
 if (leftflag &&rightflag)
 
 while (leftflag)
 
 while (rightflag)
 
 if (leftccw==0.0)
 
else if (rightccw==0.0)
 
void segmentintersection (m, b, splittri, splitsubseg, endpoint2) struct mesh *m
 
 if (denom==0.0)
 
 setvertexmark (newvertex, mark(*splitsubseg))
 
 setvertextype (newvertex, INPUTVERTEX)
 
 if (success!=SUCCESSFULVERTEX)
 
 setvertex2tri (newvertex, encode(*splittri))
 
 if (m->steinerleft > 0)
 
 sdissolve (opposubseg)
 
 while (splitsubseg->ss!=m->dummysub)
 
 snextself (opposubseg)
 
 while (opposubseg.ss!=m->dummysub)
 
 finddirection (m, b, splittri, endpoint1)
 
 if ((leftvertex[0]==endpoint1[0])&&(leftvertex[1]==endpoint1[1]))
 
else if ((rightvertex[0]!=endpoint1[0])||(rightvertex[1]!=endpoint1[1]))
 
int scoutsegment (m, b, searchtri, endpoint2, newmark) struct mesh *m
 
 if (((leftvertex[0]==endpoint2[0])&&(leftvertex[1]==endpoint2[1]))||((rightvertex[0]==endpoint2[0])&&(rightvertex[1]==endpoint2[1])))
 
else if (collinear==LEFTCOLLINEAR)
 
 tspivot (crosstri, crosssubseg)
 
 if (crosssubseg.ss==m->dummysub)
 
 otricopy (crosstri,*searchtri)
 
 insertsubseg (m, b, searchtri, newmark)
 
void conformingedge (m, b, endpoint1, endpoint2, newmark) struct mesh *m
 
 setvertexmark (newvertex, newmark)
 
 setvertextype (newvertex, SEGMENTVERTEX)
 
 if (success==DUPLICATEVERTEX)
 
 finddirection (m, b,&searchtri2, endpoint2)
 
 if (!scoutsegment(m, b,&searchtri1, endpoint1, newmark))
 
 if (!scoutsegment(m, b,&searchtri2, endpoint2, newmark))
 
void delaunayfixup (m, b, fixuptri, leftside) struct mesh *m
 
 sym (neartri, fartri)
 
 if (fartri.tri==m->dummytri)
 
 tspivot (neartri, faredge)
 
 if (faredge.ss!=m->dummysub)
 
 apex (neartri, nearvertex)
 
 org (neartri, leftvertex)
 
 dest (neartri, rightvertex)
 
 apex (fartri, farvertex)
 
 if (leftside)
 
 delaunayfixup (m, b,&fartri, leftside)
 
void constrainededge (m, b, starttri, endpoint2, newmark) struct mesh *m
 
 flip (m, b,&fixuptri)
 
 if ((farvertex[0]==endpoint2[0])&&(farvertex[1]==endpoint2[1]))
 
 if (area==0.0)
 
 segmentintersection (m, b,&fixuptri,&crosssubseg, endpoint2)
 
 while (!done)
 
 insertsubseg (m, b,&fixuptri, newmark)
 
 if (collision)
 
void insertsegment (m, b, endpoint1, endpoint2, newmark) struct mesh *m
 
 if (encodedtri!=(triangle) NULL)
 
 if (checkvertex!=endpoint1)
 
 otricopy (searchtri1, m->recenttri)
 
 if (scoutsegment(m, b,&searchtri1, endpoint2, newmark))
 
 org (searchtri1, endpoint1)
 
 otricopy (searchtri2, m->recenttri)
 
 if (scoutsegment(m, b,&searchtri2, endpoint1, newmark))
 
 org (searchtri2, endpoint2)
 
void markhull (m, b) struct mesh *m
 
 symself (hulltri)
 
 otricopy (hulltri, starttri)
 
 lnextself (hulltri)
 
 oprev (hulltri, nexttri)
 
 while (nexttri.tri!=m->dummytri)
 
 while (!otriequal(hulltri, starttri))
 
void formskeleton (m, b, polyfile, polyfilename) struct mesh *m
 
 if (b->convex||!b->poly)
 
void infecthull (m, b) struct mesh *m
 
void plague (m, b) struct mesh *m
 
 while (virusloop!=(triangle **) NULL)
 
void regionplague (m, b, attribute, area) struct mesh *m
 
void carveholes (m, b, holelist, holes, regionlist, regions) struct mesh *m
 
 if (!(b->quiet||(b->noholes &&b->convex)))
 
 if (regions > 0)
 
 if (((holes > 0)&&!b->noholes)||!b->convex||(regions > 0))
 
 if ((holes > 0)&&!b->noholes)
 
 if (m->viri.items > 0)
 
void tallyencs (m, b) struct mesh *m
 
 while (subsegloop.ss!=(subseg *) NULL)
 
void precisionerror ()
 
void splitencsegs (m, b, triflaws) struct mesh *m
 
 while ((m->badsubsegs.items > 0)&&(m->steinerleft!=0))
 
void tallyfaces (m, b) struct mesh *m
 
void splittriangle (m, b, badtri) struct mesh *m
 
 decode (badtri->poortri, badotri)
 
 org (badotri, borg)
 
 dest (badotri, bdest)
 
 apex (badotri, bapex)
 
 if (!deadtri(badotri.tri)&&(borg==badtri->triangorg)&&(bdest==badtri->triangdest)&&(bapex==badtri->triangapex))
 
void enforcequality (m, b) struct mesh *m
 
poolinit & m (struct badsubseg), BADSUBSEGPERBLOCK, BADSUBSEGPERBLOCK, 0
 
 if (b->verbose &&(m->badsubsegs.items > 0))
 
 splitencsegs (m, b, 0)
 
 if ((b->minangle > 0.0)||b->vararea||b->fixedarea||b->usertest)
 
 if (!b->quiet &&b->conformdel &&(m->badsubsegs.items > 0)&&(m->steinerleft==0))
 
void highorder (m, b) struct mesh *m
 
char * readline (string, infile, infilename) char *string
 
 while ((*result!= '\0')&&(*result!= '#')&&(*result!= '.')&&(*result!= '+')&&(*result!= '-')&&((*result< '0')||(*result > '9')))
 
 while ((*result== '#')||(*result== '\0'))
 
char * findfield (string) char *string
 
 while ((*result!= '\0')&&(*result!= '#')&&(*result!= ' ')&&(*result!= '\t'))
 
void readnodes (m, b, nodefilename, polyfilename, polyfile) struct mesh *m
 
 if (m->mesh_dim!=2)
 
void readholes (m, b, polyfile, polyfilename, hlist, holes, rlist, regions) struct mesh *m
 
 if ((b->regionattrib||b->vararea)&&!b->refine)
 
 fclose (polyfile)
 
void finishfile (outfile, argc, argv) FILE *outfile
 
 fprintf (outfile,"# Generated by")
 
 fprintf (outfile,"\n")
 
 fclose (outfile)
 
void writenodes (m, b, nodefilename, argc, argv) struct mesh *m
 
 if (outfile==(FILE *) NULL)
 
 fprintf (outfile,"%ld %d %d %d\n", outvertices, m->mesh_dim, m->nextras, 1-b->nobound)
 
void numbernodes (m, b) struct mesh *m
 
void writeelements (m, b, elefilename, argc, argv) struct mesh *m
 
 fprintf (outfile,"%ld %d %d\n", m->triangles.items,(b->order+1)*(b->order+2)/2, m->eextras)
 
void writepoly (m, b, polyfilename, holelist, holes, regionlist, regions, argc, argv) struct mesh *m
 
 fprintf (outfile,"%d %d %d %d\n", 0, m->mesh_dim, m->nextras, 1-b->nobound)
 
 fprintf (outfile,"%ld %d\n", m->subsegs.items, 1-b->nobound)
 
 fprintf (outfile,"%d\n", holes)
 
 if (holes > 0)
 
void writeedges (m, b, edgefilename, argc, argv) struct mesh *m
 
 fprintf (outfile,"%ld %d\n", m->edges, 1-b->nobound)
 
void writevoronoi (m, b, vnodefilename, vedgefilename, argc, argv) struct mesh *m
 
 fprintf (outfile,"%ld %d %d %d\n", m->triangles.items, 2, m->nextras, 0)
 
 fprintf (outfile,"%ld %d\n", m->edges, 0)
 
void writeneighbors (m, b, neighborfilename, argc, argv) struct mesh *m
 
 fprintf (outfile,"%ld %d\n", m->triangles.items, 3)
 
void writeoff (m, b, offfilename, argc, argv) struct mesh *m
 
 fprintf (outfile,"OFF\n%ld %ld %ld\n", outvertices, m->triangles.items, m->edges)
 
void quality_statistics (m, b) struct mesh *m
 
 printf ("Mesh quality statistics:\n\n")
 
smallestarea *biggestarea * if (smallestangle >=1.0)
 
 if (biggestangle >=1.0)
 
 printf (" Shortest edge: %16.5g | Longest edge: %16.5g\n", shortest, longest)
 
 printf (" Shortest altitude: %12.5g | Largest aspect ratio: %8.5g\n\n", minaltitude, worstaspect)
 
 printf (" Triangle aspect ratio histogram:\n")
 
 printf (" 1.1547 - %-6.6g : %8d | %6.6g - %-6.6g : %8d\n", ratiotable[0], aspecttable[0], ratiotable[7], ratiotable[8], aspecttable[8])
 
 printf (" %6.6g - %-6.6g : %8d | %6.6g - : %8d\n", ratiotable[6], ratiotable[7], aspecttable[7], ratiotable[14], aspecttable[15])
 
 printf (" (Aspect ratio is longest edge divided by shortest altitude)\n\n")
 
 printf (" Smallest angle: %15.5g | Largest angle: %15.5g\n\n", smallestangle, biggestangle)
 
 printf (" Angle histogram:\n")
 
 printf ("\n")
 
void statistics (m, b) struct mesh *m
 
 printf (" Input vertices: %d\n", m->invertices)
 
 printf ("\n Mesh vertices: %ld\n", m->vertices.items-m->undeads)
 
 printf (" Mesh triangles: %ld\n", m->triangles.items)
 
 printf (" Mesh edges: %ld\n", m->edges)
 
 printf (" Mesh exterior boundary edges: %ld\n", m->hullsize)
 
 if (b->poly||b->refine)
 
int main (argc, argv) int argc
 
 parsecommandline (argc, argv,&b)
 
 if (!b.quiet)
 
 if (b.refine)
 
 if (b.poly &&(m.triangles.items > 0))
 
 if (b.quality &&(m.triangles.items > 0))
 
 if (b.order > 1)
 
 if (b.nonodewritten||(b.noiterationnum &&m.readnodefile))
 
 if (b.poly||b.convex)
 
 if (m.regions > 0)
 

Variables

REAL splitter
 
REAL epsilon
 
REAL resulterrbound
 
REAL ccwerrboundA
 
REAL ccwerrboundB
 
REAL ccwerrboundC
 
REAL iccerrboundA
 
REAL iccerrboundB
 
REAL iccerrboundC
 
REAL o3derrboundA
 
REAL o3derrboundB
 
REAL o3derrboundC
 
unsigned long randomseed = 1
 
int plus1mod3 [3] = {1, 2, 0}
 
int minus1mod3 [3] = {2, 0, 1}
 
vertex tridest
 
vertex triapex
 
REAL area
 
REAL dyoa
 
REAL dyda = tridest[1] - triapex[1]
 
REAL dyod = triorg[1] - tridest[1]
 
REAL oalen = dxoa * dxoa + dyoa * dyoa
 
REAL dalen = dxda * dxda + dyda * dyda
 
REAL odlen = dxod * dxod + dyod * dyod
 
REAL maxlen = (dalen > oalen) ? dalen : oalen
 
 dxoa = triorg[0] - triapex[0]
 
 dxda = tridest[0] - triapex[0]
 
 dxod = triorg[0] - tridest[0]
 
 else
 
 memptr = (VOID *) malloc((unsigned int) size)
 
char ** argv
 
struct behaviorb
 
int meshnumber
 
int i = 0
 
int j = 1
 
int k
 
char workstring [FILENAMESIZE] = 'd'
 
poly = b->refine = b->quality = 0
 
vararea = b->fixedarea = b->usertest = 0
 
regionattrib = b->convex = b->weighted = b->jettison = 0
 
firstnumber = 1
 
edgesout = b->voronoi = b->neighbors = b->geomview = 0
 
nobound = b->nopolywritten = b->nonodewritten = b->noelewritten = 0
 
noiterationnum = 0
 
noholes = b->noexact = 0
 
incremental = b->sweepline = 0
 
dwyer = 1
 
splitseg = 0
 
docheck = 0
 
nobisect = 0
 
conformdel = 0
 
steiner = -1
 
order = 1
 
minangle = 0.0
 
maxarea = -1.0
 
quiet = b->verbose = 0
 
innodefilename [0] = '\0'
 
usesegments = b->poly || b->refine || b->quality || b->convex
 
goodangle = cos(b->minangle * PI / 180.0)
 
 increment = 0
 
struct otrit
 
struct osub printsh
 
vertex printvertex
 
called dummytri
 
int trianglebytes
 
int subsegbytes
 
dummytribase
 
 alignptr = (unsigned long) m->dummytribase
 
vertexmarkindex
 
 vertexsize = (m->vertexmarkindex + 2) * sizeof(int)
 
highorderindex = 6 + (b->usesegments * 3)
 
 trisize
 
elemattribindex = (trisize + sizeof(REAL) - 1) / sizeof(REAL)
 
areaboundindex = m->elemattribindex + m->eextras + b->regionattrib
 
triangle * dyingtriangle
 
 do
 
return newtriangle
 
subseg * dyingsubseg
 
return newsubseg
 
vertex dyingvertex
 
return newvertex = (vertex) poolalloc(&m->vertices)
 
struct badsubsegdyingseg
 
return newseg
 
int number
 
char * foundvertex
 
int current = b->firstnumber
 
 getblock = m->vertices.firstblock
 
pooldeinit & m
 
struct otrinewotri
 
newotri tri = (triangle *) poolalloc(&m->triangles)
 
newotri orient = 0
 
newsubseg ss [0] = (subseg) m->dummysub
 
newsubseg ssorient = 0
 
REAL * e
 
int flen
 
REAL * f
 
REAL * h
 
INEXACT REAL Qnew
 
INEXACT REAL hh
 
INEXACT REAL bvirt
 
REAL avirt
 
REAL bround
 
REAL around
 
int eindex = findex = 0
 
int findex
 
int hindex = 0
 
REAL enow = e[0]
 
REAL fnow = f[0]
 
INEXACT REAL product1
 
REAL product0
 
INEXACT REAL c
 
INEXACT REAL abig
 
REAL ahi
 
REAL alo
 
REAL bhi
 
REAL blo
 
REAL err1
 
REAL err2
 
REAL err3
 
 Q = e[0]
 
vertex pb
 
vertex pc
 
REAL detsum
 
REAL acxtail
 
REAL acytail
 
REAL bcxtail
 
REAL bcytail
 
INEXACT REAL detleft = (pa[0] - pc[0]) * (pb[1] - pc[1])
 
INEXACT REAL detright = (pa[1] - pc[1]) * (pb[0] - pc[0])
 
REAL detlefttail
 
REAL detrighttail
 
REAL det = estimate(4, B)
 
REAL errbound = ccwerrboundB * detsum
 
REAL B [4] = B3
 
REAL C1 [8]
 
REAL C2 [12]
 
REAL D [16]
 
INEXACT REAL B3
 
int C1length = fast_expansion_sum_zeroelim(4, B, 4, u, C1)
 
int C2length = fast_expansion_sum_zeroelim(C1length, C1, 4, u, C2)
 
int Dlength = fast_expansion_sum_zeroelim(C2length, C2, 4, u, D)
 
REAL u [4] = u3
 
INEXACT REAL u3
 
INEXACT REAL s1
 
INEXACT REAL t1
 
REAL s0
 
REAL t0
 
INEXACT REAL _i
 
INEXACT REAL _j
 
REAL _0
 
 acx = (REAL) (pa[0] - pc[0])
 
 bcx = (REAL) (pb[0] - pc[0])
 
 acy = (REAL) (pa[1] - pc[1])
 
 bcy = (REAL) (pb[1] - pc[1])
 
vertex pa
 
counterclockcount
 
vertex pd
 
REAL permanent
 
INEXACT REAL bdxcdy1
 
INEXACT REAL cdxbdy1
 
INEXACT REAL cdxady1
 
INEXACT REAL adxcdy1
 
INEXACT REAL adxbdy1
 
INEXACT REAL bdxady1
 
REAL bdxcdy0
 
REAL cdxbdy0
 
REAL cdxady0
 
REAL adxcdy0
 
REAL adxbdy0
 
REAL bdxady0
 
REAL bc [4] = bc3
 
REAL ca [4] = ca3
 
REAL ab [4] = ab3
 
INEXACT REAL bc3
 
INEXACT REAL ca3
 
INEXACT REAL ab3
 
REAL axbc [8]
 
REAL axxbc [16]
 
REAL aybc [8]
 
REAL ayybc [16]
 
REAL adet [32]
 
int axbclen = scale_expansion_zeroelim(4, bc, adx, axbc)
 
int axxbclen = scale_expansion_zeroelim(axbclen, axbc, adx, axxbc)
 
int aybclen = scale_expansion_zeroelim(4, bc, ady, aybc)
 
int ayybclen = scale_expansion_zeroelim(aybclen, aybc, ady, ayybc)
 
int alen = fast_expansion_sum_zeroelim(axxbclen, axxbc, ayybclen, ayybc, adet)
 
REAL bxca [8]
 
REAL bxxca [16]
 
REAL byca [8]
 
REAL byyca [16]
 
REAL bdet [32]
 
int bxcalen = scale_expansion_zeroelim(4, ca, bdx, bxca)
 
int bxxcalen = scale_expansion_zeroelim(bxcalen, bxca, bdx, bxxca)
 
int bycalen = scale_expansion_zeroelim(4, ca, bdy, byca)
 
int byycalen = scale_expansion_zeroelim(bycalen, byca, bdy, byyca)
 
int blen = fast_expansion_sum_zeroelim(bxxcalen, bxxca, byycalen, byyca, bdet)
 
REAL cxab [8]
 
REAL cxxab [16]
 
REAL cyab [8]
 
REAL cyyab [16]
 
REAL cdet [32]
 
int cxablen = scale_expansion_zeroelim(4, ab, cdx, cxab)
 
int cxxablen = scale_expansion_zeroelim(cxablen, cxab, cdx, cxxab)
 
int cyablen = scale_expansion_zeroelim(4, ab, cdy, cyab)
 
int cyyablen = scale_expansion_zeroelim(cyablen, cyab, cdy, cyyab)
 
int clen = fast_expansion_sum_zeroelim(cxxablen, cxxab, cyyablen, cyyab, cdet)
 
REAL abdet [64]
 
int ablen = fast_expansion_sum_zeroelim(alen, adet, blen, bdet, abdet)
 
REAL fin1 [1152]
 
REAL fin2 [1152]
 
REAL * finnow = fin1
 
REAL * finother = fin2
 
REAL * finswap = finnow
 
int finlength = fast_expansion_sum_zeroelim(ablen, abdet, clen, cdet, fin1)
 
REAL adxtail
 
REAL bdxtail
 
REAL cdxtail
 
REAL adytail
 
REAL bdytail
 
REAL cdytail
 
INEXACT REAL adxadx1
 
INEXACT REAL adyady1
 
INEXACT REAL bdxbdx1
 
INEXACT REAL bdybdy1
 
INEXACT REAL cdxcdx1
 
INEXACT REAL cdycdy1
 
REAL adxadx0
 
REAL adyady0
 
REAL bdxbdx0
 
REAL bdybdy0
 
REAL cdxcdx0
 
REAL cdycdy0
 
REAL aa [4]
 
REAL bb [4]
 
REAL cc [4]
 
INEXACT REAL aa3
 
INEXACT REAL bb3
 
INEXACT REAL cc3
 
INEXACT REAL ti1
 
INEXACT REAL tj1
 
REAL ti0
 
REAL tj0
 
REAL v [4]
 
INEXACT REAL v3
 
REAL temp8 [8]
 
REAL temp16a [16]
 
REAL temp16b [16]
 
REAL temp16c [16]
 
REAL temp32a [32]
 
REAL temp32b [32]
 
REAL temp48 [48]
 
REAL temp64 [64]
 
int temp8len
 
int temp16alen
 
int temp16blen
 
int temp16clen
 
int temp32alen
 
int temp32blen
 
int temp48len
 
int temp64len
 
REAL axtbb [8]
 
REAL axtcc [8]
 
REAL aytbb [8]
 
REAL aytcc [8]
 
int axtbblen
 
int axtcclen
 
int aytbblen
 
int aytcclen
 
REAL bxtaa [8]
 
REAL bxtcc [8]
 
REAL bytaa [8]
 
REAL bytcc [8]
 
int bxtaalen
 
int bxtcclen
 
int bytaalen
 
int bytcclen
 
REAL cxtaa [8]
 
REAL cxtbb [8]
 
REAL cytaa [8]
 
REAL cytbb [8]
 
int cxtaalen
 
int cxtbblen
 
int cytaalen
 
int cytbblen
 
REAL axtbc [8]
 
REAL aytbc [8]
 
REAL bxtca [8]
 
REAL bytca [8]
 
REAL cxtab [8]
 
REAL cytab [8]
 
int axtbclen =0
 
int aytbclen =0
 
int bxtcalen =0
 
int bytcalen =0
 
int cxtablen =0
 
int cytablen =0
 
REAL axtbct [16]
 
REAL aytbct [16]
 
REAL bxtcat [16]
 
REAL bytcat [16]
 
REAL cxtabt [16]
 
REAL cytabt [16]
 
int axtbctlen
 
int aytbctlen
 
int bxtcatlen
 
int bytcatlen
 
int cxtabtlen
 
int cytabtlen
 
REAL axtbctt [8]
 
REAL aytbctt [8]
 
REAL bxtcatt [8]
 
REAL bytcatt [8]
 
REAL cxtabtt [8]
 
REAL cytabtt [8]
 
int axtbcttlen
 
int aytbcttlen
 
int bxtcattlen
 
int bytcattlen
 
int cxtabttlen
 
int cytabttlen
 
REAL abt [8]
 
REAL bct [8]
 
REAL cat [8]
 
int abtlen = fast_expansion_sum_zeroelim(at_blen, at_b, bt_alen, bt_a, abt)
 
int bctlen
 
int catlen = fast_expansion_sum_zeroelim(ct_alen, ct_a, at_clen, at_c, cat)
 
REAL abtt [4]
 
REAL bctt [4]
 
REAL catt [4]
 
int abttlen
 
int bcttlen
 
int cattlen
 
INEXACT REAL abtt3
 
INEXACT REAL bctt3
 
INEXACT REAL catt3
 
REAL negate
 
 adx = (REAL) (pa[0] - pd[0])
 
 bdx = (REAL) (pb[0] - pd[0])
 
 cdx = (REAL) (pc[0] - pd[0])
 
 ady = (REAL) (pa[1] - pd[1])
 
 bdy = (REAL) (pb[1] - pd[1])
 
 cdy = (REAL) (pc[1] - pd[1])
 
REAL bdxcdy
 
REAL cdxbdy = cdx * bdy
 
REAL cdxady = cdx * ady
 
REAL adxcdy = adx * cdy
 
REAL adxbdy = adx * bdy
 
REAL bdxady = bdx * ady
 
REAL alift = adx * adx + ady * ady
 
REAL blift = bdx * bdx + bdy * bdy
 
REAL clift = cdx * cdx + cdy * cdy
 
incirclecount = m->counterclockcount = m->orient3dcount = 0
 
REAL aheight
 
REAL bheight
 
REAL cheight
 
REAL dheight
 
REAL adheighttail
 
REAL bdheighttail
 
REAL cdheighttail
 
INEXACT REAL at_blarge
 
INEXACT REAL at_clarge
 
INEXACT REAL bt_clarge
 
INEXACT REAL bt_alarge
 
INEXACT REAL ct_alarge
 
INEXACT REAL ct_blarge
 
REAL at_b [4]
 
REAL at_c [4]
 
REAL bt_c [4]
 
REAL bt_a [4]
 
REAL ct_a [4]
 
REAL ct_b [4]
 
int at_blen
 
int at_clen
 
int bt_clen
 
int bt_alen
 
int ct_alen
 
int ct_blen
 
INEXACT REAL bdxt_cdy1
 
INEXACT REAL cdxt_bdy1
 
INEXACT REAL cdxt_ady1
 
INEXACT REAL adxt_cdy1
 
INEXACT REAL adxt_bdy1
 
INEXACT REAL bdxt_ady1
 
REAL bdxt_cdy0
 
REAL cdxt_bdy0
 
REAL cdxt_ady0
 
REAL adxt_cdy0
 
REAL adxt_bdy0
 
REAL bdxt_ady0
 
INEXACT REAL bdyt_cdx1
 
INEXACT REAL cdyt_bdx1
 
INEXACT REAL cdyt_adx1
 
INEXACT REAL adyt_cdx1
 
INEXACT REAL adyt_bdx1
 
INEXACT REAL bdyt_adx1
 
REAL bdyt_cdx0
 
REAL cdyt_bdx0
 
REAL cdyt_adx0
 
REAL adyt_cdx0
 
REAL adyt_bdx0
 
REAL bdyt_adx0
 
INEXACT REAL bdxt_cdyt1
 
INEXACT REAL cdxt_bdyt1
 
INEXACT REAL cdxt_adyt1
 
INEXACT REAL adxt_cdyt1
 
INEXACT REAL adxt_bdyt1
 
INEXACT REAL bdxt_adyt1
 
REAL bdxt_cdyt0
 
REAL cdxt_bdyt0
 
REAL cdxt_adyt0
 
REAL adxt_cdyt0
 
REAL adxt_bdyt0
 
REAL bdxt_adyt0
 
REAL w [16]
 
int vlength
 
int wlength = scale_expansion_zeroelim(bctlen, bct, adheight, w)
 
INEXACT REAL _k
 
 adheight = (REAL) (aheight - dheight)
 
 bdheight = (REAL) (bheight - dheight)
 
 cdheight = (REAL) (cheight - dheight)
 
orient3dcount
 
vertex torg
 
vertex tdest
 
vertex tapex
 
vertex circumcenter = torg[1] + dy
 
REAL * xi = (yao * dx - xao * dy) * (2.0 * denominator)
 
REAL * eta = (xdo * dy - ydo * dx) * (2.0 * denominator)
 
int offcenter
 
REAL dodist
 
REAL aodist = xao * xao + yao * yao
 
REAL dadist
 
REAL denominator
 
REAL dx = (yao * dodist - ydo * aodist) * denominator
 
REAL dy = (xdo * aodist - xao * dodist) * denominator
 
REAL dxoff
 
REAL dyoff
 
circumcentercount
 
 xdo = tdest[0] - torg[0]
 
 ydo = tdest[1] - torg[1]
 
 xao = tapex[0] - torg[0]
 
 yao = tapex[1] - torg[1]
 
undeads = 0
 
samples = 1
 
checksegments = 0
 
checkquality = 0
 
hyperbolacount = m->circletopcount = m->circumcentercount = 0
 
struct otri oppotri oppooppotri
 
vertex triorg
 
vertex oppoorg
 
vertex oppodest
 
int horrors = 0
 
int saveexact = b->noexact
 
triangle ptr
 
noexact = 0
 
struct otri oppotri
 
struct osub opposubseg
 
vertex oppoapex
 
int shouldbedelaunay
 
subseg sptr
 
struct badtriangbadtri
 
int exponent
 
int expincrement
 
int queuenumber
 
int posexponent = 0
 
queuetail [queuenumber] = badtri
 
badtri nexttriang = (struct badtriang *) NULL
 
struct otrienqtri
 
REAL minedge
 
vertex enqapex
 
vertex enqorg
 
vertex enqdest
 
 newbad = (struct badtriang *) poolalloc(&m->badtriangles)
 
newbad poortri = encode(*enqtri)
 
newbad key = minedge
 
newbad triangapex = enqapex
 
newbad triangorg = enqorg
 
newbad triangdest = enqdest
 
 result = m->queuefront[m->firstnonemptyq]
 
queuefront [m->firstnonemptyq] = result->nexttriang
 
struct osubtestsubseg
 
struct osub testsym
 
struct badsubsegencroachedseg
 
REAL dotproduct
 
int encroached = 0
 
int sides = 0
 
vertex eorg
 
vertex edest
 
vertex eapex
 
struct otritesttri
 
struct osub testsub
 
vertex base1 = tapex
 
vertex base2 = torg
 
vertex org1
 
vertex dest1
 
vertex org2
 
vertex dest2
 
vertex joinvertex
 
REAL dxao = tapex[0] - torg[0]
 
REAL dyao = tapex[1] - torg[1]
 
REAL dxod2 = dxod * dxod
 
REAL dyod2 = dyod * dyod
 
REAL dxda2 = dxda * dxda
 
REAL dyda2 = dyda * dyda
 
REAL dxao2 = dxao * dxao
 
REAL dyao2 = dyao * dyao
 
REAL apexlen = dxod2 + dyod2
 
REAL orglen = dxda2 + dyda2
 
REAL destlen = dxao2 + dyao2
 
REAL angle = dxod * dxda + dyod * dyda
 
REAL dist1
 
REAL dist2
 
vertex searchpoint = pc[0] - (yac * bclen2 - ybc * aclen2) / (2.0 * ccwabc)
 
struct otrisearchtri
 
int stopatsubsegment
 
struct osub checkedge
 
vertex forg
 
vertex fdest
 
vertex fapex
 
REAL orgorient
 
REAL destorient
 
int moveleft
 
char * firsttri
 
struct otri sampletri
 
REAL searchdist
 
REAL dist
 
REAL ahead = counterclockwise(m, b, torg, tdest, searchpoint)
 
long samplesperblock = (m->samples * TRIPERBLOCK - 1) / m->triangles.maxitems + 1
 
long totalsamplesleft = m->samples
 
long samplesleft
 
long population = m->triangles.itemsfirstblock
 
long totalpopulation = m->triangles.maxitems
 
 sampleblock = m->triangles.firstblock
 
int subsegmark
 
struct otriflipedge
 
struct otri topleft topright
 
struct otri top
 
struct otri botlcasing botrcasing
 
struct otri toplcasing toprcasing ={NULL, 0}
 
struct osub botlsubseg botrsubseg
 
struct osub toplsubseg toprsubseg
 
vertex leftvertex
 
vertex rightvertex = first
 
vertex botvertex
 
vertex farvertex
 
int segmentflaws
 
int triflaws
 
struct otri botleft botright
 
struct otri newbotleft newbotright
 
struct otri newtopright
 
struct otri toplcasing ={NULL, 0}
 
struct osub brokensubseg
 
struct osub checksubseg
 
struct osub rightsubseg
 
struct flipstackernewflip
 
vertex first
 
vertex topvertex
 
vertex segmentorg
 
vertex segmentdest
 
REAL attrib
 
enum insertvertexresult success = SUCCESSFULVERTEX
 
enum locateresult intersect = ONEDGE
 
int doflip
 
int mirrorflag
 
int enq
 
struct otrifirstedge
 
struct otrilastedge
 
int edgecount = 1
 
struct otri besttri
 
struct otri tempedge
 
vertex leftbasevertex
 
vertex rightbasevertex
 
vertex testvertex
 
vertex bestvertex
 
int bestnumber = 1
 
struct otrideltri
 
struct otri deltriright
 
struct otri lefttri righttri
 
struct otri leftcasing rightcasing
 
vertex delvertex
 
vertex neworg
 
struct otri gluetri
 
int arraysize
 
int pivot
 
REAL pivotx = sortarray[pivot][0]
 
REAL pivoty = sortarray[pivot][1]
 
vertex temp
 
 left = -1
 
 right = arraysize
 
int median
 
int axis
 
REAL pivot1 = sortarray[pivot][axis]
 
REAL pivot2 = sortarray[pivot][1 - axis]
 
 divider = arraysize >> 1
 
struct otrifarleft
 
struct otriinnerleft
 
struct otriinnerright
 
struct otrifarright = farrightflag
 
struct otri baseedge
 
struct otri nextedge
 
struct otri sidecasing topcasing outercasing
 
vertex innerleftdest
 
vertex innerrightorg
 
vertex innerleftapex
 
vertex innerrightapex
 
vertex farleftpt
 
vertex farrightpt
 
vertex farleftapex
 
vertex farrightapex
 
vertex lowerleft = innerleftdest
 
vertex lowerright = innerrightorg
 
vertex upperleft
 
vertex upperright
 
vertex nextapex
 
vertex checkvertex = (vertex) NULL
 
int changemade
 
int badedge
 
int leftfinished
 
int rightfinished
 
vertex * sortarray = (vertex *) trimalloc(m->invertices * (int) sizeof(vertex))
 
int vertices
 
struct otristartghost
 
struct otri dissolveedge
 
struct otri deadtriangle
 
vertex markorg
 
long hullsize = 0
 
struct otri hullleft hullright
 
REAL width
 
infvertex1 = (vertex) trimalloc(m->vertices.itembytes)
 
infvertex2 = (vertex) trimalloc(m->vertices.itembytes)
 
infvertex3 = (vertex) trimalloc(m->vertices.itembytes)
 
struct otri searchedge
 
vertex vertexloop
 
int heapsize = m->invertices
 
struct eventnewevent
 
int eventnum
 
int parent
 
int notdone = eventnum > 0
 
 eventx = newevent->xkey
 
 eventy = newevent->ykey
 
 heap [eventnum] = newevent
 
newevent heapposition = eventnum
 
int leftchild = 2 * eventnum + 1
 
int rightchild
 
int smallest
 
 thisevent = heap[eventnum]
 
 moveevent = heap[heapsize - 1]
 
struct event *** eventheap
 
struct event ** events = (struct event *) trimalloc(maxevents * (int) sizeof(struct event))
 
struct event ** freeevents = (struct event *) NULL
 
int maxevents
 
struct otrifronttri
 
vertex newsite
 
REAL dxa
 
REAL dya = leftvertex[1] - newsite[1]
 
REAL dxb = rightvertex[0] - newsite[0]
 
REAL dyb = rightvertex[1] - newsite[1]
 
REAL ccwabc = counterclockwise(m, b, pa, pb, pc)
 
REAL aclen2
 
REAL bclen2 = xbc * xbc + ybc * ybc
 
REAL ablen2 = xab * xab + yab * yab
 
circletopcount
 
 xac = pa[0] - pc[0]
 
 yac = pa[1] - pc[1]
 
 xbc = pb[0] - pc[0]
 
 ybc = pb[1] - pc[1]
 
 xab = pa[0] - pb[0]
 
 yab = pa[1] - pb[1]
 
vertex eventvertex
 
org * checktri
 
struct splaynodesplaytree
 
struct splaynodelefttree
 
struct splaynoderighttree = splay(m, splaytree->rchild, searchpoint, searchtri)
 
struct splaynodeleftright
 
int rightofroot
 
int rightofchild
 
leftright rchild = righttree
 
struct splaynodesplayroot = splay(m, splayroot, searchvertex, searchtri)
 
struct otrinewkey
 
 newsplaynode = (struct splaynode *) poolalloc(&m->splaynodes)
 
splayroot lchild = (struct splaynode *) NULL
 
REAL topy
 
struct otribottommost
 
vertex searchvertex
 
 farrightflag = 0
 
struct eventnextevent
 
struct otri fliptri
 
struct otri lefttri righttri
farlefttri 
farrighttri
 
struct otri inserttri
 
vertex firstvertex = (vertex) eventheap[0]->eventptr
 
vertex secondvertex
 
vertex nextvertex
 
vertex lastvertex = secondvertex
 
vertex connectvertex
 
vertex midvertex
 
REAL lefttest
 
REAL righttest
 
int check4events
 
eventheap[0] eventptr = (VOID *) freeevents
 
eextras = 0
 
char * elefilename
 
char * areafilename
 
char * polyfilename
 
FILE * polyfile = (FILE *) NULL
 
FILE * areafile
 
char inputline [INPUTLINESIZE]
 
char * stringptr = readline(inputline, elefile, elefilename)
 
int areaelements
 
struct otri triangleloop
 
struct otri triangleleft
 
struct otri checkleft
 
struct otri checkneighbor
 
struct osub subsegloop
 
triangle * vertexarray
 
triangle * prevlink
 
triangle nexttri
 
vertex checkdest
 
vertex checkapex
 
vertex shorg
 
vertex killvertex
 
int corner [3]
 
int end [2]
 
int killvertexindex
 
int incorners
 
int segmentmarkers = 0
 
int boundmarker
 
int aroundvertex
 
int notfound
 
long elementnumber = b->firstnumber
 
long segmentnumber
 
 elefile = fopen(elefilename, "r")
 
inelements = (int) strtol(stringptr, &stringptr, 0)
 
vertex startvertex
 
REAL leftccw = counterclockwise(m, b, searchpoint, startvertex, leftvertex)
 
REAL rightccw = counterclockwise(m, b, startvertex, searchpoint, rightvertex)
 
int leftflag = leftccw > 0.0
 
int rightflag = rightccw > 0.0
 
struct otrisplittri
 
struct osubsplitsubseg
 
vertex endpoint2
 
vertex endpoint1
 
REAL ex = endpoint2[0] - endpoint1[0]
 
REAL ey = endpoint2[1] - endpoint1[1]
 
REAL tx = tdest[0] - torg[0]
 
REAL ty = tdest[1] - torg[1]
 
REAL etx = torg[0] - endpoint2[0]
 
REAL ety = torg[1] - endpoint2[1]
 
REAL split = (ey * etx - ex * ety) / denom
 
REAL denom = ty * ex - tx * ey
 
int newmark
 
struct osub crosssubseg
 
enum finddirectionresult collinear = finddirection(m, b, searchtri, endpoint2)
 
vertex midvertex1
 
vertex midvertex2
 
struct otrifixuptri
 
int leftside
 
struct otri fartri
 
struct osub faredge
 
vertex nearvertex
 
struct otristarttri
 
int collision = 0
 
int done = 0
 
triangle encodedtri
 
int end1
 
int end2
 
struct osub hullsubseg
 
vertex horg
 
vertex hdest
 
struct otri neighbor
 
triangle ** virusloop = (triangle **) traverse(&m->viri)
 
struct osub neighborsubseg
 
vertex norg
 
vertex ndest
 
vertex deadorg
 
vertex deaddest
 
vertex deadapex
 
int killorg
 
REAL attribute
 
triangle ** regiontri
 
vertex regionorg
 
vertex regiondest
 
vertex regionapex
 
REAL * holelist
 
int holes = (int) strtol(stringptr, &stringptr, 0)
 
REAL * regionlist
 
int regions = 0
 
struct otriregiontris
 
triangle ** holetri
 
vertex searchorg
 
vertex searchdest
 
struct osub testsh
 
struct osub currentenc
 
struct badsubsegencloop
 
REAL segmentlength
 
REAL nearestpoweroftwo
 
REAL multiplier
 
REAL divisor
 
int acuteorg
 
int acuteorg2
 
int acutedest
 
int acutedest2
 
vertex borg
 
vertex bdest
 
vertex bapex
 
int errorflag
 
struct osub checkmark
 
m vertices deaditemstack = (VOID *) NULL
 
FILE * infile
 
char * infilename = nodefilename
 
char * nodefilename
 
REAL x
 
REAL y
 
int firstnode
 
int nodemarkers
 
int currentmarker
 
xminextreme = 10 * m->xmin - 9 * m->xmax
 
REAL ** hlist = holelist
 
REAL ** rlist = (REAL *) NULL
 
int index
 
int argc
 
long outvertices
 
int vertexnumber = b->firstnumber
 
 outfile = fopen(nodefilename, "w")
 
vertex p1
 
vertex p2
 
vertex p3
 
vertex mid1
 
vertex mid2
 
vertex mid3
 
long holenumber
 
long regionnumber
 
long subsegnumber = b->firstnumber
 
char * edgefilename
 
struct otri triangleloop trisym
 
long edgenumber = b->firstnumber
 
char * vnodefilename
 
char * vedgefilename
 
long vnodenumber = b->firstnumber
 
long vedgenumber = b->firstnumber
 
char * neighborfilename
 
int neighbor1
 
int neighbor2
 
int neighbor3
 
char * offfilename
 
vertex p [3]
 
REAL cossquaretable [8]
 
REAL ratiotable [16] = 1.5
 
REAL edgelength [3]
 
REAL cossquare
 
REAL triarea
 
REAL shortest = minaltitude
 
REAL longest = 0.0
 
REAL trilongest2
 
REAL smallestarea = minaltitude
 
REAL biggestarea = 0.0
 
REAL triminaltitude2
 
REAL minaltitude = m->xmax - m->xmin + m->ymax - m->ymin
 
REAL triaspect2
 
REAL worstaspect = 0.0
 
REAL smallestangle = 0.0
 
REAL biggestangle = 2.0
 
REAL radconst = PI / 18.0
 
REAL degconst = 180.0 / PI
 
int angletable [18]
 
int aspecttable [16]
 
int aspectindex
 
int tendegree
 
int acutebiggest = 1
 
int ii
 
REAL * holearray
 
REAL * regionarray
 
struct timeval tv0 tv1 tv2 tv3
tv4 tv5 
tv6
 
struct timezone tz
 
gettimeofday & tv0
 
steinerleft = b.steiner
 
edges = (3l * m.triangles.items + m.hullsize) / 2l
 
 return
 

Detailed Description

This file is part of the triangle source code, not part of Chaste per se.

We use the <autogenerated> tag to ignore it from our Doxygen checker.

Definition in file triangle.cpp.

Macro Definition Documentation

#define bond (   otri1,
  otri2 
)
Value:
(otri1).tri[(otri1).orient] = encode(otri2); \
(otri2).tri[(otri2).orient] = encode(otri1)

Definition at line 1166 of file triangle.cpp.

#define decode (   ptr,
  otri 
)
Value:
(otri).orient = (int) ((unsigned long) (ptr) & (unsigned long) 3l); \
(otri).tri = (triangle *) \
((unsigned long) (ptr) ^ (unsigned long) (otri).orient)

Definition at line 1021 of file triangle.cpp.

#define dnext (   otri1,
  otri2 
)
Value:
sym(otri1, otri2); \
lprevself(otri2);

Definition at line 1095 of file triangle.cpp.

#define dnextself (   otri)
Value:
symself(otri); \
lprevself(otri);

Definition at line 1099 of file triangle.cpp.

#define dprev (   otri1,
  otri2 
)
Value:
lnext(otri1, otri2); \
symself(otri2);

Definition at line 1107 of file triangle.cpp.

#define dprevself (   otri)
Value:
lnextself(otri); \
symself(otri);

Definition at line 1111 of file triangle.cpp.

#define Fast_Two_Sum (   a,
  b,
  x,
 
)
Value:
x = (REAL) (a + b); \
Fast_Two_Sum_Tail(a, b, x, y)

Definition at line 4853 of file triangle.cpp.

#define Fast_Two_Sum_Tail (   a,
  b,
  x,
 
)
Value:
bvirt = x - a; \
y = b - bvirt

Definition at line 4849 of file triangle.cpp.

#define infect (   otri)
Value:
(otri).tri[6] = (triangle) \
((unsigned long) (otri).tri[6] | (unsigned long) 2l)

Definition at line 1193 of file triangle.cpp.

#define killsubseg (   sub)
Value:
(sub)[1] = (subseg) NULL; \
(sub)[2] = (subseg) NULL

Definition at line 1351 of file triangle.cpp.

#define killtri (   tria)
Value:
(tria)[1] = (triangle) NULL; \
(tria)[3] = (triangle) NULL

Definition at line 1228 of file triangle.cpp.

#define lnext (   otri1,
  otri2 
)
Value:
(otri2).tri = (otri1).tri; \
(otri2).orient = plus1mod3[(otri1).orient]

Definition at line 1051 of file triangle.cpp.

#define lprev (   otri1,
  otri2 
)
Value:
(otri2).tri = (otri1).tri; \
(otri2).orient = minus1mod3[(otri1).orient]

Definition at line 1060 of file triangle.cpp.

#define onext (   otri1,
  otri2 
)
Value:
lprev(otri1, otri2); \
symself(otri2);

Definition at line 1071 of file triangle.cpp.

#define onextself (   otri)
Value:
lprevself(otri); \
symself(otri);

Definition at line 1075 of file triangle.cpp.

#define oprev (   otri1,
  otri2 
)
Value:
sym(otri1, otri2); \
lnextself(otri2);

Definition at line 1083 of file triangle.cpp.

#define oprevself (   otri)
Value:
symself(otri); \
lnextself(otri);

Definition at line 1087 of file triangle.cpp.

#define otricopy (   otri1,
  otri2 
)
Value:
(otri2).tri = (otri1).tri; \
(otri2).orient = (otri1).orient

Definition at line 1180 of file triangle.cpp.

#define otriequal (   otri1,
  otri2 
)
Value:
(((otri1).tri == (otri2).tri) && \
((otri1).orient == (otri2).orient))

Definition at line 1186 of file triangle.cpp.

#define rnext (   otri1,
  otri2 
)
Value:
sym(otri1, otri2); \
lnextself(otri2); \
symself(otri2);

Definition at line 1119 of file triangle.cpp.

#define rnextself (   otri)
Value:
symself(otri); \
lnextself(otri); \
symself(otri);

Definition at line 1124 of file triangle.cpp.

#define rprev (   otri1,
  otri2 
)
Value:
sym(otri1, otri2); \
lprevself(otri2); \
symself(otri2);

Definition at line 1133 of file triangle.cpp.

#define rprevself (   otri)
Value:
symself(otri); \
lprevself(otri); \
symself(otri);

Definition at line 1138 of file triangle.cpp.

#define sbond (   osub1,
  osub2 
)
Value:
(osub1).ss[(osub1).ssorient] = sencode(osub2); \
(osub2).ss[(osub2).ssorient] = sencode(osub1)

Definition at line 1322 of file triangle.cpp.

#define sdecode (   sptr,
  osub 
)
Value:
(osub).ssorient = (int) ((unsigned long) (sptr) & (unsigned long) 1l); \
(osub).ss = (subseg *) \
((unsigned long) (sptr) & ~ (unsigned long) 3l)

Definition at line 1241 of file triangle.cpp.

#define snext (   osub1,
  osub2 
)
Value:
sptr = (osub1).ss[1 - (osub1).ssorient]; \
sdecode(sptr, osub2)

Definition at line 1276 of file triangle.cpp.

#define snextself (   osub)
Value:
sptr = (osub).ss[1 - (osub).ssorient]; \
sdecode(sptr, osub)

Definition at line 1280 of file triangle.cpp.

#define spivot (   osub1,
  osub2 
)
Value:
sptr = (osub1).ss[(osub1).ssorient]; \
sdecode(sptr, osub2)

Definition at line 1265 of file triangle.cpp.

#define spivotself (   osub)
Value:
sptr = (osub).ss[(osub).ssorient]; \
sdecode(sptr, osub)

Definition at line 1269 of file triangle.cpp.

#define Split (   a,
  ahi,
  alo 
)
Value:
c = (REAL) (splitter * a); \
abig = (REAL) (c - a); \
ahi = c - abig; \
alo = a - ahi

Definition at line 4879 of file triangle.cpp.

#define Square (   a,
  x,
 
)
Value:
x = (REAL) (a * a); \
Square_Tail(a, x, y)

Definition at line 4916 of file triangle.cpp.

#define Square_Tail (   a,
  x,
 
)
Value:
Split(a, ahi, alo); \
err1 = x - (ahi * ahi); \
err3 = err1 - ((ahi + ahi) * alo); \
y = (alo * alo) - err3

Definition at line 4910 of file triangle.cpp.

#define ssym (   osub1,
  osub2 
)
Value:
(osub2).ss = (osub1).ss; \
(osub2).ssorient = 1 - (osub1).ssorient

Definition at line 1255 of file triangle.cpp.

#define stpivot (   osub,
  otri 
)
Value:
ptr = (triangle) (osub).ss[6 + (osub).ssorient]; \
decode(ptr, otri)

Definition at line 1368 of file triangle.cpp.

#define subsegcopy (   osub1,
  osub2 
)
Value:
(osub2).ss = (osub1).ss; \
(osub2).ssorient = (osub1).ssorient

Definition at line 1334 of file triangle.cpp.

#define subsegequal (   osub1,
  osub2 
)
Value:
(((osub1).ss == (osub2).ss) && \
((osub1).ssorient == (osub2).ssorient))

Definition at line 1340 of file triangle.cpp.

#define sym (   otri1,
  otri2 
)
Value:
ptr = (otri1).tri[(otri1).orient]; \
decode(ptr, otri2);

Definition at line 1041 of file triangle.cpp.

#define symself (   otri)
Value:
ptr = (otri).tri[(otri).orient]; \
decode(ptr, otri);

Definition at line 1045 of file triangle.cpp.

#define tsbond (   otri,
  osub 
)
Value:
(otri).tri[6 + (otri).orient] = (triangle) sencode(osub); \
(osub).ss[6 + (osub).ssorient] = (subseg) encode(otri)

Definition at line 1374 of file triangle.cpp.

#define tspivot (   otri,
  osub 
)
Value:
sptr = (subseg) (otri).tri[6 + (otri).orient]; \
sdecode(sptr, osub)

Definition at line 1361 of file triangle.cpp.

#define Two_Diff (   a,
  b,
  x,
 
)
Value:
x = (REAL) (a - b); \
Two_Diff_Tail(a, b, x, y)

Definition at line 4875 of file triangle.cpp.

#define Two_Diff_Tail (   a,
  b,
  x,
 
)
Value:
bvirt = (REAL) (a - x); \
avirt = x + bvirt; \
bround = bvirt - b; \
around = a - avirt; \
y = around + bround

Definition at line 4868 of file triangle.cpp.

#define Two_One_Diff (   a1,
  a0,
  b,
  x2,
  x1,
  x0 
)
Value:
Two_Diff(a0, b , _i, x0); \
Two_Sum( a1, _i, x2, x1)

Definition at line 4927 of file triangle.cpp.

#define Two_One_Product (   a1,
  a0,
  b,
  x3,
  x2,
  x1,
  x0 
)
Value:
Split(b, bhi, blo); \
Two_Product_Presplit(a0, b, bhi, blo, _i, x0); \
Two_Product_Presplit(a1, b, bhi, blo, _j, _0); \
Two_Sum(_i, _0, _k, x1); \
Fast_Two_Sum(_j, _k, x3, x2)

Definition at line 4941 of file triangle.cpp.

#define Two_One_Sum (   a1,
  a0,
  b,
  x2,
  x1,
  x0 
)
Value:
Two_Sum(a0, b , _i, x0); \
Two_Sum(a1, _i, x2, x1)

Definition at line 4923 of file triangle.cpp.

#define Two_Product (   a,
  b,
  x,
 
)
Value:
x = (REAL) (a * b); \
Two_Product_Tail(a, b, x, y)

Definition at line 4893 of file triangle.cpp.

#define Two_Product_Presplit (   a,
  b,
  bhi,
  blo,
  x,
 
)
Value:
x = (REAL) (a * b); \
Split(a, ahi, alo); \
err1 = x - (ahi * bhi); \
err2 = err1 - (alo * bhi); \
err3 = err2 - (ahi * blo); \
y = (alo * blo) - err3

Definition at line 4900 of file triangle.cpp.

#define Two_Product_Tail (   a,
  b,
  x,
 
)
Value:
Split(a, ahi, alo); \
Split(b, bhi, blo); \
err1 = x - (ahi * bhi); \
err2 = err1 - (alo * bhi); \
err3 = err2 - (ahi * blo); \
y = (alo * blo) - err3

Definition at line 4885 of file triangle.cpp.

#define Two_Sum (   a,
  b,
  x,
 
)
Value:
x = (REAL) (a + b); \
Two_Sum_Tail(a, b, x, y)

Definition at line 4864 of file triangle.cpp.

#define Two_Sum_Tail (   a,
  b,
  x,
 
)
Value:
bvirt = (REAL) (x - a); \
avirt = x - bvirt; \
bround = b - bvirt; \
around = a - avirt; \
y = around + bround

Definition at line 4857 of file triangle.cpp.

#define Two_Two_Diff (   a1,
  a0,
  b1,
  b0,
  x3,
  x2,
  x1,
  x0 
)
Value:
Two_One_Diff(a1, a0, b0, _j, _0, x0); \
Two_One_Diff(_j, _0, b1, x3, x2, x1)

Definition at line 4935 of file triangle.cpp.

#define Two_Two_Sum (   a1,
  a0,
  b1,
  b0,
  x3,
  x2,
  x1,
  x0 
)
Value:
Two_One_Sum(a1, a0, b0, _j, _0, x0); \
Two_One_Sum(_j, _0, b1, x3, x2, x1)

Definition at line 4931 of file triangle.cpp.

#define uninfect (   otri)
Value:
(otri).tri[6] = (triangle) \
((unsigned long) (otri).tri[6] & ~ (unsigned long) 2l)

Definition at line 1197 of file triangle.cpp.

Function Documentation

for ( )
Todo:
Horrible hack! (#1076/#1377)
Todo:
Store orientations? (#1076/#1377)

Definition at line 3406 of file triangle.cpp.

if ( b->  goodangle = = 1.0)
Initial value:
{
struct otri triangleloop

Definition at line 3604 of file triangle.cpp.

if ( )
Initial value:
{
struct badtriang *result

Definition at line 5350 of file triangle.cpp.

Variable Documentation

REAL aclen2
Initial value:
{
REAL xac, yac, xbc, ybc, xab, yab

Definition at line 10582 of file triangle.cpp.

REAL acxtail
Initial value:
{
INEXACT REAL acx, acy, bcx, bcy

Definition at line 5239 of file triangle.cpp.

FILE* areafile
Initial value:
{
FILE *elefile

Definition at line 11212 of file triangle.cpp.

struct otri baseedge
Initial value:
{
struct otri leftcand, rightcand

Definition at line 9515 of file triangle.cpp.

REAL bdxcdy
Initial value:
{
REAL adx, bdx, cdx, ady, bdy, cdy

Definition at line 5979 of file triangle.cpp.

struct otri besttri
Initial value:
{
struct otri testtri

Definition at line 8950 of file triangle.cpp.

vertex borg
Initial value:
{
struct otri badotri

Definition at line 13577 of file triangle.cpp.

struct osub brokensubseg
Initial value:
{
struct otri searchtri1, searchtri2

Definition at line 8305 of file triangle.cpp.

struct otri checkedge
Initial value:
{
struct otri backtracktri

Definition at line 7588 of file triangle.cpp.

struct osub checkmark
Initial value:
{
struct otri triangleloop, trisym

Definition at line 13805 of file triangle.cpp.

struct osub crosssubseg
Initial value:
{
struct otri crosstri

Definition at line 11909 of file triangle.cpp.

dadist
Initial value:
= (tdest[0] - tapex[0]) * (tdest[0] - tapex[0]) +
(tdest[1] - tapex[1]) * (tdest[1] - tapex[1])

Definition at line 6615 of file triangle.cpp.

REAL detsum
Initial value:
{
REAL detleft, detright, det

Definition at line 5236 of file triangle.cpp.

struct otri nextedge finaledge dissolveedge
Initial value:
{
struct otri searchedge

Definition at line 10000 of file triangle.cpp.

do
Initial value:
{
newtriangle = (triangle *) traverse(&m->triangles)

Definition at line 4490 of file triangle.cpp.

dodist
Initial value:
{
REAL xdo, ydo, xao, yao

Definition at line 6615 of file triangle.cpp.

*int *m dummytri
Initial value:
= (triangle *)
(alignptr + (unsigned long) m->triangles.alignbytes -
(alignptr % (unsigned long) m->triangles.alignbytes))

Definition at line 4246 of file triangle.cpp.

m dummytribase
Initial value:
= (triangle *) trimalloc(trianglebytes +
m->triangles.alignbytes)

Definition at line 4284 of file triangle.cpp.

REAL dxa
Initial value:
{
vertex leftvertex, rightvertex

Definition at line 10541 of file triangle.cpp.

dyoa
Initial value:
{
REAL dxoa, dxda, dxod

Definition at line 1454 of file triangle.cpp.

else
Initial value:
{
return 0

Definition at line 1476 of file triangle.cpp.

encodedtri
Initial value:
{
struct otri searchtri1, searchtri2

Definition at line 12343 of file triangle.cpp.

vertex endpoint1
Initial value:
{
struct osub opposubseg

Definition at line 11781 of file triangle.cpp.

eventheap
Initial value:
= (struct event **) trimalloc(maxevents *
(int) sizeof(struct event *))

Definition at line 10499 of file triangle.cpp.

int eventnum
Initial value:
{
REAL eventx, eventy

Definition at line 10362 of file triangle.cpp.

vertex eventvertex
Initial value:
{
struct event *deadevent

Definition at line 10616 of file triangle.cpp.

exponent
Initial value:
{
REAL length, multiplier

Definition at line 6993 of file triangle.cpp.

struct otri fartri
Initial value:
{
struct otri neartri

Definition at line 12122 of file triangle.cpp.

char* firsttri
Initial value:
{
VOID **sampleblock

Definition at line 7728 of file triangle.cpp.

foundvertex
Initial value:
{
VOID **getblock

Definition at line 4667 of file triangle.cpp.

REAL hh
Initial value:
{
INEXACT REAL Q, sum

Definition at line 5054 of file triangle.cpp.

long holenumber
Initial value:
{
FILE *outfile

Definition at line 14752 of file triangle.cpp.

struct otri hullleft hullright
Initial value:
{
vertex *sortarray

Definition at line 10062 of file triangle.cpp.

struct otri innerleft innerright
Initial value:
{
struct otri midtri, tri1, tri2, tri3

Definition at line 9508 of file triangle.cpp.

struct otri firstedge lastedge
Initial value:
{
struct otri countingtri

Definition at line 8942 of file triangle.cpp.

return lefttree
Initial value:
{
struct splaynode *child, *grandchild

Definition at line 10650 of file triangle.cpp.

triangledeinit & m
Initial value:
{
poolzero(&m->vertices)

Definition at line 4714 of file triangle.cpp.

maxevents
Initial value:
{
vertex thisvertex

Definition at line 10504 of file triangle.cpp.

meshnumber
Initial value:
{
#define STARTINDEX
int increment

Definition at line 3372 of file triangle.cpp.

struct otri neighbor
Initial value:
{
struct otri testtri

Definition at line 12748 of file triangle.cpp.

struct osub newsubseg
Initial value:
{
struct otri oppotri

Definition at line 4542 of file triangle.cpp.

struct otri nexttri
Initial value:
{
struct otri hulltri

Definition at line 11231 of file triangle.cpp.

struct otri oppotri oppooppotri
Initial value:
{
struct otri triangleloop

Definition at line 6784 of file triangle.cpp.

struct otri oppotri
Initial value:
{
struct otri triangleloop

Definition at line 6883 of file triangle.cpp.

vertex p[3]
Initial value:
{
struct otri triangleloop

Definition at line 15433 of file triangle.cpp.

REAL permanent
Initial value:
= (Absolute(bdxcdy) + Absolute(cdxbdy)) * alift
+ (Absolute(cdxady) + Absolute(adxcdy)) * blift
+ (Absolute(adxbdy) + Absolute(bdxady)) * clift

Definition at line 5395 of file triangle.cpp.

int pivot
Initial value:
{
int left, right

Definition at line 9290 of file triangle.cpp.

struct osub printsh
Initial value:
{
struct otri printtri

Definition at line 3756 of file triangle.cpp.

triangle ptr
Initial value:
{
int farrightflag

Definition at line 6789 of file triangle.cpp.

INEXACT REAL Qnew
Initial value:
{
REAL Q

Definition at line 5051 of file triangle.cpp.

REAL * regionlist
Initial value:
{
REAL *holelist

Definition at line 13070 of file triangle.cpp.

samplesleft
Initial value:
= (m->samples * m->triangles.itemsfirstblock - 1) /
m->triangles.maxitems + 1

Definition at line 7736 of file triangle.cpp.

searchdist
Initial value:
= (searchpoint[0] - torg[0]) * (searchpoint[0] - torg[0]) +
(searchpoint[1] - torg[1]) * (searchpoint[1] - torg[1])

Definition at line 7734 of file triangle.cpp.

struct otri searchedge
Initial value:
{
struct otri deadtriangle

Definition at line 10215 of file triangle.cpp.

vertex startvertex
Initial value:
{
struct otri checktri

Definition at line 11685 of file triangle.cpp.

struct osub testsub
Initial value:
{
struct otri tri1, tri2

Definition at line 7303 of file triangle.cpp.

struct osub testsym
Initial value:
{
struct otri neighbortri

Definition at line 7191 of file triangle.cpp.

struct otri testtri
Initial value:
{
struct otri enctri

Definition at line 7298 of file triangle.cpp.

struct otri top
Initial value:
{
struct otri horiz

Definition at line 8004 of file triangle.cpp.

struct otri botleft botright topright
Initial value:
{
struct otri botleft, botright

Definition at line 8003 of file triangle.cpp.

struct otri triangleloop
Initial value:
{
struct otri searchtri

Definition at line 11223 of file triangle.cpp.

vertex triorg
Initial value:
{
struct otri triangleloop

Definition at line 6785 of file triangle.cpp.

trisize
Initial value:
= ((b->order + 1) * (b->order + 2) / 2 + (m->highorderindex - 3)) *
sizeof(triangle)

Definition at line 4409 of file triangle.cpp.

struct otri triangleloop trisym
Initial value:
{
FILE *outfile

Definition at line 14900 of file triangle.cpp.

vertexarray
Initial value:
= (triangle *) trimalloc(m->vertices.items *
(int) sizeof(triangle))

Definition at line 11229 of file triangle.cpp.

vertex vertexloop
Initial value:
{
struct otri starttri

Definition at line 10312 of file triangle.cpp.

m vertexmarkindex
Initial value:
= ((m->mesh_dim + m->nextras) * sizeof(REAL) +
sizeof(int) - 1) /
sizeof(int)

Definition at line 4363 of file triangle.cpp.

width
Initial value:
{
struct otri inftri

Definition at line 10147 of file triangle.cpp.