libelas
Classes | Macros | Typedefs | Enumerations | Functions | Variables
triangle.cpp File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdexcept>
#include "triangle.h"

Classes

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

Macros

#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 /* Number of encroached subsegments allocated at once. */
 
#define BADTRIPERBLOCK   4092 /* Number of skinny triangles allocated at once. */
 
#define FLIPSTACKERPERBLOCK   252 /* Number of flipped triangles allocated at once. */
 
#define SPLAYNODEPERBLOCK   508 /* Number of splay tree nodes allocated at once. */
 
#define INPUTVERTEX   0
 
#define SEGMENTVERTEX   1
 
#define FREEVERTEX   2
 
#define DEADVERTEX   -32768
 
#define UNDEADVERTEX   -32767
 
#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)   ((float *) (otri).tri)[m->elemattribindex + (attnum)]
 
#define setelemattribute(otri, attnum, value)   ((float *) (otri).tri)[m->elemattribindex + (attnum)] = value
 
#define areabound(otri)   ((float *) (otri).tri)[m->areaboundindex]
 
#define setareabound(otri, value)   ((float *) (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 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 float ** triangle
 
typedef float ** subseg
 
typedef float * vertex
 

Enumerations

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

Functions

void triexit (int status)
 
int * trimalloc (int size)
 
void trifree (int *memptr)
 
void internalerror ()
 
void parsecommandline (int argc, char **argv, struct behavior *b)
 
void printtriangle (struct mesh *m, struct behavior *b, struct otri *t)
 
void printsubseg (struct mesh *m, struct behavior *b, struct osub *s)
 
void poolzero (struct memorypool *pool)
 
void poolrestart (struct memorypool *pool)
 
void poolinit (struct memorypool *pool, int bytecount, int itemcount, int firstitemcount, int alignment)
 
void pooldeinit (struct memorypool *pool)
 
int * poolalloc (struct memorypool *pool)
 
void pooldealloc (struct memorypool *pool, int *dyingitem)
 
void traversalinit (struct memorypool *pool)
 
int * traverse (struct memorypool *pool)
 
void dummyinit (struct mesh *m, struct behavior *b, int trianglebytes, int subsegbytes)
 
void initializevertexpool (struct mesh *m, struct behavior *b)
 
void initializetrisubpools (struct mesh *m, struct behavior *b)
 
void triangledealloc (struct mesh *m, triangle *dyingtriangle)
 
triangletriangletraverse (struct mesh *m)
 
void subsegdealloc (struct mesh *m, subseg *dyingsubseg)
 
subsegsubsegtraverse (struct mesh *m)
 
void vertexdealloc (struct mesh *m, vertex dyingvertex)
 
vertex vertextraverse (struct mesh *m)
 
vertex getvertex (struct mesh *m, struct behavior *b, int number)
 
void triangledeinit (struct mesh *m, struct behavior *b)
 
void maketriangle (struct mesh *m, struct behavior *b, struct otri *newotri)
 
void makesubseg (struct mesh *m, struct osub *newsubseg)
 
void exactinit ()
 
int fast_expansion_sum_zeroelim (int elen, float *e, int flen, float *f, float *h)
 
int scale_expansion_zeroelim (int elen, float *e, float b, float *h)
 
float estimate (int elen, float *e)
 
float counterclockwiseadapt (vertex pa, vertex pb, vertex pc, float detsum)
 
float counterclockwise (struct mesh *m, struct behavior *b, vertex pa, vertex pb, vertex pc)
 
float incircleadapt (vertex pa, vertex pb, vertex pc, vertex pd, float permanent)
 
float incircle (struct mesh *m, struct behavior *b, vertex pa, vertex pb, vertex pc, vertex pd)
 
float orient3dadapt (vertex pa, vertex pb, vertex pc, vertex pd, float aheight, float bheight, float cheight, float dheight, float permanent)
 
float orient3d (struct mesh *m, struct behavior *b, vertex pa, vertex pb, vertex pc, vertex pd, float aheight, float bheight, float cheight, float dheight)
 
float nonregular (struct mesh *m, struct behavior *b, vertex pa, vertex pb, vertex pc, vertex pd)
 
void findcircumcenter (struct mesh *m, struct behavior *b, vertex torg, vertex tdest, vertex tapex, vertex circumcenter, float *xi, float *eta, int offcenter)
 
void triangleinit (struct mesh *m)
 
unsigned long randomnation (unsigned int choices)
 
void makevertexmap (struct mesh *m, struct behavior *b)
 
