Deterministic Linear Time Constrained Triangulation using Simplified Earcut
Marco Livesu, Gianmarco Cherchi, Riccardo Scateni, Marco Attene
JJOURNAL OF L A TEX CLASS FILES, VOL. 14, NO. 8, AUGUST 2015 1
Deterministic Linear Time ConstrainedTriangulation using Simplified Earcut
Marco Livesu, Gianmarco Cherchi, Riccardo Scateni, Marco Attene
Abstract —Triangulation algorithms that conform to a set of non-intersecting input segments typically proceed in an incremental fashion,by inserting points first, and then segments. Inserting a segment amounts to delete all the triangles it intersects, define two polygons thatfill the so generated hole and have the segment as shared basis, and then re-triangulate each polygon separately. In this paper we provethat the polygons generated evacuating the triangles that intersect a constrained segment are such that all their convex vertices but twocan be used to form triangles in an earcut fashion, without the need to check whether other polygon points are located within each ear.The fact that any simple polygon contains at least three convex vertices guarantees the existence of a valid ear to cut, ensuringconvergence. Not only this translates to an optimal deterministic linear time triangulation algorithm, but such algorithm is also trivial toimplement. In this paper we formally prove the correctness of our approach, also validating it in practical applications and comparing itwith prior art.
Index Terms —constrained triangulation, tessellation, segment insertion, earcut, CDT (cid:70)
NTRODUCTION
The generation of triangulations that conform to a givenset of line segments is at the basis of many tools in scientificcomputing [1], [2]. A typical approach to the construction ofa constrained triangulation consists in computing a generictriangulation of all the segment endpoints, and then incorpo-rate the segments. Adding a segment connecting two verticesof a previously existing triangulation requires to perform twooperations: (i) detect and remove all the triangles that areintersected by the segment; (ii) fill the so generated poygonalpocket, triangulating two sub-polygons that have the wantedsegment as shared basis (Figure 1). In this short paper wefocus our attention on this latter operation, sheding somenew light on this classical computational geometry problem,and ultimately proposing a simple yet computationallyoptimal solution that has been surprisingly overlooked untilnow.Our main intuition is that all the polygons that arisein the context of segment insertion belong to a restrictedclass of simple polygons which cannot contain severe( curl-like ) concavities. We exploit this property to devisea straightforward triangulation algorithm that proceeds inan earcut fashion [3], forming triangles by cutting one earat a time. We were able to prove that for any polygon inour class of interest all the convex vertices but two formvalid ears which do not contain any other vertex inside,hence can be used to form triangles right away. We alsoprove that any such polygon contains at least three convexvertices, thus guaranteeing convergence. Putting all theseingredients together yields a triangulation algorithm whichis a simplified version of the classical earcut, from whichwe omitted any point-in-triangle test. This simplification notonly makes the algorithm even simpler to implement, but italso makes it run in deterministic linear time, on par with thebest known triangulation algorithm [4] which, conversely, isextremely difficult to implement.Our linearized earcut method advances the state of theart in the field, which comprised either optimal algorithmsthat were complex to implement, or algorithms that were easier to implement (though still less easy than earcut) buthad sub optimal asymptotic complexity (Section 2).In Section 3 we describe the basis of the classical earcutalgorithm, which has O ( n ) complexity. In Section 4 weintroduce our simplified version, demonstrating that it runsin deterministic linear time and also proving its correctnessin Section 5. In Section 6 we report on numerical testswe performed on our method, also comparing with themost recently published method in the field, proposed byShewchuk and Brown in [5]. RIOR WORKS
Finding efficient methods to triangulate a polygon has been aforemost problem in computational geometry and computergraphics since decades. Before 1978 no efficient methodswere known, and the only approach to triangulation wasbrute force. Brute force methods – of which earcut [3] isa popular representative – are very easy to implement,but at the same time they are inefficient, and can onlyachieve O ( n ) complexity. The first attempt to efficientlytriangulate a polygon occurred in 1978 [6], and the proposedalgorithm had O ( n log n ) time complexity. For a certainperiod it was thought that triangulation was a problem ashard as sorting, and no better algorithms could be devised.Asano et al. [7] showed that this bound is optimal forpolygons with holes, but does not apply to simple polygons.Fournier and Montuno showed that the decomposition of asimple polygon into trapezoidal elements ( trapezoidation ) isequivalent to triangulation, and that each trapezoid could betriangulated in O ( n ) [8]. At that time the best trapezoidationalgorithm had O ( n log n ) complexity, which was thereforealso a bound for triangulation. In the subsequent yearsvarious researchers focused their attention to trapezoidationas a mean to improve tiangulation, until in 1988 Tarjanand Van Wyk [9] showed that a trapezoidation (hence atriangulation) could be obtained in O ( n log log n ) . In theirpaper, Tarjan and Van Wyk open about the possibility to a r X i v : . [ c s . C G ] S e p OURNAL OF L A TEX CLASS FILES, VOL. 14, NO. 8, AUGUST 2015 2
Fig. 1. Inserting a constrained segment s in a previously existing triangulation requires removing all the triangles intersected by it (in yellow), revealingtwo polygonal pockets having s as base. These pockets may be non convex, but endow an important property: a portion of s can be seen from any oftheir interior points. This can be proved by observing that these polygons are fully formed by portions of triangles that are cut by s , therefore theconvexity of each sub-polygon guarantees visibility. In practice, this avoids the generation of curl-like concavities, a property that we exploit to speedup their re-triangulation. achieve linear complexity in the near future, and in 1991Chazelle proposed a deterministic linear time algorithm [4]based on a very sophisticated trapezoidation technique. Thecost these algorithms pay for their extreme efficiency isalgorithmic complexity. Quoting [5], Chazelle’s work ”iscelebrated as a theoretical breakthrough, but is considered toocomplicated for practical use” . Chazelle himself closed hisfamous article raising the question of whether there existsimpler algorithms that would allow to triangulate a polygonin optimal time. This question was partly answered in [10],[11]. However, these methods obtained only expected lineartime complexity using randomized approaches, but are stillnon optimal in the worst case.General purpose algorithms have a very rich literature,and no major improvements have been registered in recentyears. Our work does not aim to provide a contributionin this regard, but is rather linked to a parallel line ofworks, which focus on a specific application (constrainedtriangulation in our case). Restricting their applicability to anarrower class of inputs, these methods obtain efficiency withsimpler algorithms that are easier to implement. Constrainedtriangulations are widely used in scientific computing, anda variety of methods tailored for them have been proposedover the years. Anglada [12] extended the work of De Florianiand Puppo [13], proposing a simple O ( n log n ) algorithmfor on-line segment insertion. According to [5] this is theeasiest method to implement for this class of problems, but ithas O ( n ) complexity in the worst case. Methods that run indeterministic O ( n log n ) time are also available [14], [15]. Thestate of the art in the field is [5], which combines simplicityand efficiency, obtaining expected linear time complexity. Amethod that runs in deterministic linear time also exists [16],but it is based on trapezoidation and is complicated toimplement. We show that a trivial modification of a bruteforce method like earcut leads to optimal deterministic lineartime complexity, and that our proposed modification evensimplifies the original algorithm in terms of coding effort.To this end, not only our method has optimal complexity,but it is also easier to implement than any known technique,including brute force algorithms. ACKGROUND : CLASSICAL EARCUT
In this section we introduce the basics of the earcut algorithm,also fixing the notation. Given a simple polygon P defined by Fig. 2. Any convex vertex v along the chain that indirectly connects theendpoints of the constrained segment s is guaranteed not to contain anyother polygon vertex inside its ear. This can be proved by observing that v is also a vertex of a convex sub-polygon (green shaded area). Convexityguarantees that all non subsequent vertices of the green polygon formvalid ears. therefore, v is also a valid ear for the original polygon. the cyclic list of its vertices { v , v , . . . , v n } , a vertex v ∈ P is convex if its internal angle is lower than π , and is concave otherwise. For two non consecutive points v i , v j ∈ P , thesegment v i v j is a diagonal of P if it is completely containedin the polygon. Given a convex vertex, if its two adjacentvertices form a diagonal, then this detaches a triangle – or ear – from P . It is known that any simple polygon contains atleast two ears [17]; the algorithm that progressively detachesall of them to construct a triangulation is called earcut, andis arguably the simplest triangulation algorithm known [3].Despite its simplicity, earcut is fairly inefficient. A naiveimplementation has complexity O ( n ) , with n being thenumber of polygon vertices. Precomputing separate lists forconvex and concave vertices reduces complexity to O ( n ) [3],still far from the best known triangulation algorithm forsimple polygons, which promise linear time complexity(Section 2). Nevertheless, when it comes to actual coding,earcut is always a tempting solution due to its ease ofimplementation.What makes earcut inefficient is the diagonal test. Forany candidate ear centered at a convex vertex the algorithmmust verify if its left and right neighbors form a diagonal.This amounts to ensure that the triangle described by thesethree vertices does not contain any other polygon vertex,which can be done in linear time by testing them all. Since OURNAL OF L A TEX CLASS FILES, VOL. 14, NO. 8, AUGUST 2015 3
Fig. 3. All internal convex vertices of the two polygons based upon the constrained segment (dashed line) define a convex sub-polygon (in green) thatguarantees they are valid ears. Bottom right: the extrema of the constrained segment s are always convex, but they may define invalid ears thatcannot be used for triangulation. the triangulation of a polygon with n vertices contains n − triangles, and testing an ear is linear, the overall cost isquadratic at best. ALGORITHM 1:
Linear Earcut input : a simple polygon P = { v , v , . . . , v n } , withvertices sorted so that ( v , v n ) are the endpoints ofthe constrained segment output : a triangulation of P // use a doubly linked list for P . Cost of update is O (1) P = { n, , , . . . , n − } // prev N = { , , . . . , n, } // next // pre-compute internal ears. Cost is O ( n ) E = ∅ for i = 2 , , . . . , n − do if v i is a convex vertex then append v i into E end end // process internal ears. Cost is O ( n ) while | E | > do v = extract one ear from E make triangle P ( v ) , v, N ( v ) // update adjacencies. Cost is O (1) N ( P ( v )) = N ( v ) P ( N ( v )) = P ( v ) // check if prev or next are new ears. Cost is O (1) if P ( v ) / ∈ E ∪ { v , v n } and P ( v ) is convex then append P ( v ) into E end if N ( v ) / ∈ E ∪ { v , v n } and N ( v ) is convex then append N ( v ) into E end end INEAR EARCUT
In this section we introduce our simplified version theearcut algorithm, also discussing its complexity. The proof ofcorrectness and convergence of the algorith will be given inSection 5.In Algorithm 1 we show a pseudo code implementationof our linearized earcut. Our code is based upon the efficient implementation described in [3], which is further simplifiedto fully exploit the special nature of our polygons. Given anordered chain of vertices { v , v , . . . , v n } describing a simplepolygon, and assuming that v , v n is the constrained segment,the algorithm proceeds as follows: we first initialize a doublylinked list representation of the polygon, which amounts totwo vectors of length n encoding, for each point, its previousand next vertices along the chain. This representation isextremely efficient, as deleting a node from the polygonamounts to updating the prev and next information fromits neighbors, excluding it from the chain (lines 15-17 inthe pseudo code). We then process all the vertices but theextrema of the constrained segment, and check whether theyare convex or concave. Differently from standard earcut,convex vertices are directly deemed as valid ears, as theydo not necessitate the diagonal test (a formal proof is givenin Section 5.2). Finally, we cut all ears: for each ear centeredat a convex vertex v , we first create a triangle with theprevious and subsequent vertices in the chain (lines 13-14in the pseudo code), and then remove v from the polygon.Finally, if the extrema of the ear were not convex vertices,we check whether they have now become convex, and if sowe append them to the ear list. The algorithm terminateswhen all ears have been cut, resulting in a triangulation ofthe input polygon. It is easy to verify that the aforementioned algorithm runsin deterministic linear time, which means that its complexityis liner in the number of polyon vertices in the worst casescenario. The pre-computation of internal ears (lines 4-10)amounts to compute n − internal angles (the extrema ofthe constrained segment are not considered), and is therefore O ( n ) . The while loop (lines 11-25) is executed as many timesas the number of ears in the polygon. We know from Eulerthat a simple polygon with n vertices can be triangulatedexactly with n − elements, which means that the code inthe loop will be executed exactly n − times. Inside the loop,we have the generation of the triangle, which is O (1) , theupdate of the doubly linked list, which is O (1) , and the checkfor new ears, which is restricted only to the sides of the earwe just cut, and is therefore O (1) too. Therefore, the wholecomplexity is Θ( n ) . OURNAL OF L A TEX CLASS FILES, VOL. 14, NO. 8, AUGUST 2015 4
ROOF OF CORRECTNESS
We demonstrate that our linearized earcut algorithm isguaranteed to converge to a valid triangulation. The outlineof the proof is as follows: we first characterize the class ofpolygons under which our method is guaranteed to work(Section 5.1). Then, we prove that all internal ears (i.e. allconvex vertices but the extrema of the constrained segment)can be safely cut in O (1) sidestepping the diagonal test(Section 5.2). Conversely, the two lateral ears (i.e. the extremaof the constrained segment) may not be valid, and alwaysrequire a diagonal test before cutting (Section 5.3). Finally,we prove that for any polygon in our class of study therealways exist an internal ear, thus guaranteeing linear timeconvergence in the worst case scenario (Section 5.4). We are interested in tessellating polygons that arise in thecontext of constrained triangulations, when a new segment s is to be inserted in a previously existing triangle mesh M ( V, T ) . The outer perimeter of all triangles in T intersectedby s defines a polygon having the segment as diagonal.Halving such polygon along s defines two sub-polygons,which must be triangulated in order to transform the segment s into an edge of the mesh M (Figure 1).As observed in [13] polygons that arise in this contextare simple, meaning that they do not self intersect and donot contain internal holes. Note that edges of the originalmesh that do not intersect the segment may remain trappedinside the polygon, generating handling edges, holes, and acombination of both. Nevertheless, extracting the polygonborder with a method that marches on the underlyingmesh, such as [5], guarantees that non simple vertices areduplicated, always leading to a topologically simple polygonwhich may occasionally contain geometrically coincidentvertices if these pathological cases occur (Figure 4).They key observation we make in this paper is thatthese polygons belong to a restricted class of shapes whichmakes them much easier to triangulate than general simplepolygons. In fact, given a segment s and the two polygonsthat base upon it, we observe that despite concave, a portionof s must be visible from any point inside the polygonsthat have it as a base. This observation was already madein [13], and stems from the fact that polygons we wishto triangulate are made of portions of triangles that areintersected from the new segment, hence the convexity ofeach sub-element guarantees visibility (Figure 1). In practice,this avoids the presence of severe (curl-like) concavities,which would prevent us to sidestep the diagonal test in ourmodified earcut. Given a polygon P , we demonstrate that any convex vertex v along the chain that indirectly connects the endpoints ofthe constrained segment s forms a valid ear. In other words,denoting with v l , v r the two vertices at the immediate leftand right of v , we prove that the triangle (cid:92) v l vv r does notcontain any other vertex of P in its interior. We prove ourthesis by showing that v l , v, v r are also vertices of a convexsub-polygon Ω ⊆ P . Convexity guarantees that any pair of non adjacent vertices in Ω forms a valid diagonal, includedthe one connecting v l and v r .Without loss of generality, let us focus on the left sideof v . By symmetry, the same construction can be generatedat its right side. If v l is not an endpoint of s , then the edge v l v belongs to a triangle t l in the underlying mesh, and thistriangle has its third vertex at the opposite side of s . Thismust always be the case, because if such point was on thesame side of s , then t l would not intersect the segment inthe first place, and would not be part of polygon P . Theedge connecting the triangle vertex opposite to v l v with v l ,intersects segment s at a point ˜ v l . Similarly, there exists atwin vertex ˜ v r , obtained replicating the same construction atthe right side of v .Points { v, v l , ˜ v l , ˜ v r , v r } form a pentagon Ω ⊂ P (Figure 2).It can be easily shown that Ω is provably strictly convex, infact: • by our initial hypothesis, v is a convex vertex of P ,hence its angle is strictly lower than π also in Ω ; • v l is a vertex internal to the triangle t l , therefore itsangle is strictly lower than π ; • ˜ v l is defined by the intersection of a triangle edgewith segment s . This intersection partitions π intofour angles, all strictly lower than π ; • by symmetry, angle bounds for v l , ˜ v l also hold for v r and ˜ v r Since Ω is convex, any triplet of consecutive vertices forms avalid ear, including the ear centered at v . (cid:3) Note that, in case either v l or v r are endpoints of s , then Ω is a quadrilateral. If both are endpoints of s , then Ω is atriangle and is coincident with P . In both cases, the innerangles of Ω are still strictly bounded by π , hence its convexityand the validity of all its ears are verified. In Figure 3 weshow all convex sub-polygons that protect the internal earsfor the example shown in Figure 1. The extrema of the constrained segment s always formconvex vertices with respect to P . This can be easily verifiedby observing that if their angle was greater or equal to π ,than the triangle that contains them would not intersect s in the first place. However, the construction described inSection 5.2 does not apply to lateral ears, because one oftheir sides coincides with s , and the existence of a convexsub-polygon that contains it and is fully contained in P isnot guaranteed. In the bottom right part of Figure 3 we showa failure example where the triangle span by a lateral earis not even contained in P . Note that cases in which lateralears form valid triangles may still occur, but they cannot besafely cut without a diagonal test, hence the computationalcost of processing them is O ( n ) . For this reason, we neverconsider lateral ears in our triangulation algorithm. To prove convergence in deterministic linear time, we demon-strate that for any polygon defined in Section 5.1 there alwaysexist an internal ear which can be cut in O (1) (Section 5.2).As a starter, we observe that any simple polygon has at OURNAL OF L A TEX CLASS FILES, VOL. 14, NO. 8, AUGUST 2015 5
Fig. 4. Top: the outer profile of all triangles intersected by a constrained segment may enclose edges of the underlying mesh that are not intersectedby s , generating dangling edges (left), holes (middle) or a combination of both (right). Extracting the polygons with a topological approach thatmarches on the underlying mesh allows to correctly handle these pathological cases, duplicating vertices with more than two neighbors along thechain (bottom). As a result, from a topological point of view the polygons are always simple, though in these pathological cases they will containgeometrically coincident vertices or edges.Fig. 5. Parametric test polygons used for the comparison with [5]. Thelower edge corresponds to the constrained segment, the upper side canaccommodate a varying number of vertices (all collinear in the left model,randomly displaced along the vertical axis in the right model). least three convex vertices. This can be proved by observingthat the sum of internal angles of a simple polygon with n vertices is always ( n − π . Let us assume that thereare only two convex vertices, with angles α, β > . Bythe definition of concave vertex, the sum of the angles ofthe remaining n − vertices must be equal or greater than ( n − π . Summing up the angles of the two convex verticeswe obtain ( n − π + α + β , which is already greater thanthe overall sum of all internal angles of a polygon, ( n − π ,leading to a contradiction. But, if a polygon contains at leastthree convex vertices and exactly two lateral ears, the thirdconvex vertex must be an internal ear. (cid:3) XPERIMENTAL VALIDATION
We have implemented our linearized earcut algorithm andcompared it against the most recent prior art, which con-sists in the algorithm proposed by Shewchuk and Brownin [5]. Just as our algorithm, their method is specialized totriangulate the class of polygons described in Section 5.1,but it is randomized and hence has only expected lineartime complexity. Their algorithm produces a ConstrainedDelaunay Triangulation (CDT) of the input polygon, obtainedusing Chew’s algorithm [18] to tessellate in expected lineartime sub-polygons that violate the Delaunay criterion. Weobserve that a direct comparison would not be fair becauseour constrained triangulations do not necessarily have theDelaunay property. Therefore, we have repimplemented Shewchuk and Brown’s algorithm while omitting Chew’smodule and the incircle tests, so that the algorithm producesonly a general triangulation without the overhead requiredto obtain the Delaunay property. We used this version toconduct our experimental comparison.Both algorithms were implemented in C++, using aMacBook Pro equipped with an Intel Core i5 2.9GHz andwith 16GB of RAM as testing hardware. Considering thesimplicity of our method, turning the pseudo code providedin Algorithm 1 into actual code took us less than one hour (areference implementation can be found inside CinoLib [19]).Also [5] is considered relatively simple to code, and theauthors reported five hours to implement the algorithmstarting from their pseudo code. In our personal experiencewe needed two days of work to fully understand the algo-rithm and make a computer program out of it. ImplementingChew’s submodule (which we omitted) might also requiresome extra time.For the experiments, we followed the same validationscheme used in [5], which measured growth of runningtimes w.r.t. the input size, measuring it on two parametricpolygons with growing number of vertices. Despite thesetwo polygons do not exhaustively represent the class ofcases that can arise in real applications, they are complexenough to reveal critical configurations and bottlenecks [5].For completeness, we also performed a third experiment ‘ inthe wild ‘, using the two triangulation algorithms inside thepipeline for the computation of mesh arrangements proposedin [21], and launching the software on the 4K intersectingmeshes contained in the Thingi10K dataset [20].
Parametric polygons.
We tested both algorithms on theparametric shapes depicted in Figure 5, considering polygonshaving from 10 to 1000 vertices. For each polygon, weaveraged running times across 1000 different runs, so asto void biases depending from external factors. Results areshown in Figure 6. Both algorithms exhibit linear growthin the running times w.r.t. the input size, but our algorithmexhibits less fluctuations and is also sensibly faster. One of
OURNAL OF L A TEX CLASS FILES, VOL. 14, NO. 8, AUGUST 2015 6 -3 Fig. 6. Time comparison between our method (blue) and the randomized algorithm proposed in [5] (red), obtained considering the two polygons inFigure 5. Horizontal axis reports number of polygon vertices, vertical axis running times (in seconds). For each polygon size, we considered theaverage running time over 1000 attempts. Both algorithms exhibit linear growing times w.r.t. to polygon size, but our method is sensibly faster. the possible reasons for this difference is that [5] during itsiterations may produce triangles that conflict with previouslygenerated triangles, which must be removed. This not onlyintroduces unnecessary delays in the algorithm, but alsorequires some sort of mesh data structure to handle thetopological changes and inspect the neighborhood of eachnewly generated triangle in order to check whether a conflictexists or not. In contrast, earcut generates only legal trianglesthat will appear in the output tessellation, and does notrequire any supporting mesh data structure during itsexecution. Note that if a CDT is to be constructed, also ourmethod would need at least the ability to find the verticesopposite to a given edge to perform incircle tests, as wellas an edge flip operator to secure the Delaunay property.Even in that case, no extra cost will be paid to remove illegaltriangles.
Mesh Arrangements in the wild.
Computing a mesharrangement consists in refining an input triangle soup inorder to incorporate intersection points in the connectivity.The typical pipeline works by refining each triangle sepa-rately, adding intersection points first, and then includingconstrained segments that arise when two triangles intersect.This latter step can be accomplished by using constrainedtriangulation algorithms. We run the pipeline proposedin [21] twice, once using our linearized earcut method forsegment insertion, and once using the method proposedin [5]. The time required for the segment insertion step, andthe consequent triangulation of the polygons, in all the 4408intersecting meshes in Thingi10K was 18 minutes with ourmethod, and 23 minutes with [5]. In most of the cases thedifferences between the two methods were negligible (i.e.less than 1e-5 seconds), but overall, our method was fasterin 3969 models out of 4408, showing that even in real cases itcan be consistently faster than prior art.
ONCLUSIONS AND FUTURE WORKS
We presented a novel algorithm to triangulate in determinis-tic linear time a restricted class of planar polygons that arise in the context of constrained triangulations. Tessellations ofthis kind often arise in scientific computing, hence the pro-posed method is of practical relevance. A few deterministiclinear time methods were already known in literature, butthey are all based on complex trapezoidation schemes, andare difficult to implement. As a result, easier (though suboptimal) methods that run in quadratic, logarithmic, or nondeterministic linear time at best are used in practice instead.Our method merges optimality guarantees with ease ofimplementation, because it is based on a further simplifica-tion of the earcut algorithm [3], which is arguably one of theeasiest (though fairly inefficient) triangulation algorithms toimplement. We have shown that by omitting the diagonal testearcut achieves optimality, and can still guarantee the correctresult if the input polygon is in the class of our interest. Wealso provided rigorous proof of our findings, and practicalevidence that the proposed algorithm is indeed faster inpractice. Due to these key features, we expect future codesfor the generation of constrained triangulations to readilyadopt our tool.
This work opens for two interesting lines of future works.On the one side, if similar properties could be provedalso in 3D, this might lead to optimal time algorithmsfor constrained volumetric meshing. This extension is farfrom being obvious though. For the 2D case one of thekey ingredients to prove the convexity of the sub-polygonenclosing a convex vertex was that given an edge, the trianglecontaining it had always its third vertex at the oppositeside of the constrained segment. In 3D constraints can beboth planar polygons or segments. The notion of being atthe opposite side of a segment is not well defined. Moreover,there can be tetrahedra that intersect the constraint andhave two vertices on one side of it and the other two atthe other side. It is not claer how this configuration canbe handled in the current logical scheme of our proof. The
OURNAL OF L A TEX CLASS FILES, VOL. 14, NO. 8, AUGUST 2015 7 second interesting line of research regards parallelization.In [22] a parallel version of the standard earcut method wasintroduced. An adaptation of the same parallelization schemeto our linearized earcut seems possible, and might lead tosub linear segment insertion for constrained triangulation. A CKNOWLEDGMENT
Gianmarco Cherchi gratefully acknowledges the support tohis research by PON R&I 2014-2020 AIM1895943-1. MarcoLivesu and Marco Attene’s work was partly supported byEU ERC Advanced Grant CHANGE No. 694515. R EFERENCES [1] J. R. Shewchuk, “Triangle: Engineering a 2d quality mesh generatorand delaunay triangulator,” in
Workshop on Applied ComputationalGeometry . Springer, 1996, pp. 203–222.[2] J.-D. Boissonnat, O. Devillers, M. Teillaud, and M. Yvinec, “Trian-gulations in cgal,” in
Proceedings of the sixteenth annual symposiumon Computational geometry , 2000, pp. 11–18.[3] D. Eberly, “Triangulation by ear clipping,”
Geometric Tools , pp.2002–2005, 2008.[4] B. Chazelle, “Triangulating a simple polygon in linear time,”
Discrete & Computational Geometry , vol. 6, no. 3, pp. 485–524, 1991.[5] J. R. Shewchuk and B. C. Brown, “Fast segment insertion andincremental construction of constrained delaunay triangulations,”
Computational Geometry , vol. 48, no. 8, pp. 554–574, 2015.[6] M. R. Garey, D. S. Johnson, F. P. Preparata, and R. E. Tarjan,“Triangulating a simple polygon,”
Information Processing Letters ,vol. 7, no. 4, pp. 175–179, 1978.[7] T. Asano, T. Asano, and R. Y. Pinter, “Polygon triangulation:Efficiency and minimality,”
Journal of Algorithms , vol. 7, no. 2, pp.221–231, 1986.[8] A. Fournier and D. Y. Montuno, “Triangulating simple polygonsand equivalent problems,”
ACM Transactions on Graphics (TOG) ,vol. 3, no. 2, pp. 153–174, 1984.[9] R. E. Tarjan and C. J. Van Wyk, “An o(n \ log \ logn)-time algorithmfor triangulating a simple polygon,” SIAM Journal on Computing ,vol. 17, no. 1, pp. 143–178, 1988.[10] N. M. Amato, M. T. Goodrich, and E. A. Ramos, “A randomizedalgorithm for triangulating a simple polygon in linear time,”
Discrete & Computational Geometry , vol. 26, no. 2, pp. 245–265, 2001.[11] ——, “Linear-time triangulation of a simple polygon made easiervia randomization,” in
Proceedings of the sixteenth annual symposiumon Computational geometry , 2000, pp. 201–212.[12] M. V. Anglada, “An improved incremental algorithm for con-structing restricted delaunay triangulations,”
Computers & Graphics ,vol. 21, no. 2, pp. 215–223, 1997.[13] L. De Floriani and E. Puppo, “An on-line algorithm for constraineddelaunay triangulation,”
CVGIP: Graphical Models and Image Process-ing , vol. 54, no. 4, pp. 290–300, 1992.[14] T. C. Kao and D. M. Mount, “Incremental construction and dynamicmaintenance of constrained delaunay triangulations,” in
Proc. 4thCanad. Conf. Comput. Geom , 1992, pp. 170–175.[15] D.-T. Lee and A. K. Lin, “Generalized delaunay triangulation forplanar graphs,”
Discrete & Computational Geometry , vol. 1, no. 3, pp.201–217, 1986.[16] F. Chin and C. A. Wang, “Finding the constrained delaunaytriangulation and constrained voronoi diagram of a simple polygonin linear time,”
SIAM Journal on Computing , vol. 28, no. 2, pp. 471–486, 1998.[17] G. H. Meisters, “Polygons have ears,”
The American MathematicalMonthly , vol. 82, no. 6, pp. 648–651, 1975.[18] L. P. Chew,
Building Voronoi diagrams for convex polygons in linearexpected time . Dartmouth College, Department of Mathematicsand Computer Science, 1990.[19] M. Livesu, “cinolib: a generic programming header onlyc++ library for processing polygonal and polyhedralmeshes,”
Transactions on Computational Science XXXIV , 2019,https://github.com/mlivesu/cinolib/.[20] Q. Zhou and A. Jacobson, “Thingi10k: A dataset of 10,000 3d-printing models,” arXiv preprint arXiv:1605.04797 , 2016. [21] G. Cherchi, M. Livesu, R. Scateni, and M. Attene, “Fast androbust mesh arrangements using floating-point arithmetic,”
ACMTransactions on Graphics (TOG) , (to appear).[22] G. Eder, M. Held, and P. Palfrader, “Parallelized ear clipping for thetriangulation and constrained delaunay triangulation of polygons,”
Computational Geometry , vol. 73, pp. 15–23, 2018.
Marco Livesu is a tenured researcher at theInstitute for Applied Mathematics and InformationTechnologies of the National Research Councilof Italy (CNR IMATI). He received his PhD atUniversity of Cagliari in 2014, after which hewas post doctoral researcher at the Universityof British Columbia, University of Cagliari andCNR IMATI. His main research interests are incomputer graphics and geometry processing.
Gianmarco Cherchi is a computer science re-searcher at the Department of Mathematics andComputer Science of the University of Cagliari(UNICA). He received his Ph.D. at the Univer-sity of Cagliari in 2018. Since his first year ofuniversity, he is collaborating with the CG3HCI(Computer Graphics, Computation Geometry andHuman-Computer Interaction Cagliari Group) Re-search group. His main interests are in computergraphics and geometry processing.
Riccardo Scateni is professor of Computer Sci-ence at the Department of Mathematics andComputer Science of the University of Cagliarisince 2001 where later he founded the CG3HCI(Computer Graphics, Computation Geometry andHuman-Computer Interaction Cagliari Group).Before joining UniCA he was post-doc at IBMKingston, USA, at CERFACS, Toulose and re-searcher and senior resarcher at CRS4, Cagliari,Italy. His current research interests are in geom-etry processing and additive fabrication.