--- triangle-1.6.orig/debian/rules +++ triangle-1.6/debian/rules @@ -0,0 +1,53 @@ +#!/usr/bin/make -f + +clean: stamp-patch + dh_testdir + make distclean + if [ -e stamp-patch ]; then \ + QUILT_PATCHES=debian/patches quilt pop -a -R || test $$? = 2; \ + rm -f stamp-patch; \ + fi + rm -f stamp-* +# This is left by a quilt push/pop sequence + rm -rf .pc + dh_clean + +stamp-patch: + if [ ! -e stamp-patch ]; then \ + QUILT_PATCHES=debian/patches quilt push -a || test $$? = 2; \ + fi + touch $@ + +build: stamp-patch + make tricall + make triangle + make showme + ar cr libtriangle.a triangle.o + rm -f triangle.o + $(CC) -O -DLINUX -DTRILIBRARY -fPIC -DPIC -c -o triangle.o triangle.c + $(CC) -shared triangle.o -o libtriangle-1.6.so -lm -Wl,-soname,libtriangle-1.6.so + ln -s libtriangle-1.6.so libtriangle.so + +install: + +binary-indep: + +binary-arch: + dh_testdir -a + dh_testroot -a + dh_install -a + dh_installdocs -a + dh_installchangelogs -a + dh_strip -a + dh_makeshlibs -a + dh_compress -a + dh_fixperms -a + dh_installdeb -a + dh_shlibdeps -a + dh_gencontrol -a + dh_md5sums -a + dh_builddeb -a + +binary: binary-arch binary-indep + +.PHONY: binary binary-arch binary-indep clean install build --- triangle-1.6.orig/debian/control +++ triangle-1.6/debian/control @@ -0,0 +1,35 @@ +Source: triangle +Section: non-free/science +Priority: extra +Maintainer: Adam C. Powell, IV +Standards-Version: 3.8.0 +Build-Depends: debhelper (>= 3.0), quilt, libx11-dev +Homepage: http://www.cs.cmu.edu/~quake/triangle.html + +Package: libtriangle-1.6 +Section: non-free/libs +Architecture: any +Depends: ${shlibs:Depends} +Description: High-quality 2-D mesh generator shared library + Triangle is a library/program for meshing 2-D surfaces and manifolds. + . + This package contains its shared library. + +Package: libtriangle-dev +Section: non-free/libdevel +Architecture: any +Depends: libtriangle-1.6 (= ${binary:Version}), libc6-dev +Description: High-quality 2-D mesh generator development files + Triangle is a library/program for meshing 2-D surfaces and manifolds. + . + This package contains its static library, headers, and shared library symbolic + link, which are needed to compile programs using the triangle library. + +Package: triangle-bin +Section: non-free/science +Architecture: any +Depends: ${shlibs:Depends} +Description: High-quality 2-D mesh generator binary programs + Triangle is a library/program for meshing 2-D surfaces and manifolds. + . + This package contains the binary programs triangle, tricall and showme. --- triangle-1.6.orig/debian/compat +++ triangle-1.6/debian/compat @@ -0,0 +1 @@ +5 --- triangle-1.6.orig/debian/triangle-bin.docs +++ triangle-1.6/debian/triangle-bin.docs @@ -0,0 +1,2 @@ +README +A.poly --- triangle-1.6.orig/debian/libtriangle-dev.docs +++ triangle-1.6/debian/libtriangle-dev.docs @@ -0,0 +1 @@ +README --- triangle-1.6.orig/debian/copyright +++ triangle-1.6/debian/copyright @@ -0,0 +1,23 @@ +Format-Specification: http://wiki.debian.org/Proposals/CopyrightFormat +Debianized-By: Adam C. Powell, IV +Debianized-Date: Wed, 09 Jul 2008 16:15:04 -0400 +Upstream-Author: Jonathan Richard Shewchuk +Original-Source: http://www.cs.cmu.edu/~quake/triangle.html + +Files: * +Copyright: Copyright 1993, 1995, 1997, 1998, 2002, 2005 \ + Jonathan Richard Shewchuk +License: other + These programs may be freely redistributed under the condition that the + copyright notices (including the copy of this notice in the code comments + and the copyright notice printed when the `-h' switch is selected) are + not removed, and no compensation is received. Private, research, and + institutional use is free. You may distribute modified versions of this + code UNDER THE CONDITION THAT THIS CODE AND ANY MODIFICATIONS MADE TO IT + IN THE SAME FILE REMAIN UNDER COPYRIGHT OF THE ORIGINAL AUTHOR, BOTH + SOURCE AND OBJECT CODE ARE MADE FREELY AVAILABLE WITHOUT CHARGE, AND + CLEAR NOTICE IS GIVEN OF THE MODIFICATIONS. Distribution of this code as + part of a commercial system is permissible ONLY BY DIRECT ARRANGEMENT + WITH THE AUTHOR. (If you are not directly supplying this code to a + customer, and you are instead telling them how they can obtain it for + free, then you are not required to make any arrangement with me.) --- triangle-1.6.orig/debian/changelog +++ triangle-1.6/debian/changelog @@ -0,0 +1,15 @@ +triangle (1.6-2) unstable; urgency=low + + * Fixed undefined VOID in triangle.h (closes: #494716). + * Moved API structs, #defines, enums, prototypes etc. from triangle.c to + triangle.h (closes: #494717). + * Manage patches using quilt. + + -- Adam C. Powell, IV Tue, 12 Aug 2008 12:46:39 -0400 + +triangle (1.6-1) unstable; urgency=low + + * First package (closes: #490100). + + -- Adam C. Powell, IV Tue, 15 Jul 2008 18:18:03 -0400 + --- triangle-1.6.orig/debian/triangle-bin.install +++ triangle-1.6/debian/triangle-bin.install @@ -0,0 +1 @@ +triangle tricall showme usr/bin --- triangle-1.6.orig/debian/libtriangle-1.6.install +++ triangle-1.6/debian/libtriangle-1.6.install @@ -0,0 +1 @@ +libtriangle-*.so usr/lib --- triangle-1.6.orig/debian/libtriangle-dev.install +++ triangle-1.6/debian/libtriangle-dev.install @@ -0,0 +1,2 @@ +libtriangle.so libtriangle.a usr/lib +*.h usr/include --- triangle-1.6.orig/debian/patches/define-VOID.patch +++ triangle-1.6/debian/patches/define-VOID.patch @@ -0,0 +1,26 @@ +--- triangle-1.6/triangle.h~ 2005-07-28 18:33:41.000000000 +0000 ++++ triangle-1.6/triangle.h 2008-08-12 16:41:42.000000000 +0000 +@@ -279,6 +279,8 @@ + int numberofedges; /* Out only */ + }; + ++#define VOID void ++ + #ifdef ANSI_DECLARATORS + void triangulate(char *, struct triangulateio *, struct triangulateio *, + struct triangulateio *); +--- triangle-1.6/triangle.c~ 2005-07-28 22:11:32.000000000 +0000 ++++ triangle-1.6/triangle.c 2008-08-12 16:58:02.000000000 +0000 +@@ -308,12 +308,6 @@ + #define DEADVERTEX -32768 + #define UNDEADVERTEX -32767 + +-/* The next line is used to outsmart some very stupid compilers. If your */ +-/* compiler is smarter, feel free to replace the "int" with "void". */ +-/* Not that it matters. */ +- +-#define VOID int +- + /* Two constants for algorithms based on random sampling. Both constants */ + /* have been chosen empirically to optimize their respective algorithms. */ + --- triangle-1.6.orig/debian/patches/series +++ triangle-1.6/debian/patches/series @@ -0,0 +1,4 @@ +define-VOID.patch +expose-api.patch +include-always.patch +make-rm.patch --- triangle-1.6.orig/debian/patches/expose-api.patch +++ triangle-1.6/debian/patches/expose-api.patch @@ -0,0 +1,1155 @@ +--- triangle-1.6/triangle.h.old 2008-08-12 21:28:39.000000000 +0000 ++++ triangle-1.6/triangle.h 2008-08-12 21:29:30.000000000 +0000 +@@ -248,6 +248,33 @@ + /* */ + /*****************************************************************************/ + ++/* Moved here from triangle.c by Adam Powell 2006/8/12 */ ++/* Note the triangle library in the Debian package uses REAL=double */ ++/* */ ++/* For single precision (which will save some memory and reduce paging), */ ++/* define the symbol SINGLE by using the -DSINGLE compiler switch or by */ ++/* writing "#define SINGLE" below. */ ++/* */ ++/* For double precision (which will allow you to refine meshes to a smaller */ ++/* edge length), leave SINGLE undefined. */ ++/* */ ++/* Double precision uses more memory, but improves the resolution of the */ ++/* meshes you can generate with Triangle. It also reduces the likelihood */ ++/* of a floating exception due to overflow. Finally, it is much faster */ ++/* than single precision on 64-bit architectures like the DEC Alpha. I */ ++/* recommend double precision unless you want to generate a mesh for which */ ++/* you do not have enough memory. */ ++ ++/* #define SINGLE */ ++ ++/*#ifdef SINGLE ++#define REAL float ++#else /* not SINGLE */ ++#define REAL double ++/*#endif /* not SINGLE */ ++ ++#define ANSI_DECLARATORS ++ + struct triangulateio { + REAL *pointlist; /* In / out */ + REAL *pointattributelist; /* In / out */ +@@ -289,3 +316,538 @@ + void triangulate(); + void trifree(); + #endif /* not ANSI_DECLARATORS */ ++ ++/*****************************************************************************/ ++/* */ ++/* The remainder of this file is moved from triangle.c by Adam Powell */ ++/* 2006/8/12 to expose more of the API, e.g. to OpenCACSCADE. */ ++/* */ ++/*****************************************************************************/ ++ ++/* The vertex types. A DEADVERTEX has been deleted entirely. An */ ++/* UNDEADVERTEX is not part of the mesh, but is written to the output */ ++/* .node file and affects the node indexing in the other output files. */ ++ ++#define INPUTVERTEX 0 ++#define SEGMENTVERTEX 1 ++#define FREEVERTEX 2 ++#define DEADVERTEX -32768 ++#define UNDEADVERTEX -32767 ++ ++/* Maximum number of characters in a file name (including the null). */ ++ ++#define FILENAMESIZE 2048 ++ ++#include ++ ++/* Labels that signify the result of vertex insertion. The result indicates */ ++/* that the vertex was inserted with complete success, was inserted but */ ++/* encroaches upon a subsegment, was not inserted because it lies on a */ ++/* segment, or was not inserted because another vertex occupies the same */ ++/* location. */ ++ ++enum insertvertexresult {SUCCESSFULVERTEX, ENCROACHINGVERTEX, VIOLATINGVERTEX, ++ DUPLICATEVERTEX}; ++ ++/*****************************************************************************/ ++/* */ ++/* The basic mesh data structures */ ++/* */ ++/* There are three: vertices, triangles, and subsegments (abbreviated */ ++/* `subseg'). These three data structures, linked by pointers, comprise */ ++/* the mesh. A vertex simply represents a mesh vertex and its properties. */ ++/* A triangle is a triangle. A subsegment is a special data structure used */ ++/* to represent an impenetrable edge of the mesh (perhaps on the outer */ ++/* boundary, on the boundary of a hole, or part of an internal boundary */ ++/* separating two triangulated regions). Subsegments represent boundaries, */ ++/* defined by the user, that triangles may not lie across. */ ++/* */ ++/* A triangle consists of a list of three vertices, a list of three */ ++/* adjoining triangles, a list of three adjoining subsegments (when */ ++/* segments exist), an arbitrary number of optional user-defined */ ++/* floating-point attributes, and an optional area constraint. The latter */ ++/* is an upper bound on the permissible area of each triangle in a region, */ ++/* used for mesh refinement. */ ++/* */ ++/* For a triangle on a boundary of the mesh, some or all of the neighboring */ ++/* triangles may not be present. For a triangle in the interior of the */ ++/* mesh, often no neighboring subsegments are present. Such absent */ ++/* triangles and subsegments are never represented by NULL pointers; they */ ++/* are represented by two special records: `dummytri', the triangle that */ ++/* fills "outer space", and `dummysub', the omnipresent subsegment. */ ++/* `dummytri' and `dummysub' are used for several reasons; for instance, */ ++/* they can be dereferenced and their contents examined without violating */ ++/* protected memory. */ ++/* */ ++/* However, it is important to understand that a triangle includes other */ ++/* information as well. The pointers to adjoining vertices, triangles, and */ ++/* subsegments are ordered in a way that indicates their geometric relation */ ++/* to each other. Furthermore, each of these pointers contains orientation */ ++/* information. Each pointer to an adjoining triangle indicates which face */ ++/* of that triangle is contacted. Similarly, each pointer to an adjoining */ ++/* subsegment indicates which side of that subsegment is contacted, and how */ ++/* the subsegment is oriented relative to the triangle. */ ++/* */ ++/* The data structure representing a subsegment may be thought to be */ ++/* abutting the edge of one or two triangle data structures: either */ ++/* sandwiched between two triangles, or resting against one triangle on an */ ++/* exterior boundary or hole boundary. */ ++/* */ ++/* A subsegment consists of a list of four vertices--the vertices of the */ ++/* subsegment, and the vertices of the segment it is a part of--a list of */ ++/* two adjoining subsegments, and a list of two adjoining triangles. One */ ++/* of the two adjoining triangles may not be present (though there should */ ++/* always be one), and neighboring subsegments might not be present. */ ++/* Subsegments also store a user-defined integer "boundary marker". */ ++/* Typically, this integer is used to indicate what boundary conditions are */ ++/* to be applied at that location in a finite element simulation. */ ++/* */ ++/* Like triangles, subsegments maintain information about the relative */ ++/* orientation of neighboring objects. */ ++/* */ ++/* Vertices are relatively simple. A vertex is a list of floating-point */ ++/* numbers, starting with the x, and y coordinates, followed by an */ ++/* arbitrary number of optional user-defined floating-point attributes, */ ++/* followed by an integer boundary marker. During the segment insertion */ ++/* phase, there is also a pointer from each vertex to a triangle that may */ ++/* contain it. Each pointer is not always correct, but when one is, it */ ++/* speeds up segment insertion. These pointers are assigned values once */ ++/* at the beginning of the segment insertion phase, and are not used or */ ++/* updated except during this phase. Edge flipping during segment */ ++/* insertion will render some of them incorrect. Hence, don't rely upon */ ++/* them for anything. */ ++/* */ ++/* Other than the exception mentioned above, vertices have no information */ ++/* about what triangles, subfacets, or subsegments they are linked to. */ ++/* */ ++/*****************************************************************************/ ++ ++/*****************************************************************************/ ++/* */ ++/* Handles */ ++/* */ ++/* The oriented triangle (`otri') and oriented subsegment (`osub') data */ ++/* structures defined below do not themselves store any part of the mesh. */ ++/* The mesh itself is made of `triangle's, `subseg's, and `vertex's. */ ++/* */ ++/* Oriented triangles and oriented subsegments will usually be referred to */ ++/* as "handles." A handle is essentially a pointer into the mesh; it */ ++/* allows you to "hold" one particular part of the mesh. Handles are used */ ++/* to specify the regions in which one is traversing and modifying the mesh.*/ ++/* A single `triangle' may be held by many handles, or none at all. (The */ ++/* latter case is not a memory leak, because the triangle is still */ ++/* connected to other triangles in the mesh.) */ ++/* */ ++/* An `otri' is a handle that holds a triangle. It holds a specific edge */ ++/* of the triangle. An `osub' is a handle that holds a subsegment. It */ ++/* holds either the left or right side of the subsegment. */ ++/* */ ++/* Navigation about the mesh is accomplished through a set of mesh */ ++/* manipulation primitives, further below. Many of these primitives take */ ++/* a handle and produce a new handle that holds the mesh near the first */ ++/* handle. Other primitives take two handles and glue the corresponding */ ++/* parts of the mesh together. The orientation of the handles is */ ++/* important. For instance, when two triangles are glued together by the */ ++/* bond() primitive, they are glued at the edges on which the handles lie. */ ++/* */ ++/* Because vertices have no information about which triangles they are */ ++/* attached to, I commonly represent a vertex by use of a handle whose */ ++/* origin is the vertex. A single handle can simultaneously represent a */ ++/* triangle, an edge, and a vertex. */ ++/* */ ++/*****************************************************************************/ ++ ++/* The triangle data structure. Each triangle contains three pointers to */ ++/* adjoining triangles, plus three pointers to vertices, plus three */ ++/* pointers to subsegments (declared below; these pointers are usually */ ++/* `dummysub'). It may or may not also contain user-defined attributes */ ++/* and/or a floating-point "area constraint." It may also contain extra */ ++/* pointers for nodes, when the user asks for high-order elements. */ ++/* Because the size and structure of a `triangle' is not decided until */ ++/* runtime, I haven't simply declared the type `triangle' as a struct. */ ++ ++typedef REAL **triangle; /* Really: typedef triangle *triangle */ ++ ++/* An oriented triangle: includes a pointer to a triangle and orientation. */ ++/* The orientation denotes an edge of the triangle. Hence, there are */ ++/* three possible orientations. By convention, each edge always points */ ++/* counterclockwise about the corresponding triangle. */ ++ ++struct otri { ++ triangle *tri; ++ int orient; /* Ranges from 0 to 2. */ ++}; ++ ++/* The subsegment data structure. Each subsegment contains two pointers to */ ++/* adjoining subsegments, plus four pointers to vertices, plus two */ ++/* pointers to adjoining triangles, plus one boundary marker, plus one */ ++/* segment number. */ ++ ++typedef REAL **subseg; /* Really: typedef subseg *subseg */ ++ ++/* An oriented subsegment: includes a pointer to a subsegment and an */ ++/* orientation. The orientation denotes a side of the edge. Hence, there */ ++/* are two possible orientations. By convention, the edge is always */ ++/* directed so that the "side" denoted is the right side of the edge. */ ++ ++struct osub { ++ subseg *ss; ++ int ssorient; /* Ranges from 0 to 1. */ ++}; ++ ++/* The vertex data structure. Each vertex is actually an array of REALs. */ ++/* The number of REALs is unknown until runtime. An integer boundary */ ++/* marker, and sometimes a pointer to a triangle, is appended after the */ ++/* REALs. */ ++ ++typedef REAL *vertex; ++ ++/* A queue used to store encroached subsegments. Each subsegment's vertices */ ++/* are stored so that we can check whether a subsegment is still the same. */ ++ ++struct badsubseg { ++ subseg encsubseg; /* An encroached subsegment. */ ++ vertex subsegorg, subsegdest; /* Its two vertices. */ ++}; ++ ++/* A queue used to store bad triangles. The key is the square of the cosine */ ++/* of the smallest angle of the triangle. Each triangle's vertices are */ ++/* stored so that one can check whether a triangle is still the same. */ ++ ++struct badtriang { ++ triangle poortri; /* A skinny or too-large triangle. */ ++ REAL key; /* cos^2 of smallest (apical) angle. */ ++ vertex triangorg, triangdest, triangapex; /* Its three vertices. */ ++ struct badtriang *nexttriang; /* Pointer to next bad triangle. */ ++}; ++ ++/* A stack of triangles flipped during the most recent vertex insertion. */ ++/* The stack is used to undo the vertex insertion if the vertex encroaches */ ++/* upon a subsegment. */ ++ ++struct flipstacker { ++ triangle flippedtri; /* A recently flipped triangle. */ ++ struct flipstacker *prevflip; /* Previous flip in the stack. */ ++}; ++ ++/* A node in a heap used to store events for the sweepline Delaunay */ ++/* algorithm. Nodes do not point directly to their parents or children in */ ++/* the heap. Instead, each node knows its position in the heap, and can */ ++/* look up its parent and children in a separate array. The `eventptr' */ ++/* points either to a `vertex' or to a triangle (in encoded format, so */ ++/* that an orientation is included). In the latter case, the origin of */ ++/* the oriented triangle is the apex of a "circle event" of the sweepline */ ++/* algorithm. To distinguish site events from circle events, all circle */ ++/* events are given an invalid (smaller than `xmin') x-coordinate `xkey'. */ ++ ++struct event { ++ REAL xkey, ykey; /* Coordinates of the event. */ ++ VOID *eventptr; /* Can be a vertex or the location of a circle event. */ ++ int heapposition; /* Marks this event's position in the heap. */ ++}; ++ ++/* A node in the splay tree. Each node holds an oriented ghost triangle */ ++/* that represents a boundary edge of the growing triangulation. When a */ ++/* circle event covers two boundary edges with a triangle, so that they */ ++/* are no longer boundary edges, those edges are not immediately deleted */ ++/* from the tree; rather, they are lazily deleted when they are next */ ++/* encountered. (Since only a random sample of boundary edges are kept */ ++/* in the tree, lazy deletion is faster.) `keydest' is used to verify */ ++/* that a triangle is still the same as when it entered the splay tree; if */ ++/* it has been rotated (due to a circle event), it no longer represents a */ ++/* boundary edge and should be deleted. */ ++ ++struct splaynode { ++ struct otri keyedge; /* Lprev of an edge on the front. */ ++ vertex keydest; /* Used to verify that splay node is still live. */ ++ struct splaynode *lchild, *rchild; /* Children in splay tree. */ ++}; ++ ++/* A type used to allocate memory. firstblock is the first block of items. */ ++/* nowblock is the block from which items are currently being allocated. */ ++/* nextitem points to the next slab of free memory for an item. */ ++/* deaditemstack is the head of a linked list (stack) of deallocated items */ ++/* that can be recycled. unallocateditems is the number of items that */ ++/* remain to be allocated from nowblock. */ ++/* */ ++/* Traversal is the process of walking through the entire list of items, and */ ++/* is separate from allocation. Note that a traversal will visit items on */ ++/* the "deaditemstack" stack as well as live items. pathblock points to */ ++/* the block currently being traversed. pathitem points to the next item */ ++/* to be traversed. pathitemsleft is the number of items that remain to */ ++/* be traversed in pathblock. */ ++/* */ ++/* alignbytes determines how new records should be aligned in memory. */ ++/* itembytes is the length of a record in bytes (after rounding up). */ ++/* itemsperblock is the number of items allocated at once in a single */ ++/* block. itemsfirstblock is the number of items in the first block, */ ++/* which can vary from the others. items is the number of currently */ ++/* allocated items. maxitems is the maximum number of items that have */ ++/* been allocated at once; it is the current number of items plus the */ ++/* number of records kept on deaditemstack. */ ++ ++struct memorypool { ++ VOID **firstblock, **nowblock; ++ VOID *nextitem; ++ VOID *deaditemstack; ++ VOID **pathblock; ++ VOID *pathitem; ++ int alignbytes; ++ int itembytes; ++ int itemsperblock; ++ int itemsfirstblock; ++ long items, maxitems; ++ int unallocateditems; ++ int pathitemsleft; ++}; ++ ++ ++/* Mesh data structure. Triangle operates on only one mesh, but the mesh */ ++/* structure is used (instead of global variables) to allow reentrancy. */ ++ ++struct mesh { ++ ++/* Variables used to allocate memory for triangles, subsegments, vertices, */ ++/* viri (triangles being eaten), encroached segments, bad (skinny or too */ ++/* large) triangles, and splay tree nodes. */ ++ ++ struct memorypool triangles; ++ struct memorypool subsegs; ++ struct memorypool vertices; ++ struct memorypool viri; ++ struct memorypool badsubsegs; ++ struct memorypool badtriangles; ++ struct memorypool flipstackers; ++ struct memorypool splaynodes; ++ ++/* Variables that maintain the bad triangle queues. The queues are */ ++/* ordered from 4095 (highest priority) to 0 (lowest priority). */ ++ ++ struct badtriang *queuefront[4096]; ++ struct badtriang *queuetail[4096]; ++ int nextnonemptyq[4096]; ++ int firstnonemptyq; ++ ++/* Variable that maintains the stack of recently flipped triangles. */ ++ ++ struct flipstacker *lastflip; ++ ++/* Other variables. */ ++ ++ REAL xmin, xmax, ymin, ymax; /* x and y bounds. */ ++ REAL xminextreme; /* Nonexistent x value used as a flag in sweepline. */ ++ int invertices; /* Number of input vertices. */ ++ int inelements; /* Number of input triangles. */ ++ int insegments; /* Number of input segments. */ ++ int holes; /* Number of input holes. */ ++ int regions; /* Number of input regions. */ ++ int undeads; /* Number of input vertices that don't appear in the mesh. */ ++ long edges; /* Number of output edges. */ ++ int mesh_dim; /* Dimension (ought to be 2). */ ++ int nextras; /* Number of attributes per vertex. */ ++ int eextras; /* Number of attributes per triangle. */ ++ long hullsize; /* Number of edges in convex hull. */ ++ int steinerleft; /* Number of Steiner points not yet used. */ ++ int vertexmarkindex; /* Index to find boundary marker of a vertex. */ ++ int vertex2triindex; /* Index to find a triangle adjacent to a vertex. */ ++ int highorderindex; /* Index to find extra nodes for high-order elements. */ ++ int elemattribindex; /* Index to find attributes of a triangle. */ ++ int areaboundindex; /* Index to find area bound of a triangle. */ ++ int checksegments; /* Are there segments in the triangulation yet? */ ++ int checkquality; /* Has quality triangulation begun yet? */ ++ int readnodefile; /* Has a .node file been read? */ ++ long samples; /* Number of random samples for point location. */ ++ ++ long incirclecount; /* Number of incircle tests performed. */ ++ long counterclockcount; /* Number of counterclockwise tests performed. */ ++ long orient3dcount; /* Number of 3D orientation tests performed. */ ++ long hyperbolacount; /* Number of right-of-hyperbola tests performed. */ ++ long circumcentercount; /* Number of circumcenter calculations performed. */ ++ long circletopcount; /* Number of circle top calculations performed. */ ++ ++/* Triangular bounding box vertices. */ ++ ++ vertex infvertex1, infvertex2, infvertex3; ++ ++/* Pointer to the `triangle' that occupies all of "outer space." */ ++ ++ triangle *dummytri; ++ triangle *dummytribase; /* Keep base address so we can free() it later. */ ++ ++/* Pointer to the omnipresent subsegment. Referenced by any triangle or */ ++/* subsegment that isn't really connected to a subsegment at that */ ++/* location. */ ++ ++ subseg *dummysub; ++ subseg *dummysubbase; /* Keep base address so we can free() it later. */ ++ ++/* Pointer to a recently visited triangle. Improves point location if */ ++/* proximate vertices are inserted sequentially. */ ++ ++ struct otri recenttri; ++ ++}; /* End of `struct mesh'. */ ++ ++ ++/* Data structure for command line switches and file names. This structure */ ++/* is used (instead of global variables) to allow reentrancy. */ ++ ++struct behavior { ++ ++/* Switches for the triangulator. */ ++/* poly: -p switch. refine: -r switch. */ ++/* quality: -q switch. */ ++/* minangle: minimum angle bound, specified after -q switch. */ ++/* goodangle: cosine squared of minangle. */ ++/* offconstant: constant used to place off-center Steiner points. */ ++/* vararea: -a switch without number. */ ++/* fixedarea: -a switch with number. */ ++/* maxarea: maximum area bound, specified after -a switch. */ ++/* usertest: -u switch. */ ++/* regionattrib: -A switch. convex: -c switch. */ ++/* weighted: 1 for -w switch, 2 for -W switch. jettison: -j switch */ ++/* firstnumber: inverse of -z switch. All items are numbered starting */ ++/* from `firstnumber'. */ ++/* edgesout: -e switch. voronoi: -v switch. */ ++/* neighbors: -n switch. geomview: -g switch. */ ++/* nobound: -B switch. nopolywritten: -P switch. */ ++/* nonodewritten: -N switch. noelewritten: -E switch. */ ++/* noiterationnum: -I switch. noholes: -O switch. */ ++/* noexact: -X switch. */ ++/* order: element order, specified after -o switch. */ ++/* nobisect: count of how often -Y switch is selected. */ ++/* steiner: maximum number of Steiner points, specified after -S switch. */ ++/* incremental: -i switch. sweepline: -F switch. */ ++/* dwyer: inverse of -l switch. */ ++/* splitseg: -s switch. */ ++/* conformdel: -D switch. docheck: -C switch. */ ++/* quiet: -Q switch. verbose: count of how often -V switch is selected. */ ++/* usesegments: -p, -r, -q, or -c switch; determines whether segments are */ ++/* used at all. */ ++/* */ ++/* Read the instructions to find out the meaning of these switches. */ ++ ++ int poly, refine, quality, vararea, fixedarea, usertest; ++ int regionattrib, convex, weighted, jettison; ++ int firstnumber; ++ int edgesout, voronoi, neighbors, geomview; ++ int nobound, nopolywritten, nonodewritten, noelewritten, noiterationnum; ++ int noholes, noexact, conformdel; ++ int incremental, sweepline, dwyer; ++ int splitseg; ++ int docheck; ++ int quiet, verbose; ++ int usesegments; ++ int order; ++ int nobisect; ++ int steiner; ++ REAL minangle, goodangle, offconstant; ++ REAL maxarea; ++ ++/* Variables for file names. */ ++ ++#ifndef TRILIBRARY ++ char innodefilename[FILENAMESIZE]; ++ char inelefilename[FILENAMESIZE]; ++ char inpolyfilename[FILENAMESIZE]; ++ char areafilename[FILENAMESIZE]; ++ char outnodefilename[FILENAMESIZE]; ++ char outelefilename[FILENAMESIZE]; ++ char outpolyfilename[FILENAMESIZE]; ++ char edgefilename[FILENAMESIZE]; ++ char vnodefilename[FILENAMESIZE]; ++ char vedgefilename[FILENAMESIZE]; ++ char neighborfilename[FILENAMESIZE]; ++ char offfilename[FILENAMESIZE]; ++#endif /* not TRILIBRARY */ ++ ++}; /* End of `struct behavior'. */ ++ ++/* Fast lookup arrays to speed some of the mesh manipulation primitives. */ ++ ++static int plus1mod3[3] = {1, 2, 0}; ++static int minus1mod3[3] = {2, 0, 1}; ++ ++/* These primitives determine the origin, destination, or apex of a */ ++/* triangle. */ ++ ++#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] ++ ++/* sdecode() converts a pointer to an oriented subsegment. The orientation */ ++/* is extracted from the least significant bit of the pointer. The two */ ++/* least significant bits (one for orientation, one for viral infection) */ ++/* are masked out to produce the real pointer. */ ++ ++#define sdecode(sptr, osub) \ ++ (osub).ssorient = (int) ((unsigned long) (sptr) & (unsigned long) 1l); \ ++ (osub).ss = (subseg *) \ ++ ((unsigned long) (sptr) & ~ (unsigned long) 3l) ++ ++/* This primitive reads a boundary marker. Boundary markers are */ ++/* used to hold user-defined tags for setting boundary conditions in */ ++/* finite element solvers. */ ++ ++#define mark(osub) (* (int *) ((osub).ss + 8)) ++ ++/********* Primitives for vertices *********/ ++/* */ ++/* */ ++ ++#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 ++ ++ ++/********* Function prototypes *********/ ++ ++#ifdef ANSI_DECLARATORS ++void *poolalloc(struct memorypool *pool); ++void traversalinit(struct memorypool *pool); ++void initializevertexpool(struct mesh *m, struct behavior *b); ++triangle *triangletraverse(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 triangleinit(struct mesh *m); ++void makevertexmap(struct mesh *m, struct behavior *b); ++enum insertvertexresult insertvertex(struct mesh *m, struct behavior *b, ++ vertex newvertex, struct otri *searchtri, ++ struct osub *splitseg, ++ int segmentflaws, int triflaws); ++long delaunay(struct mesh *m, struct behavior *b); ++void insertsegment(struct mesh *m, struct behavior *b, ++ vertex endpoint1, vertex endpoint2, int newmark); ++void carveholes(struct mesh *m, struct behavior *b, REAL *holelist, int holes, ++ REAL *regionlist, int regions); ++void enforcequality(struct mesh *m, struct behavior *b); ++#else /* not ANSI_DECLARATORS */ ++void *poolalloc(); ++void traversalinit(); ++void initializevertexpool(); ++triangle *triangletraverse(); ++void vertexdealloc(); ++vertex vertextraverse(); ++vertex getvertex(); ++void triangledeinit(); ++void triangleinit(); ++void makevertexmap(); ++enum insertvertexresult insertvertex(); ++long delaunay(); ++void insertsegment(); ++void carveholes(); ++void enforcequality(); ++#endif /* not ANSI_DECLARATORS */ +--- triangle-1.6/triangle.c.old 2008-08-12 21:28:45.000000000 +0000 ++++ triangle-1.6/triangle.c 2008-08-12 21:30:22.000000000 +0000 +@@ -194,28 +194,6 @@ + /* */ + /*****************************************************************************/ + +-/* For single precision (which will save some memory and reduce paging), */ +-/* define the symbol SINGLE by using the -DSINGLE compiler switch or by */ +-/* writing "#define SINGLE" below. */ +-/* */ +-/* For double precision (which will allow you to refine meshes to a smaller */ +-/* edge length), leave SINGLE undefined. */ +-/* */ +-/* Double precision uses more memory, but improves the resolution of the */ +-/* meshes you can generate with Triangle. It also reduces the likelihood */ +-/* of a floating exception due to overflow. Finally, it is much faster */ +-/* than single precision on 64-bit architectures like the DEC Alpha. I */ +-/* recommend double precision unless you want to generate a mesh for which */ +-/* you do not have enough memory. */ +- +-/* #define SINGLE */ +- +-#ifdef SINGLE +-#define REAL float +-#else /* not SINGLE */ +-#define REAL double +-#endif /* not SINGLE */ +- + /* If yours is not a Unix system, define the NO_TIMER compiler switch to */ + /* remove the Unix-specific timing code. */ + +@@ -298,16 +276,6 @@ + /* Number of splay tree nodes allocated at once. */ + #define SPLAYNODEPERBLOCK 508 + +-/* The vertex types. A DEADVERTEX has been deleted entirely. An */ +-/* UNDEADVERTEX is not part of the mesh, but is written to the output */ +-/* .node file and affects the node indexing in the other output files. */ +- +-#define INPUTVERTEX 0 +-#define SEGMENTVERTEX 1 +-#define FREEVERTEX 2 +-#define DEADVERTEX -32768 +-#define UNDEADVERTEX -32767 +- + /* Two constants for algorithms based on random sampling. Both constants */ + /* have been chosen empirically to optimize their respective algorithms. */ + +@@ -335,7 +303,6 @@ + #define ONETHIRD 0.333333333333333333333333333333333333333333333333333333333333 + + #include +-#include + #include + #include + #ifndef NO_TIMER +@@ -364,15 +331,6 @@ + + enum locateresult {INTRIANGLE, ONEDGE, ONVERTEX, OUTSIDE}; + +-/* Labels that signify the result of vertex insertion. The result indicates */ +-/* that the vertex was inserted with complete success, was inserted but */ +-/* encroaches upon a subsegment, was not inserted because it lies on a */ +-/* segment, or was not inserted because another vertex occupies the same */ +-/* location. */ +- +-enum insertvertexresult {SUCCESSFULVERTEX, ENCROACHINGVERTEX, VIOLATINGVERTEX, +- DUPLICATEVERTEX}; +- + /* Labels that signify the result of direction finding. The result */ + /* indicates that a segment connecting the two query points falls within */ + /* the direction triangle, along the left edge of the direction triangle, */ +@@ -380,258 +338,6 @@ + + enum finddirectionresult {WITHIN, LEFTCOLLINEAR, RIGHTCOLLINEAR}; + +-/*****************************************************************************/ +-/* */ +-/* The basic mesh data structures */ +-/* */ +-/* There are three: vertices, triangles, and subsegments (abbreviated */ +-/* `subseg'). These three data structures, linked by pointers, comprise */ +-/* the mesh. A vertex simply represents a mesh vertex and its properties. */ +-/* A triangle is a triangle. A subsegment is a special data structure used */ +-/* to represent an impenetrable edge of the mesh (perhaps on the outer */ +-/* boundary, on the boundary of a hole, or part of an internal boundary */ +-/* separating two triangulated regions). Subsegments represent boundaries, */ +-/* defined by the user, that triangles may not lie across. */ +-/* */ +-/* A triangle consists of a list of three vertices, a list of three */ +-/* adjoining triangles, a list of three adjoining subsegments (when */ +-/* segments exist), an arbitrary number of optional user-defined */ +-/* floating-point attributes, and an optional area constraint. The latter */ +-/* is an upper bound on the permissible area of each triangle in a region, */ +-/* used for mesh refinement. */ +-/* */ +-/* For a triangle on a boundary of the mesh, some or all of the neighboring */ +-/* triangles may not be present. For a triangle in the interior of the */ +-/* mesh, often no neighboring subsegments are present. Such absent */ +-/* triangles and subsegments are never represented by NULL pointers; they */ +-/* are represented by two special records: `dummytri', the triangle that */ +-/* fills "outer space", and `dummysub', the omnipresent subsegment. */ +-/* `dummytri' and `dummysub' are used for several reasons; for instance, */ +-/* they can be dereferenced and their contents examined without violating */ +-/* protected memory. */ +-/* */ +-/* However, it is important to understand that a triangle includes other */ +-/* information as well. The pointers to adjoining vertices, triangles, and */ +-/* subsegments are ordered in a way that indicates their geometric relation */ +-/* to each other. Furthermore, each of these pointers contains orientation */ +-/* information. Each pointer to an adjoining triangle indicates which face */ +-/* of that triangle is contacted. Similarly, each pointer to an adjoining */ +-/* subsegment indicates which side of that subsegment is contacted, and how */ +-/* the subsegment is oriented relative to the triangle. */ +-/* */ +-/* The data structure representing a subsegment may be thought to be */ +-/* abutting the edge of one or two triangle data structures: either */ +-/* sandwiched between two triangles, or resting against one triangle on an */ +-/* exterior boundary or hole boundary. */ +-/* */ +-/* A subsegment consists of a list of four vertices--the vertices of the */ +-/* subsegment, and the vertices of the segment it is a part of--a list of */ +-/* two adjoining subsegments, and a list of two adjoining triangles. One */ +-/* of the two adjoining triangles may not be present (though there should */ +-/* always be one), and neighboring subsegments might not be present. */ +-/* Subsegments also store a user-defined integer "boundary marker". */ +-/* Typically, this integer is used to indicate what boundary conditions are */ +-/* to be applied at that location in a finite element simulation. */ +-/* */ +-/* Like triangles, subsegments maintain information about the relative */ +-/* orientation of neighboring objects. */ +-/* */ +-/* Vertices are relatively simple. A vertex is a list of floating-point */ +-/* numbers, starting with the x, and y coordinates, followed by an */ +-/* arbitrary number of optional user-defined floating-point attributes, */ +-/* followed by an integer boundary marker. During the segment insertion */ +-/* phase, there is also a pointer from each vertex to a triangle that may */ +-/* contain it. Each pointer is not always correct, but when one is, it */ +-/* speeds up segment insertion. These pointers are assigned values once */ +-/* at the beginning of the segment insertion phase, and are not used or */ +-/* updated except during this phase. Edge flipping during segment */ +-/* insertion will render some of them incorrect. Hence, don't rely upon */ +-/* them for anything. */ +-/* */ +-/* Other than the exception mentioned above, vertices have no information */ +-/* about what triangles, subfacets, or subsegments they are linked to. */ +-/* */ +-/*****************************************************************************/ +- +-/*****************************************************************************/ +-/* */ +-/* Handles */ +-/* */ +-/* The oriented triangle (`otri') and oriented subsegment (`osub') data */ +-/* structures defined below do not themselves store any part of the mesh. */ +-/* The mesh itself is made of `triangle's, `subseg's, and `vertex's. */ +-/* */ +-/* Oriented triangles and oriented subsegments will usually be referred to */ +-/* as "handles." A handle is essentially a pointer into the mesh; it */ +-/* allows you to "hold" one particular part of the mesh. Handles are used */ +-/* to specify the regions in which one is traversing and modifying the mesh.*/ +-/* A single `triangle' may be held by many handles, or none at all. (The */ +-/* latter case is not a memory leak, because the triangle is still */ +-/* connected to other triangles in the mesh.) */ +-/* */ +-/* An `otri' is a handle that holds a triangle. It holds a specific edge */ +-/* of the triangle. An `osub' is a handle that holds a subsegment. It */ +-/* holds either the left or right side of the subsegment. */ +-/* */ +-/* Navigation about the mesh is accomplished through a set of mesh */ +-/* manipulation primitives, further below. Many of these primitives take */ +-/* a handle and produce a new handle that holds the mesh near the first */ +-/* handle. Other primitives take two handles and glue the corresponding */ +-/* parts of the mesh together. The orientation of the handles is */ +-/* important. For instance, when two triangles are glued together by the */ +-/* bond() primitive, they are glued at the edges on which the handles lie. */ +-/* */ +-/* Because vertices have no information about which triangles they are */ +-/* attached to, I commonly represent a vertex by use of a handle whose */ +-/* origin is the vertex. A single handle can simultaneously represent a */ +-/* triangle, an edge, and a vertex. */ +-/* */ +-/*****************************************************************************/ +- +-/* The triangle data structure. Each triangle contains three pointers to */ +-/* adjoining triangles, plus three pointers to vertices, plus three */ +-/* pointers to subsegments (declared below; these pointers are usually */ +-/* `dummysub'). It may or may not also contain user-defined attributes */ +-/* and/or a floating-point "area constraint." It may also contain extra */ +-/* pointers for nodes, when the user asks for high-order elements. */ +-/* Because the size and structure of a `triangle' is not decided until */ +-/* runtime, I haven't simply declared the type `triangle' as a struct. */ +- +-typedef REAL **triangle; /* Really: typedef triangle *triangle */ +- +-/* An oriented triangle: includes a pointer to a triangle and orientation. */ +-/* The orientation denotes an edge of the triangle. Hence, there are */ +-/* three possible orientations. By convention, each edge always points */ +-/* counterclockwise about the corresponding triangle. */ +- +-struct otri { +- triangle *tri; +- int orient; /* Ranges from 0 to 2. */ +-}; +- +-/* The subsegment data structure. Each subsegment contains two pointers to */ +-/* adjoining subsegments, plus four pointers to vertices, plus two */ +-/* pointers to adjoining triangles, plus one boundary marker, plus one */ +-/* segment number. */ +- +-typedef REAL **subseg; /* Really: typedef subseg *subseg */ +- +-/* An oriented subsegment: includes a pointer to a subsegment and an */ +-/* orientation. The orientation denotes a side of the edge. Hence, there */ +-/* are two possible orientations. By convention, the edge is always */ +-/* directed so that the "side" denoted is the right side of the edge. */ +- +-struct osub { +- subseg *ss; +- int ssorient; /* Ranges from 0 to 1. */ +-}; +- +-/* The vertex data structure. Each vertex is actually an array of REALs. */ +-/* The number of REALs is unknown until runtime. An integer boundary */ +-/* marker, and sometimes a pointer to a triangle, is appended after the */ +-/* REALs. */ +- +-typedef REAL *vertex; +- +-/* A queue used to store encroached subsegments. Each subsegment's vertices */ +-/* are stored so that we can check whether a subsegment is still the same. */ +- +-struct badsubseg { +- subseg encsubseg; /* An encroached subsegment. */ +- vertex subsegorg, subsegdest; /* Its two vertices. */ +-}; +- +-/* A queue used to store bad triangles. The key is the square of the cosine */ +-/* of the smallest angle of the triangle. Each triangle's vertices are */ +-/* stored so that one can check whether a triangle is still the same. */ +- +-struct badtriang { +- triangle poortri; /* A skinny or too-large triangle. */ +- REAL key; /* cos^2 of smallest (apical) angle. */ +- vertex triangorg, triangdest, triangapex; /* Its three vertices. */ +- struct badtriang *nexttriang; /* Pointer to next bad triangle. */ +-}; +- +-/* A stack of triangles flipped during the most recent vertex insertion. */ +-/* The stack is used to undo the vertex insertion if the vertex encroaches */ +-/* upon a subsegment. */ +- +-struct flipstacker { +- triangle flippedtri; /* A recently flipped triangle. */ +- struct flipstacker *prevflip; /* Previous flip in the stack. */ +-}; +- +-/* A node in a heap used to store events for the sweepline Delaunay */ +-/* algorithm. Nodes do not point directly to their parents or children in */ +-/* the heap. Instead, each node knows its position in the heap, and can */ +-/* look up its parent and children in a separate array. The `eventptr' */ +-/* points either to a `vertex' or to a triangle (in encoded format, so */ +-/* that an orientation is included). In the latter case, the origin of */ +-/* the oriented triangle is the apex of a "circle event" of the sweepline */ +-/* algorithm. To distinguish site events from circle events, all circle */ +-/* events are given an invalid (smaller than `xmin') x-coordinate `xkey'. */ +- +-struct event { +- REAL xkey, ykey; /* Coordinates of the event. */ +- VOID *eventptr; /* Can be a vertex or the location of a circle event. */ +- int heapposition; /* Marks this event's position in the heap. */ +-}; +- +-/* A node in the splay tree. Each node holds an oriented ghost triangle */ +-/* that represents a boundary edge of the growing triangulation. When a */ +-/* circle event covers two boundary edges with a triangle, so that they */ +-/* are no longer boundary edges, those edges are not immediately deleted */ +-/* from the tree; rather, they are lazily deleted when they are next */ +-/* encountered. (Since only a random sample of boundary edges are kept */ +-/* in the tree, lazy deletion is faster.) `keydest' is used to verify */ +-/* that a triangle is still the same as when it entered the splay tree; if */ +-/* it has been rotated (due to a circle event), it no longer represents a */ +-/* boundary edge and should be deleted. */ +- +-struct splaynode { +- struct otri keyedge; /* Lprev of an edge on the front. */ +- vertex keydest; /* Used to verify that splay node is still live. */ +- struct splaynode *lchild, *rchild; /* Children in splay tree. */ +-}; +- +-/* A type used to allocate memory. firstblock is the first block of items. */ +-/* nowblock is the block from which items are currently being allocated. */ +-/* nextitem points to the next slab of free memory for an item. */ +-/* deaditemstack is the head of a linked list (stack) of deallocated items */ +-/* that can be recycled. unallocateditems is the number of items that */ +-/* remain to be allocated from nowblock. */ +-/* */ +-/* Traversal is the process of walking through the entire list of items, and */ +-/* is separate from allocation. Note that a traversal will visit items on */ +-/* the "deaditemstack" stack as well as live items. pathblock points to */ +-/* the block currently being traversed. pathitem points to the next item */ +-/* to be traversed. pathitemsleft is the number of items that remain to */ +-/* be traversed in pathblock. */ +-/* */ +-/* alignbytes determines how new records should be aligned in memory. */ +-/* itembytes is the length of a record in bytes (after rounding up). */ +-/* itemsperblock is the number of items allocated at once in a single */ +-/* block. itemsfirstblock is the number of items in the first block, */ +-/* which can vary from the others. items is the number of currently */ +-/* allocated items. maxitems is the maximum number of items that have */ +-/* been allocated at once; it is the current number of items plus the */ +-/* number of records kept on deaditemstack. */ +- +-struct memorypool { +- VOID **firstblock, **nowblock; +- VOID *nextitem; +- VOID *deaditemstack; +- VOID **pathblock; +- VOID *pathitem; +- int alignbytes; +- int itembytes; +- int itemsperblock; +- int itemsfirstblock; +- long items, maxitems; +- int unallocateditems; +- int pathitemsleft; +-}; +- + + /* Global constants. */ + +@@ -647,168 +353,6 @@ + unsigned long randomseed; /* Current random number seed. */ + + +-/* Mesh data structure. Triangle operates on only one mesh, but the mesh */ +-/* structure is used (instead of global variables) to allow reentrancy. */ +- +-struct mesh { +- +-/* Variables used to allocate memory for triangles, subsegments, vertices, */ +-/* viri (triangles being eaten), encroached segments, bad (skinny or too */ +-/* large) triangles, and splay tree nodes. */ +- +- struct memorypool triangles; +- struct memorypool subsegs; +- struct memorypool vertices; +- struct memorypool viri; +- struct memorypool badsubsegs; +- struct memorypool badtriangles; +- struct memorypool flipstackers; +- struct memorypool splaynodes; +- +-/* Variables that maintain the bad triangle queues. The queues are */ +-/* ordered from 4095 (highest priority) to 0 (lowest priority). */ +- +- struct badtriang *queuefront[4096]; +- struct badtriang *queuetail[4096]; +- int nextnonemptyq[4096]; +- int firstnonemptyq; +- +-/* Variable that maintains the stack of recently flipped triangles. */ +- +- struct flipstacker *lastflip; +- +-/* Other variables. */ +- +- REAL xmin, xmax, ymin, ymax; /* x and y bounds. */ +- REAL xminextreme; /* Nonexistent x value used as a flag in sweepline. */ +- int invertices; /* Number of input vertices. */ +- int inelements; /* Number of input triangles. */ +- int insegments; /* Number of input segments. */ +- int holes; /* Number of input holes. */ +- int regions; /* Number of input regions. */ +- int undeads; /* Number of input vertices that don't appear in the mesh. */ +- long edges; /* Number of output edges. */ +- int mesh_dim; /* Dimension (ought to be 2). */ +- int nextras; /* Number of attributes per vertex. */ +- int eextras; /* Number of attributes per triangle. */ +- long hullsize; /* Number of edges in convex hull. */ +- int steinerleft; /* Number of Steiner points not yet used. */ +- int vertexmarkindex; /* Index to find boundary marker of a vertex. */ +- int vertex2triindex; /* Index to find a triangle adjacent to a vertex. */ +- int highorderindex; /* Index to find extra nodes for high-order elements. */ +- int elemattribindex; /* Index to find attributes of a triangle. */ +- int areaboundindex; /* Index to find area bound of a triangle. */ +- int checksegments; /* Are there segments in the triangulation yet? */ +- int checkquality; /* Has quality triangulation begun yet? */ +- int readnodefile; /* Has a .node file been read? */ +- long samples; /* Number of random samples for point location. */ +- +- long incirclecount; /* Number of incircle tests performed. */ +- long counterclockcount; /* Number of counterclockwise tests performed. */ +- long orient3dcount; /* Number of 3D orientation tests performed. */ +- long hyperbolacount; /* Number of right-of-hyperbola tests performed. */ +- long circumcentercount; /* Number of circumcenter calculations performed. */ +- long circletopcount; /* Number of circle top calculations performed. */ +- +-/* Triangular bounding box vertices. */ +- +- vertex infvertex1, infvertex2, infvertex3; +- +-/* Pointer to the `triangle' that occupies all of "outer space." */ +- +- triangle *dummytri; +- triangle *dummytribase; /* Keep base address so we can free() it later. */ +- +-/* Pointer to the omnipresent subsegment. Referenced by any triangle or */ +-/* subsegment that isn't really connected to a subsegment at that */ +-/* location. */ +- +- subseg *dummysub; +- subseg *dummysubbase; /* Keep base address so we can free() it later. */ +- +-/* Pointer to a recently visited triangle. Improves point location if */ +-/* proximate vertices are inserted sequentially. */ +- +- struct otri recenttri; +- +-}; /* End of `struct mesh'. */ +- +- +-/* Data structure for command line switches and file names. This structure */ +-/* is used (instead of global variables) to allow reentrancy. */ +- +-struct behavior { +- +-/* Switches for the triangulator. */ +-/* poly: -p switch. refine: -r switch. */ +-/* quality: -q switch. */ +-/* minangle: minimum angle bound, specified after -q switch. */ +-/* goodangle: cosine squared of minangle. */ +-/* offconstant: constant used to place off-center Steiner points. */ +-/* vararea: -a switch without number. */ +-/* fixedarea: -a switch with number. */ +-/* maxarea: maximum area bound, specified after -a switch. */ +-/* usertest: -u switch. */ +-/* regionattrib: -A switch. convex: -c switch. */ +-/* weighted: 1 for -w switch, 2 for -W switch. jettison: -j switch */ +-/* firstnumber: inverse of -z switch. All items are numbered starting */ +-/* from `firstnumber'. */ +-/* edgesout: -e switch. voronoi: -v switch. */ +-/* neighbors: -n switch. geomview: -g switch. */ +-/* nobound: -B switch. nopolywritten: -P switch. */ +-/* nonodewritten: -N switch. noelewritten: -E switch. */ +-/* noiterationnum: -I switch. noholes: -O switch. */ +-/* noexact: -X switch. */ +-/* order: element order, specified after -o switch. */ +-/* nobisect: count of how often -Y switch is selected. */ +-/* steiner: maximum number of Steiner points, specified after -S switch. */ +-/* incremental: -i switch. sweepline: -F switch. */ +-/* dwyer: inverse of -l switch. */ +-/* splitseg: -s switch. */ +-/* conformdel: -D switch. docheck: -C switch. */ +-/* quiet: -Q switch. verbose: count of how often -V switch is selected. */ +-/* usesegments: -p, -r, -q, or -c switch; determines whether segments are */ +-/* used at all. */ +-/* */ +-/* Read the instructions to find out the meaning of these switches. */ +- +- int poly, refine, quality, vararea, fixedarea, usertest; +- int regionattrib, convex, weighted, jettison; +- int firstnumber; +- int edgesout, voronoi, neighbors, geomview; +- int nobound, nopolywritten, nonodewritten, noelewritten, noiterationnum; +- int noholes, noexact, conformdel; +- int incremental, sweepline, dwyer; +- int splitseg; +- int docheck; +- int quiet, verbose; +- int usesegments; +- int order; +- int nobisect; +- int steiner; +- REAL minangle, goodangle, offconstant; +- REAL maxarea; +- +-/* Variables for file names. */ +- +-#ifndef TRILIBRARY +- char innodefilename[FILENAMESIZE]; +- char inelefilename[FILENAMESIZE]; +- char inpolyfilename[FILENAMESIZE]; +- char areafilename[FILENAMESIZE]; +- char outnodefilename[FILENAMESIZE]; +- char outelefilename[FILENAMESIZE]; +- char outpolyfilename[FILENAMESIZE]; +- char edgefilename[FILENAMESIZE]; +- char vnodefilename[FILENAMESIZE]; +- char vedgefilename[FILENAMESIZE]; +- char neighborfilename[FILENAMESIZE]; +- char offfilename[FILENAMESIZE]; +-#endif /* not TRILIBRARY */ +- +-}; /* End of `struct behavior'. */ +- +- + /*****************************************************************************/ + /* */ + /* Mesh manipulation primitives. Each triangle contains three pointers to */ +@@ -919,11 +463,6 @@ + /** **/ + /** **/ + +-/* Fast lookup arrays to speed some of the mesh manipulation primitives. */ +- +-int plus1mod3[3] = {1, 2, 0}; +-int minus1mod3[3] = {2, 0, 1}; +- + /********* Primitives for triangles *********/ + /* */ + /* */ +@@ -1053,18 +592,9 @@ + lprevself(otri); \ + symself(otri); + +-/* These primitives determine or set the origin, destination, or apex of a */ ++/* These primitives set the origin, destination, or apex of a */ + /* triangle. */ + +-#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 + +@@ -1146,16 +676,6 @@ + /* */ + /* */ + +-/* sdecode() converts a pointer to an oriented subsegment. The orientation */ +-/* is extracted from the least significant bit of the pointer. The two */ +-/* least significant bits (one for orientation, one for viral infection) */ +-/* are masked out to produce the real pointer. */ +- +-#define sdecode(sptr, osub) \ +- (osub).ssorient = (int) ((unsigned long) (sptr) & (unsigned long) 1l); \ +- (osub).ss = (subseg *) \ +- ((unsigned long) (sptr) & ~ (unsigned long) 3l) +- + /* sencode() compresses an oriented subsegment into a single pointer. It */ + /* relies on the assumption that all subsegments are aligned to two-byte */ + /* boundaries, so the least significant bit of (osub).ss is zero. */ +@@ -1221,12 +741,10 @@ + #define setsegdest(osub, vertexptr) \ + (osub).ss[5 - (osub).ssorient] = (subseg) vertexptr + +-/* These primitives read or set a boundary marker. Boundary markers are */ ++/* This primitive sets a boundary marker. Boundary markers are */ + /* used to hold user-defined tags for setting boundary conditions in */ + /* finite element solvers. */ + +-#define mark(osub) (* (int *) ((osub).ss + 8)) +- + #define setmark(osub, value) \ + * (int *) ((osub).ss + 8) = value + +@@ -1302,16 +820,6 @@ + /* */ + /* */ + +-#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-1.6.orig/debian/patches/make-rm.patch +++ triangle-1.6/debian/patches/make-rm.patch @@ -0,0 +1,11 @@ +--- triangle-1.6/makefile 2008-08-12 16:44:38.000000000 +0000 ++++ triangle-1.6/makefile~ 2008-08-12 16:41:00.000000000 +0000 +@@ -90,7 +90,7 @@ + + # RM should be set to the name of your favorite rm (file deletion program). + +-RM = /bin/rm ++RM = /bin/rm -f + + # The action starts here. + --- triangle-1.6.orig/debian/patches/include-always.patch +++ triangle-1.6/debian/patches/include-always.patch @@ -0,0 +1,12 @@ +--- triangle-1.6/triangle.c~ 2008-08-12 17:15:26.000000000 +0000 ++++ triangle-1.6/triangle.c 2008-08-12 17:17:50.000000000 +0000 +@@ -314,9 +314,7 @@ + #ifdef LINUX + #include + #endif /* LINUX */ +-#ifdef TRILIBRARY + #include "triangle.h" +-#endif /* TRILIBRARY */ + + /* A few forward declarations. */ +