enum locateresult preciselocate (struct mesh *m, struct behavior *b, vertex searchpoint, struct otri *searchtri, int stopatsubsegment)
 
enum locateresult locate (struct mesh *m, struct behavior *b, vertex searchpoint, struct otri *searchtri)
 
void insertsubseg (struct mesh *m, struct behavior *b, struct otri *tri, int subsegmark)
 
void flip (struct mesh *m, struct behavior *b, struct otri *flipedge)
 
void unflip (struct mesh *m, struct behavior *b, struct otri *flipedge)
 
enum insertvertexresult insertvertex (struct mesh *m, struct behavior *b, vertex newvertex, struct otri *searchtri, struct osub *splitseg, int segmentflaws, int triflaws)
 
void triangulatepolygon (struct mesh *m, struct behavior *b, struct otri *firstedge, struct otri *lastedge, int edgecount, int doflip, int triflaws)
 
void vertexsort (vertex *sortarray, int arraysize)
 
void vertexmedian (vertex *sortarray, int arraysize, int median, int axis)
 
void alternateaxes (vertex *sortarray, int arraysize, int axis)
 
void mergehulls (struct mesh *m, struct behavior *b, struct otri *farleft, struct otri *innerleft, struct otri *innerright, struct otri *farright, int axis)
 
void divconqrecurse (struct mesh *m, struct behavior *b, vertex *sortarray, int vertices, int axis, struct otri *farleft, struct otri *farright)
 
long removeghosts (struct mesh *m, struct behavior *b, struct otri *startghost)
 
long divconqdelaunay (struct mesh *m, struct behavior *b)
 
long delaunay (struct mesh *m, struct behavior *b)
 
enum finddirectionresult finddirection (struct mesh *m, struct behavior *b, struct otri *searchtri, vertex searchpoint)
 
void segmentintersection (struct mesh *m, struct behavior *b, struct otri *splittri, struct osub *splitsubseg, vertex endpoint2)
 
int scoutsegment (struct mesh *m, struct behavior *b, struct otri *searchtri, vertex endpoint2, int newmark)
 
void delaunayfixup (struct mesh *m, struct behavior *b, struct otri *fixuptri, int leftside)
 
void constrainededge (struct mesh *m, struct behavior *b, struct otri *starttri, vertex endpoint2, int newmark)
 
void insertsegment (struct mesh *m, struct behavior *b, vertex endpoint1, vertex endpoint2, int newmark)
 
void markhull (struct mesh *m, struct behavior *b)
 
void formskeleton (struct mesh *m, struct behavior *b, int *segmentlist, int *segmentmarkerlist, int numberofsegments)
 
void infecthull (struct mesh *m, struct behavior *b)
 
void plague (struct mesh *m, struct behavior *b)
 
void regionplague (struct mesh *m, struct behavior *b, float attribute, float area)
 
void carveholes (struct mesh *m, struct behavior *b, float *holelist, int holes, float *regionlist, int regions)
 
void highorder (struct mesh *m, struct behavior *b)
 
void transfernodes (struct mesh *m, struct behavior *b, float *pointlist, float *pointattriblist, int *pointmarkerlist, int numberofpoints, int numberofpointattribs)
 
void writenodes (struct mesh *m, struct behavior *b, float **pointlist, float **pointattriblist, int **pointmarkerlist)
 
void numbernodes (struct mesh *m, struct behavior *b)
 
void writeelements (struct mesh *m, struct behavior *b, int **trianglelist, float **triangleattriblist)
 
void writepoly (struct mesh *m, struct behavior *b, int **segmentlist, int **segmentmarkerlist)
 
void writeedges (struct mesh *m, struct behavior *b, int **edgelist, int **edgemarkerlist)
 
void writevoronoi (struct mesh *m, struct behavior *b, float **vpointlist, float **vpointattriblist, int **vpointmarkerlist, int **vedgelist, int **vedgemarkerlist, float **vnormlist)
 
void writeneighbors (struct mesh *m, struct behavior *b, int **neighborlist)
 
void quality_statistics (struct mesh *m, struct behavior *b)
 
void statistics (struct mesh *m, struct behavior *b)
 
void triangulate (char *triswitches, struct triangulateio *in, struct triangulateio *out, struct triangulateio *vorout)
 

Variables

float splitter
 
float epsilon
 
float resulterrbound
 
float ccwerrboundA
 
float ccwerrboundB
 
float ccwerrboundC
 
float iccerrboundA
 
float iccerrboundB
 
float iccerrboundC
 
float o3derrboundA
 
float o3derrboundB
 
float o3derrboundC
 
unsigned long randomseed
 
int plus1mod3 [3] = {1, 2, 0}
 
int minus1mod3 [3] = {2, 0, 1}
 

Macro Definition Documentation

◆ Absolute

#define Absolute (   a)    ((a) >= 0.0 ? (a) : -(a))

◆ apex

#define apex (   otri,
  vertexptr 
)    vertexptr = (vertex) (otri).tri[(otri).orient + 3]

◆ areabound

#define areabound (   otri)    ((float *) (otri).tri)[m->areaboundindex]

◆ BADSUBSEGPERBLOCK

#define BADSUBSEGPERBLOCK   252 /* Number of encroached subsegments allocated at once. */

◆ BADTRIPERBLOCK

#define BADTRIPERBLOCK   4092 /* Number of skinny triangles allocated at once. */

◆ bond

#define bond (   otri1,
  otri2 
)
Value:
(otri1).tri[(otri1).orient] = encode(otri2); \
(otri2).tri[(otri2).orient] = encode(otri1)
#define encode(otri)
Definition: triangle.cpp:832

◆ deadsubseg

#define deadsubseg (   sub)    ((sub)[1] == (subseg) NULL)

◆ deadtri

#define deadtri (   tria)    ((tria)[1] == (triangle) NULL)

◆ DEADVERTEX

#define DEADVERTEX   -32768

◆ decode

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

◆ dest

#define dest (   otri,
  vertexptr 
)    vertexptr = (vertex) (otri).tri[minus1mod3[(otri).orient] + 3]

◆ dissolve

#define dissolve (   otri)    (otri).tri[(otri).orient] = (triangle) m->dummytri

◆ dnext

#define dnext (   otri1,
  otri2 
)
Value:
sym(otri1, otri2); \
lprevself(otri2);
#define sym(otri1, otri2)
Definition: triangle.cpp:843

◆ dnextself

#define dnextself (   otri)
Value:
lprevself(otri);
Definition: triangle.cpp:411
#define symself(otri)
Definition: triangle.cpp:847

◆ dprev

#define dprev (   otri1,
  otri2 
)
Value:
lnext(otri1, otri2); \
symself(otri2);
#define lnext(otri1, otri2)
Definition: triangle.cpp:853

◆ dprevself

#define dprevself (   otri)
Value:
symself(otri);
Definition: triangle.cpp:411
#define lnextself(otri)
Definition: triangle.cpp:857

◆ elemattribute

#define elemattribute (   otri,
  attnum 
)    ((float *) (otri).tri)[m->elemattribindex + (attnum)]

◆ encode

#define encode (   otri)    (triangle) ((unsigned long) (otri).tri | (unsigned long) (otri).orient)

◆ Fast_Two_Sum

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

◆ Fast_Two_Sum_Tail

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

◆ FILENAMESIZE

#define FILENAMESIZE   2048

◆ FLIPSTACKERPERBLOCK

#define FLIPSTACKERPERBLOCK   252 /* Number of flipped triangles allocated at once. */

◆ FREEVERTEX

#define FREEVERTEX   2

◆ infect

#define infect (   otri)
Value:
(otri).tri[6] = (triangle) \
((unsigned long) (otri).tri[6] | (unsigned long) 2l)
float ** triangle
Definition: triangle.cpp:404
Definition: triangle.cpp:411

◆ infected

#define infected (   otri)    (((unsigned long) (otri).tri[6] & (unsigned long) 2l) != 0l)

◆ INPUTLINESIZE

#define INPUTLINESIZE   1024

◆ INPUTVERTEX

#define INPUTVERTEX   0

◆ killsubseg

#define killsubseg (   sub)
Value:
(sub)[1] = (subseg) NULL; \
(sub)[2] = (subseg) NULL
float ** subseg
Definition: triangle.cpp:421

◆ killtri

#define killtri (   tria)
Value:
(tria)[1] = (triangle) NULL; \
(tria)[3] = (triangle) NULL
float ** triangle
Definition: triangle.cpp:404

◆ lnext

#define lnext (   otri1,
  otri2 
)
Value:
(otri2).tri = (otri1).tri; \
(otri2).orient = plus1mod3[(otri1).orient]
int plus1mod3[3]
Definition: triangle.cpp:813

◆ lnextself

#define lnextself (   otri)    (otri).orient = plus1mod3[(otri).orient]

◆ lprev

#define lprev (   otri1,
  otri2 
)
Value:
(otri2).tri = (otri1).tri; \
(otri2).orient = minus1mod3[(otri1).orient]
int minus1mod3[3]
Definition: triangle.cpp:814

◆ lprevself

#define lprevself (   otri)    (otri).orient = minus1mod3[(otri).orient]

◆ mark

#define mark (   osub)    (* (int *) ((osub).ss + 8))

◆ ONETHIRD

#define ONETHIRD   0.333333333333333333333333333333333333333333333333333333333333

◆ onext

#define onext (   otri1,
  otri2 
)
Value:
lprev(otri1, otri2); \
symself(otri2);
#define lprev(otri1, otri2)
Definition: triangle.cpp:862

◆ onextself

#define onextself (   otri)
Value:
symself(otri);
Definition: triangle.cpp:411
#define lprevself(otri)
Definition: triangle.cpp:866

◆ oprev

#define oprev (   otri1,
  otri2 
)
Value:
sym(otri1, otri2); \
lnextself(otri2);
#define sym(otri1, otri2)
Definition: triangle.cpp:843

◆ oprevself

#define oprevself (   otri)
Value:
lnextself(otri);
Definition: triangle.cpp:411
#define symself(otri)
Definition: triangle.cpp:847

◆ org

#define org (   otri,
  vertexptr 
)    vertexptr = (vertex) (otri).tri[plus1mod3[(otri).orient] + 3]

◆ otricopy

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

◆ otriequal

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

◆ PI

#define PI   3.141592653589793238462643383279502884197169399375105820974944592308

◆ rnext

#define rnext (   otri1,
  otri2 
)
Value:
sym(otri1, otri2); \
lnextself(otri2); \
symself(otri2);
#define sym(otri1, otri2)
Definition: triangle.cpp:843

◆ rnextself

#define rnextself (   otri)
Value:
lnextself(otri); \
symself(otri);
Definition: triangle.cpp:411
#define symself(otri)
Definition: triangle.cpp:847

◆ rprev

#define rprev (   otri1,
  otri2 
)
Value:
sym(otri1, otri2); \
lprevself(otri2); \
symself(otri2);
#define sym(otri1, otri2)
Definition: triangle.cpp:843

◆ rprevself

#define rprevself (   otri)
Value:
lprevself(otri); \
symself(otri);
Definition: triangle.cpp:411
#define symself(otri)
Definition: triangle.cpp:847

◆ SAMPLEFACTOR

#define SAMPLEFACTOR   11

◆ SAMPLERATE

#define SAMPLERATE   10

◆ sbond

#define sbond (   osub1,
  osub2 
)
Value:
(osub1).ss[(osub1).ssorient] = sencode(osub2); \
(osub2).ss[(osub2).ssorient] = sencode(osub1)
#define sencode(osub)
Definition: triangle.cpp:1052

◆ sdecode

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

◆ sdest

#define sdest (   osub,
  vertexptr 
)    vertexptr = (vertex) (osub).ss[3 - (osub).ssorient]

◆ sdissolve

#define sdissolve (   osub)    (osub).ss[(osub).ssorient] = (subseg) m->dummysub

◆ segdest

#define segdest (   osub,
  vertexptr 
)    vertexptr = (vertex) (osub).ss[5 - (osub).ssorient]

◆ SEGMENTVERTEX

#define SEGMENTVERTEX   1

◆ segorg

#define segorg (   osub,
  vertexptr 
)    vertexptr = (vertex) (osub).ss[4 + (osub).ssorient]

◆ sencode

#define sencode (   osub)    (subseg) ((unsigned long) (osub).ss | (unsigned long) (osub).ssorient)

◆ setapex

#define setapex (   otri,
  vertexptr 
)    (otri).tri[(otri).orient + 3] = (triangle) vertexptr

◆ setareabound

#define setareabound (   otri,
  value 
)    ((float *) (otri).tri)[m->areaboundindex] = value

◆ setdest

#define setdest (   otri,
  vertexptr 
)    (otri).tri[minus1mod3[(otri).orient] + 3] = (triangle) vertexptr

◆ setelemattribute

#define setelemattribute (   otri,
  attnum,
  value 
)    ((float *) (otri).tri)[m->elemattribindex + (attnum)] = value

◆ setmark

#define setmark (   osub,
  value 
)    * (int *) ((osub).ss + 8) = value

◆ setorg

#define setorg (   otri,
  vertexptr 
)    (otri).tri[plus1mod3[(otri).orient] + 3] = (triangle) vertexptr

◆ setsdest

#define setsdest (   osub,
  vertexptr 
)    (osub).ss[3 - (osub).ssorient] = (subseg) vertexptr

◆ setsegdest

#define setsegdest (   osub,
  vertexptr 
)    (osub).ss[5 - (osub).ssorient] = (subseg) vertexptr

◆ setsegorg

#define setsegorg (   osub,
  vertexptr 
)    (osub).ss[4 + (osub).ssorient] = (subseg) vertexptr

◆ setsorg

#define setsorg (   osub,
  vertexptr 
)    (osub).ss[2 + (osub).ssorient] = (subseg) vertexptr

◆ setvertex2tri

#define setvertex2tri (   vx,
  value 
)    ((triangle *) (vx))[m->vertex2triindex] = value

◆ setvertexmark

#define setvertexmark (   vx,
  value 
)    ((int *) (vx))[m->vertexmarkindex] = value

◆ setvertextype

#define setvertextype (   vx,
  value 
)    ((int *) (vx))[m->vertexmarkindex + 1] = value

◆ snext

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

◆ snextself

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

◆ sorg

#define sorg (   osub,
  vertexptr 
)    vertexptr = (vertex) (osub).ss[2 + (osub).ssorient]

◆ spivot

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

◆ spivotself

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

◆ SPLAYNODEPERBLOCK

#define SPLAYNODEPERBLOCK   508 /* Number of splay tree nodes allocated at once. */

◆ Split

#define Split (   a,
  ahi,
  alo 
)
Value:
c = (float) (splitter * a); \
abig = (float) (c - a); \
ahi = c - abig; \
alo = a - ahi
float splitter
Definition: triangle.cpp:542

◆ Square

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

◆ Square_Tail

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

◆ SQUAREROOTTWO

#define SQUAREROOTTWO   1.4142135623730950488016887242096980785696718753769480732

◆ ssym

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

◆ ssymself

#define ssymself (   osub)    (osub).ssorient = 1 - (osub).ssorient

◆ stdissolve

#define stdissolve (   osub)    (osub).ss[6 + (osub).ssorient] = (subseg) m->dummytri

◆ stpivot

#define stpivot (   osub,
  otri 
)
Value:
ptr = (triangle) (osub).ss[6 + (osub).ssorient]; \
decode(ptr, otri)
float ** triangle
Definition: triangle.cpp:404
Definition: triangle.cpp:411
Definition: triangle.cpp:428

◆ subsegcopy

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

◆ subsegequal

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

◆ SUBSEGPERBLOCK

#define SUBSEGPERBLOCK   508 /* Number of subsegments allocated at once. */

◆ sym

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

◆ symself

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

◆ TRIPERBLOCK

#define TRIPERBLOCK   4092 /* Number of triangles allocated at once. */

◆ tsbond

#define tsbond (   otri,
  osub 
)
Value:
(otri).tri[6 + (otri).orient] = (triangle) sencode(osub); \
(osub).ss[6 + (osub).ssorient] = (subseg) encode(otri)
float ** triangle
Definition: triangle.cpp:404
Definition: triangle.cpp:411
Definition: triangle.cpp:428
float ** subseg
Definition: triangle.cpp:421
#define encode(otri)
Definition: triangle.cpp:832
#define sencode(osub)
Definition: triangle.cpp:1052

◆ tsdissolve

#define tsdissolve (   otri)    (otri).tri[6 + (otri).orient] = (triangle) m->dummysub

◆ tspivot

#define tspivot (   otri,
  osub 
)
Value:
sptr = (subseg) (otri).tri[6 + (otri).orient]; \
sdecode(sptr, osub)
Definition: triangle.cpp:411
Definition: triangle.cpp:428
float ** subseg
Definition: triangle.cpp:421

◆ Two_Diff

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

◆ Two_Diff_Tail

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

◆ Two_One_Diff

#define Two_One_Diff (   a1,
  a0,
  b,
  x2,
  x1,
  x0 
)
Value:
Two_Diff(a0, b , _i, x0); \
Two_Sum( a1, _i, x2, x1)
#define Two_Diff(a, b, x, y)
Definition: triangle.cpp:2322

◆ Two_One_Product

#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)
#define Split(a, ahi, alo)
Definition: triangle.cpp:2326

◆ Two_One_Sum

#define Two_One_Sum (   a1,
  a0,
  b,
  x2,
  x1,
  x0 
)
Value:
Two_Sum(a0, b , _i, x0); \
Two_Sum(a1, _i, x2, x1)
#define Two_Sum(a, b, x, y)
Definition: triangle.cpp:2311

◆ Two_Product

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

◆ Two_Product_Presplit

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

◆ Two_Product_Tail

#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
#define Split(a, ahi, alo)
Definition: triangle.cpp:2326

◆ Two_Sum

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

◆ Two_Sum_Tail

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

◆ Two_Two_Diff

#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)
#define Two_One_Diff(a1, a0, b, x2, x1, x0)
Definition: triangle.cpp:2374

◆ Two_Two_Sum

#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)
#define Two_One_Sum(a1, a0, b, x2, x1, x0)
Definition: triangle.cpp:2370

◆ UNDEADVERTEX

#define UNDEADVERTEX   -32767

◆ uninfect

#define uninfect (   otri)
Value:
(otri).tri[6] = (triangle) \
((unsigned long) (otri).tri[6] & ~ (unsigned long) 2l)
float ** triangle
Definition: triangle.cpp:404
Definition: triangle.cpp:411

◆ vertex2tri

#define vertex2tri (   vx)    ((triangle *) (vx))[m->vertex2triindex]

◆ vertexmark

#define vertexmark (   vx)    ((int *) (vx))[m->vertexmarkindex]

◆ VERTEXPERBLOCK

#define VERTEXPERBLOCK   4092 /* Number of vertices allocated at once. */

◆ vertextype

#define vertextype (   vx)    ((int *) (vx))[m->vertexmarkindex + 1]

◆ VIRUSPERBLOCK

#define VIRUSPERBLOCK   1020 /* Number of virus triangles allocated at once. */

Typedef Documentation

◆ subseg

typedef float** subseg

◆ triangle

typedef float** triangle

◆ vertex

typedef float* vertex

Enumeration Type Documentation

◆ finddirectionresult

Enumerator
WITHIN 
LEFTCOLLINEAR 
RIGHTCOLLINEAR 

◆ insertvertexresult

Enumerator
SUCCESSFULVERTEX 
ENCROACHINGVERTEX 
VIOLATINGVERTEX 
DUPLICATEVERTEX 

◆ locateresult

Enumerator
INTRIANGLE 
ONEDGE 
ONVERTEX 
OUTSIDE 

Function Documentation

◆ alternateaxes()

void alternateaxes ( vertex sortarray,
int  arraysize,
int  axis 
)

◆ carveholes()

void carveholes ( struct mesh m,
struct behavior b,
float *  holelist,
int  holes,
float *  regionlist,
int  regions 
)

◆ constrainededge()

void constrainededge ( struct mesh m,
struct behavior b,
struct otri starttri,
vertex  endpoint2,
int  newmark 
)

◆ counterclockwise()

float counterclockwise ( struct mesh m,
struct behavior b,
vertex  pa,
vertex  pb,
vertex  pc 
)

◆ counterclockwiseadapt()

float counterclockwiseadapt ( vertex  pa,
vertex  pb,
vertex  pc,
float  detsum 
)

◆ delaunay()

long delaunay ( struct mesh m,
struct behavior b 
)

◆ delaunayfixup()

void delaunayfixup ( struct mesh m,
struct behavior b,
struct otri fixuptri,
int  leftside 
)

◆ divconqdelaunay()

long divconqdelaunay ( struct mesh m,
struct behavior b 
)

◆ divconqrecurse()

void divconqrecurse ( struct mesh m,
struct behavior b,
vertex sortarray,
int  vertices,
int  axis,
struct otri farleft,
struct otri farright 
)

◆ dummyinit()

void dummyinit ( struct mesh m,
struct behavior b,
int  trianglebytes,
int  subsegbytes 
)

◆ estimate()

float estimate ( int  elen,
float *  e 
)

◆ exactinit()

void exactinit ( )

◆ fast_expansion_sum_zeroelim()

int fast_expansion_sum_zeroelim ( int  elen,
float *  e,
int  flen,
float *  f,
float *  h 
)

◆ findcircumcenter()

void findcircumcenter ( struct mesh m,
struct behavior b,
vertex  torg,
vertex  tdest,
vertex  tapex,
vertex  circumcenter,
float *  xi,
float *  eta,
int  offcenter 
)

◆ finddirection()

enum finddirectionresult finddirection ( struct mesh m,
struct behavior b,
struct otri searchtri,
vertex  searchpoint 
)

◆ flip()

void flip ( struct mesh m,
struct behavior b,
struct otri flipedge 
)

◆ formskeleton()

void formskeleton ( struct mesh m,
struct behavior b,
int *  segmentlist,
int *  segmentmarkerlist,
int  numberofsegments 
)

◆ getvertex()

vertex getvertex ( struct mesh m,
struct behavior b,
int  number 
)

◆ highorder()

void highorder ( struct mesh m,
struct behavior b 
)

◆ incircle()

float incircle ( struct mesh m,
struct behavior b,
vertex  pa,
vertex  pb,
vertex  pc,
vertex  pd 
)

◆ incircleadapt()

float incircleadapt ( vertex  pa,
vertex  pb,
vertex  pc,
vertex  pd,
float  permanent 
)

◆ infecthull()

void infecthull ( struct mesh m,
struct behavior b 
)

◆ initializetrisubpools()

void initializetrisubpools ( struct mesh m,
struct behavior b 
)

◆ initializevertexpool()

void initializevertexpool ( struct mesh m,
struct behavior b 
)

◆ insertsegment()

void insertsegment ( struct mesh m,
struct behavior b,
vertex  endpoint1,
vertex  endpoint2,
int  newmark 
)

◆ insertsubseg()

void insertsubseg ( struct mesh m,
struct behavior b,
struct otri tri,
int  subsegmark 
)

◆ insertvertex()

enum insertvertexresult insertvertex ( struct mesh m,
struct behavior b,
vertex  newvertex,
struct otri searchtri,
struct osub splitseg,
int  segmentflaws,
int  triflaws 
)

◆ internalerror()

void internalerror ( )

◆ locate()

enum locateresult locate ( struct mesh m,
struct behavior b,
vertex  searchpoint,
struct otri searchtri 
)

◆ makesubseg()

void makesubseg ( struct mesh m,
struct osub newsubseg 
)

◆ maketriangle()

void maketriangle ( struct mesh m,
struct behavior b,
struct otri newotri 
)

◆ makevertexmap()

void makevertexmap ( struct mesh m,
struct behavior b 
)

◆ markhull()

void markhull ( struct mesh m,
struct behavior b 
)

◆ mergehulls()

void mergehulls ( struct mesh m,
struct behavior b,
struct otri farleft,
struct otri innerleft,
struct otri innerright,
struct otri farright,
int  axis 
)

◆ nonregular()

float nonregular ( struct mesh m,
struct behavior b,
vertex  pa,
vertex  pb,
vertex  pc,
vertex  pd 
)

◆ numbernodes()

void numbernodes ( struct mesh m,
struct behavior b 
)

◆ orient3d()

float orient3d ( struct mesh m,
struct behavior b,
vertex  pa,
vertex  pb,
vertex  pc,
vertex  pd,
float  aheight,
float  bheight,
float  cheight,
float  dheight 
)

◆ orient3dadapt()

float orient3dadapt ( vertex  pa,
vertex  pb,
vertex  pc,
vertex  pd,
float  aheight,
float  bheight,
float  cheight,
float  dheight,
float  permanent 
)

◆ parsecommandline()

void parsecommandline ( int  argc,
char **  argv,
struct behavior b 
)

◆ plague()

void plague ( struct mesh m,
struct behavior b 
)

◆ poolalloc()

int* poolalloc ( struct memorypool pool)

◆ pooldealloc()

void pooldealloc ( struct memorypool pool,
int *  dyingitem 
)

◆ pooldeinit()

void pooldeinit ( struct memorypool pool)

◆ poolinit()

void poolinit ( struct memorypool pool,
int  bytecount,
int  itemcount,
int  firstitemcount,
int  alignment 
)

◆ poolrestart()

void poolrestart ( struct memorypool pool)

◆ poolzero()

void poolzero ( struct memorypool pool)

◆ preciselocate()

enum locateresult preciselocate ( struct mesh m,
struct behavior b,
vertex  searchpoint,
struct otri searchtri,
int  stopatsubsegment 
)

◆ printsubseg()

void printsubseg ( struct mesh m,
struct behavior b,
struct osub s 
)

◆ printtriangle()

void printtriangle ( struct mesh m,
struct behavior b,
struct otri t 
)

◆ quality_statistics()

void quality_statistics ( struct mesh m,
struct behavior b 
)

◆ randomnation()

unsigned long randomnation ( unsigned int  choices)

◆ regionplague()

void regionplague ( struct mesh m,
struct behavior b,
float  attribute,
float  area 
)

◆ removeghosts()

long removeghosts ( struct mesh m,
struct behavior b,
struct otri startghost 
)

◆ scale_expansion_zeroelim()

int scale_expansion_zeroelim ( int  elen,
float *  e,
float  b,
float *  h 
)

◆ scoutsegment()

int scoutsegment ( struct mesh m,
struct behavior b,
struct otri searchtri,
vertex  endpoint2,
int  newmark 
)

◆ segmentintersection()

void segmentintersection ( struct mesh m,
struct behavior b,
struct otri splittri,
struct osub splitsubseg,
vertex  endpoint2 
)

◆ statistics()

void statistics ( struct mesh m,
struct behavior b 
)

◆ subsegdealloc()

void subsegdealloc ( struct mesh m,
subseg dyingsubseg 
)

◆ subsegtraverse()

subseg* subsegtraverse ( struct mesh m)

◆ transfernodes()

void transfernodes ( struct mesh m,
struct behavior b,
float *  pointlist,
float *  pointattriblist,
int *  pointmarkerlist,
int  numberofpoints,
int  numberofpointattribs 
)

◆ traversalinit()

void traversalinit ( struct memorypool pool)

◆ traverse()

int* traverse ( struct memorypool pool)

◆ triangledealloc()

void triangledealloc ( struct mesh m,
triangle dyingtriangle 
)

◆ triangledeinit()

void triangledeinit ( struct mesh m,
struct behavior b 
)

◆ triangleinit()

void triangleinit ( struct mesh m)

◆ triangletraverse()

triangle* triangletraverse ( struct mesh m)

◆ triangulate()

void triangulate ( char *  triswitches,
struct triangulateio in,
struct triangulateio out,
struct triangulateio vorout 
)

◆ triangulatepolygon()

void triangulatepolygon ( struct mesh m,
struct behavior b,
struct otri firstedge,
struct otri lastedge,
int  edgecount,
int  doflip,
int  triflaws 
)

◆ triexit()

void triexit ( int  status)

◆ trifree()

void trifree ( int *  memptr)

◆ trimalloc()

int* trimalloc ( int  size)

◆ unflip()

void unflip ( struct mesh m,
struct behavior b,
struct otri flipedge 
)

◆ vertexdealloc()

void vertexdealloc ( struct mesh m,
vertex  dyingvertex 
)

◆ vertexmedian()

void vertexmedian ( vertex sortarray,
int  arraysize,
int  median,
int  axis 
)

◆ vertexsort()

void vertexsort ( vertex sortarray,
int  arraysize 
)

◆ vertextraverse()

vertex vertextraverse ( struct mesh m)

◆ writeedges()

void writeedges ( struct mesh m,
struct behavior b,
int **  edgelist,
int **  edgemarkerlist 
)

◆ writeelements()

void writeelements ( struct mesh m,
struct behavior b,
int **  trianglelist,
float **  triangleattriblist 
)

◆ writeneighbors()

void writeneighbors ( struct mesh m,
struct behavior b,
int **  neighborlist 
)

◆ writenodes()

void writenodes ( struct mesh m,
struct behavior b,
float **  pointlist,
float **  pointattriblist,
int **  pointmarkerlist 
)

◆ writepoly()

void writepoly ( struct mesh m,
struct behavior b,
int **  segmentlist,
int **  segmentmarkerlist 
)

◆ writevoronoi()

void writevoronoi ( struct mesh m,
struct behavior b,
float **  vpointlist,
float **  vpointattriblist,
int **  vpointmarkerlist,
int **  vedgelist,
int **  vedgemarkerlist,
float **  vnormlist 
)

Variable Documentation

◆ ccwerrboundA

float ccwerrboundA

◆ ccwerrboundB

float ccwerrboundB

◆ ccwerrboundC

float ccwerrboundC

◆ epsilon

float epsilon

◆ iccerrboundA

float iccerrboundA

◆ iccerrboundB

float iccerrboundB

◆ iccerrboundC

float iccerrboundC

◆ minus1mod3

int minus1mod3[3] = {2, 0, 1}

◆ o3derrboundA

float o3derrboundA

◆ o3derrboundB

float o3derrboundB

◆ o3derrboundC

float o3derrboundC

◆ plus1mod3

int plus1mod3[3] = {1, 2, 0}

◆ randomseed

unsigned long randomseed

◆ resulterrbound

float resulterrbound

◆ splitter

float splitter