ATLAS Offline Software
PolygonTriangulator.cxx
Go to the documentation of this file.
1 #include "PolygonTriangulator.h"
2 
4 // //
5 // Class: PolygonTriangulator //
6 // //
7 // Description: Triangulates any (non-complex) 2D polygon. //
8 // //
9 // Author: Thomas Kittelmann (Thomas.Kittelmann@cern.ch), March 2007 //
10 // //
11 // Notes: //
12 // //
13 // Actual algorithms are adapted from //
14 // http://www.mema.ucl.ac.be/~wu/Poly2Tri/poly2tri.html //
15 // (see copyright notice below) //
16 // //
17 // Main changes performed for the present incarnation are //
18 // interface & namespace changes, indentation, small //
19 // performance tweaks and removal of unused features. //
20 // Most importantly, got rid of static and globals so the class //
21 // can be reliably used more than once per process. Also, the //
22 // output triangles are sorted to preserve "handedness". //
23 // //
25 
31 //
32 // Poly2Tri:Fast and Robust Simple Polygon triangulation with/without holes
33 // by Sweep Line Algorithm
34 // Liang, Wu
35 // http://www.mema.ucl.ac.be/~wu/Poly2Tri/poly2tri.html
36 // Copyright (C) 2003, 2004, 2005, ALL RIGHTS RESERVED.
37 //
38 // ---------------------------------------------------------------------
39 // wu@mema.ucl.ac.be wuliang@femagsoft.com
40 // Centre for Sys. Eng. & App. Mech. FEMAGSoft S.A.
41 // Universite Cathalique de Louvain 4, Avenue Albert Einstein
42 // Batiment Euler, Avenue Georges Lemaitre, 4 B-1348 Louvain-la-Neuve
43 // B-1348, Louvain-la-Neuve Belgium
44 // Belgium
45 // ---------------------------------------------------------------------
46 //
47 // This program is distributed in the hope that it will be useful, but
48 // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-
49 // TABILITY or FITNESS FOR A PARTICULAR PURPOSE.
50 //
51 // This program may be freely redistributed under the condition that all
52 // the copyright notices in all source files ( including the copyright
53 // notice printed when the `-h' switch is selected) are not removed.Both
54 // the binary and source codes may not be sold or included in any comme-
55 // rcial products without a license from the corresponding author(s) &
56 // entities.
57 //
58 // 1) Arbitrary precision floating-point arithmetic and fast robust geo-
59 // metric predicates (predicates.cc) is copyrighted by
60 // Jonathan Shewchuk (http://www.cs.berkeley.edu/~jrs) and you may get
61 // the source code from http://www.cs.cmu.edu/~quake/robust.html
62 //
63 // 2) The shell script mps2eps is copyrighted by Jon Edvardsson
64 // (http://www.ida.liu.se/~pelab/members/index.php4/?12) and you may
65 // get the copy from http://www.ida.liu.se/~joned/download/mps2eps/
66 //
67 // 3) All other source codes and exmaples files distributed in Poly2Tri
68 // are copyrighted by Liang, Wu (http://www.mema.ucl.ac.be/~wu) and
69 // FEMAGSoft S.A.
70 //
74 
75 #include <algorithm>
76 #include <cmath>
77 #include <map>
78 #include <limits>
79 #include <list>
80 #include <queue>
81 #include <set>
82 #include <iostream>
83 #include <stack>
84 #include <cassert>
85 #include <cstdlib>
86 
87 namespace internal_poltrig {
88 
94 
95  //-------------------------------------------------------------------------/
96  //Copyright (C) 2003, 2004, 2005, ALL RIGHTS RESERVED.
97  //Centre for Sys. Eng. & App. Mech. FEMAGSoft S.A.
98  //Universite Cathalique de Louvain 4, Avenue Albert Einstein
99  //Batiment Euler, Avenue Georges Lemaitre, 4 B-1348 Louvain-la-Neuve
100  //B-1348, Louvain-la-Neuve Belgium
101  //Belgium
102  //-------------------------------------------------------------------------/
103  //Name: defs.h
104  //Purpose: some definition for mesh generation
105  //Author: Wu Liang
106  //Created: 03/2000
107  //-------------------------------------------------------------------------/
108 
109 
110 #define sqr(t) (t)*(t)
111 
113 
114  class Pointbase;
115  class Linebase;
116 
117  template <class T, class KeyType> class SplayTree;
118  typedef std::map<unsigned int, Pointbase*> PointbaseMap;
119  typedef std::map<unsigned int, Linebase*> LineMap;
120  typedef std::priority_queue<Pointbase> PQueue;
122  typedef std::list<unsigned int> Monopoly;
123  typedef std::list<Monopoly> Monopolys;
124  typedef std::vector<unsigned int> Triangle;
125  typedef std::list<Triangle> Triangles;
126  typedef std::map<unsigned int, std::set<unsigned int> > AdjEdgeMap;
127 
128 
134 
135  /*****************************************************************************/
136  /* */
137  /* Routines for Arbitrary Precision Floating-point Arithmetic */
138  /* and Fast Robust Geometric Predicates */
139  /* (predicates.cc) */
140  /* */
141  /* May 18, 1996 */
142  /* */
143  /* Placed in the public domain by */
144  /* Jonathan Richard Shewchuk */
145  /* School of Computer Science */
146  /* Carnegie Mellon University */
147  /* 5000 Forbes Avenue */
148  /* Pittsburgh, Pennsylvania 15213-3891 */
149  /* jrs@cs.cmu.edu */
150  /* */
151  /* This file contains C implementation of algorithms for exact addition */
152  /* and multiplication of floating-point numbers, and predicates for */
153  /* robustly performing the orientation and incircle tests used in */
154  /* computational geometry. The algorithms and underlying theory are */
155  /* described in Jonathan Richard Shewchuk. "Adaptive Precision Floating- */
156  /* Point Arithmetic and Fast Robust Geometric Predicates." Technical */
157  /* Report CMU-CS-96-140, School of Computer Science, Carnegie Mellon */
158  /* University, Pittsburgh, Pennsylvania, May 1996. (Submitted to */
159  /* Discrete & Computational Geometry.) */
160  /* */
161  /* This file, the paper listed above, and other information are available */
162  /* from the Web page http://www.cs.cmu.edu/~quake/robust.html . */
163  /* */
164  /*****************************************************************************/
165 
166  /*****************************************************************************/
167  /* */
168  /* Using this code: */
169  /* */
170  /* First, read the short or long version of the paper (from the Web page */
171  /* above). */
172  /* */
173  /* Be sure to call exactinit() once, before calling any of the arithmetic */
174  /* functions or geometric predicates. Also be sure to turn on the */
175  /* optimizer when compiling this file. */
176  /* */
177  /* */
178  /* Several geometric predicates are defined. Their parameters are all */
179  /* points. Each point is an array of two or three floating-point */
180  /* numbers. The geometric predicates, described in the papers, are */
181  /* */
182  /* orient2d(pa, pb, pc) */
183  /* orient2dfast(pa, pb, pc) */
184  /* orient3d(pa, pb, pc, pd) */
185  /* orient3dfast(pa, pb, pc, pd) */
186  /* incircle(pa, pb, pc, pd) */
187  /* incirclefast(pa, pb, pc, pd) */
188  /* insphere(pa, pb, pc, pd, pe) */
189  /* inspherefast(pa, pb, pc, pd, pe) */
190  /* */
191  /* Those with suffix "fast" are approximate, non-robust versions. Those */
192  /* without the suffix are adaptive precision, robust versions. There */
193  /* are also versions with the suffices "exact" and "slow", which are */
194  /* non-adaptive, exact arithmetic versions, which I use only for timings */
195  /* in my arithmetic papers. */
196  /* */
197  /* */
198  /* An expansion is represented by an array of floating-point numbers, */
199  /* sorted from smallest to largest magnitude (possibly with interspersed */
200  /* zeros). The length of each expansion is stored as a separate integer, */
201  /* and each arithmetic function returns an integer which is the length */
202  /* of the expansion it created. */
203  /* */
204  /* Several arithmetic functions are defined. Their parameters are */
205  /* */
206  /* e, f Input expansions */
207  /* elen, flen Lengths of input expansions (must be >= 1) */
208  /* h Output expansion */
209  /* b Input scalar */
210  /* */
211  /* The arithmetic functions are */
212  /* */
213  /* grow_expansion(elen, e, b, h) */
214  /* grow_expansion_zeroelim(elen, e, b, h) */
215  /* expansion_sum(elen, e, flen, f, h) */
216  /* expansion_sum_zeroelim1(elen, e, flen, f, h) */
217  /* expansion_sum_zeroelim2(elen, e, flen, f, h) */
218  /* fast_expansion_sum(elen, e, flen, f, h) */
219  /* fast_expansion_sum_zeroelim(elen, e, flen, f, h) */
220  /* linear_expansion_sum(elen, e, flen, f, h) */
221  /* linear_expansion_sum_zeroelim(elen, e, flen, f, h) */
222  /* scale_expansion(elen, e, b, h) */
223  /* scale_expansion_zeroelim(elen, e, b, h) */
224  /* compress(elen, e, h) */
225  /* */
226  /* All of these are described in the long version of the paper; some are */
227  /* described in the short version. All return an integer that is the */
228  /* length of h. Those with suffix _zeroelim perform zero elimination, */
229  /* and are recommended over their counterparts. The procedure */
230  /* fast_expansion_sum_zeroelim() (or linear_expansion_sum_zeroelim() on */
231  /* processors that do not use the round-to-even tiebreaking rule) is */
232  /* recommended over expansion_sum_zeroelim(). Each procedure has a */
233  /* little note next to it (in the code below) that tells you whether or */
234  /* not the output expansion may be the same array as one of the input */
235  /* expansions. */
236  /* */
237  /* */
238  /* If you look around below, you'll also find macros for a bunch of */
239  /* simple unrolled arithmetic operations, and procedures for printing */
240  /* expansions (commented out because they don't work with all C */
241  /* compilers) and for generating rand floating-point numbers whose */
242  /* significand bits are all rand. Most of the macros have undocumented */
243  /* requirements that certain of their parameters should not be the same */
244  /* variable; for safety, better to make sure all the parameters are */
245  /* distinct variables. Feel free to send email to jrs@cs.cmu.edu if you */
246  /* have questions. */
247  /* */
248  /*****************************************************************************/
249 
250  /* On some machines, the exact arithmetic routines might be defeated by the */
251  /* use of internal extended precision floating-point registers. Sometimes */
252  /* this problem can be fixed by defining certain values to be volatile, */
253  /* thus forcing them to be stored to memory and rounded off. This isn't */
254  /* a great solution, though, as it slows the arithmetic down. */
255  /* */
256  /* To try this out, write "#define INEXACT volatile" below. Normally, */
257  /* however, INEXACT should be defined to be nothing. ("#define INEXACT".) */
258 
259 #define INEXACT /* Nothing */
260  /* #define INEXACT volatile */
261 
262 #define REAL double /* float or double */
263 
264  /* Which of the following two methods of finding the absolute values is */
265  /* fastest is compiler-dependent. A few compilers can inline and optimize */
266  /* the fabs() call; but most will incur the overhead of a function call, */
267  /* which is disastrously slow. A faster way on IEEE machines might be to */
268  /* mask the appropriate bit, but that's difficult to do in C. */
269 
270 #define Absolute(a) ((a) >= 0.0 ? (a) : -(a))
271  /* #define Absolute(a) fabs(a) */
272 
273  /* Many of the operations are broken up into two pieces, a main part that */
274  /* performs an approximate operation, and a "tail" that computes the */
275  /* roundoff error of that operation. */
276  /* */
277  /* The operations Fast_Two_Sum(), Fast_Two_Diff(), Two_Sum(), Two_Diff(), */
278  /* Split(), and Two_Product() are all implemented as described in the */
279  /* reference. Each of these macros requires certain variables to be */
280  /* defined in the calling routine. The variables `bvirt', `c', `abig', */
281  /* `_i', `_j', `_k', `_l', `_m', and `_n' are declared `INEXACT' because */
282  /* they store the result of an operation that may incur roundoff error. */
283  /* The input parameter `x' (or the highest numbered `x_' parameter) must */
284  /* also be declared `INEXACT'. */
285 
286 #define Fast_Two_Sum_Tail(a, b, x, y) \
287  bvirt = x - a; \
288  y = b - bvirt
289 
290 #define Fast_Two_Sum(a, b, x, y) \
291  x = (REAL) (a + b); \
292  Fast_Two_Sum_Tail(a, b, x, y)
293 
294 #define Two_Sum_Tail(a, b, x, y) \
295  bvirt = (REAL) (x - a); \
296  avirt = x - bvirt; \
297  bround = b - bvirt; \
298  around = a - avirt; \
299  y = around + bround
300 
301 #define Two_Sum(a, b, x, y) \
302  x = (REAL) (a + b); \
303  Two_Sum_Tail(a, b, x, y)
304 
305 #define Two_Diff_Tail(a, b, x, y) \
306  bvirt = (REAL) (a - x); \
307  avirt = x + bvirt; \
308  bround = bvirt - b; \
309  around = a - avirt; \
310  y = around + bround
311 
312 #define Two_Diff(a, b, x, y) \
313  x = (REAL) (a - b); \
314  Two_Diff_Tail(a, b, x, y)
315 
316 
317  // c = (REAL) (splitter * a);
318 
319 #define Split(a, ahi, alo) \
320  c = (REAL) (1.0 * a); \
321  abig = (REAL) (c - a); \
322  ahi = c - abig; \
323  alo = a - ahi
324 
325 #define Two_Product_Tail(a, b, x, y) \
326  Split(a, ahi, alo); \
327  Split(b, bhi, blo); \
328  err1 = x - (ahi * bhi); \
329  err2 = err1 - (alo * bhi); \
330  err3 = err2 - (ahi * blo); \
331  y = (alo * blo) - err3
332 
333 #define Two_Product(a, b, x, y) \
334  x = (REAL) (a * b); \
335  Two_Product_Tail(a, b, x, y)
336 
337  /* Macros for summing expansions of various fixed lengths. These are all */
338  /* unrolled versions of Expansion_Sum(). */
339 
340 #define Two_One_Diff(a1, a0, b, x2, x1, x0) \
341  Two_Diff(a0, b , x_i, x0); \
342  Two_Sum( a1, x_i, x2, x1)
343 
344 #define Two_Two_Diff(a1, a0, b1, b0, x3, x2, x1, x0) \
345  Two_One_Diff(a1, a0, b0, x_j, x_0, x0); \
346  Two_One_Diff(x_j, x_0, b1, x3, x2, x1)
347 
348 
349  //TK: weird globals, never initialised. Just replaced with 1.0 everywhere...
350  // REAL splitter(1); /* = 2^ceiling(p / 2) + 1. Used to split floats in half. */
351  /* A set of coefficients used to calculate maximum roundoff errors. */
352  // REAL resulterrbound;
353  // REAL ccwerrboundA, ccwerrboundB, ccwerrboundC;
354  // REAL o3derrboundA, o3derrboundB, o3derrboundC;
355  // REAL iccerrboundA, iccerrboundB, iccerrboundC;
356  // REAL isperrboundA, isperrboundB, isperrboundC;
357 
358  /*****************************************************************************/
359  /* */
360  /* fast_expansion_sum_zeroelim() Sum two expansions, eliminating zero */
361  /* components from the output expansion. */
362  /* */
363  /* Sets h = e + f. See the long version of my paper for details. */
364  /* */
365  /* If round-to-even is used (as with IEEE 754), maintains the strongly */
366  /* nonoverlapping property. (That is, if e is strongly nonoverlapping, h */
367  /* will be also.) Does NOT maintain the nonoverlapping or nonadjacent */
368  /* properties. */
369  /* */
370  /*****************************************************************************/
371 
372  int fast_expansion_sum_zeroelim(const int& elen, REAL* e, const int& flen, REAL* f, REAL* h)
373  /* h cannot be e or f. */
374  {
375  REAL Q;
376  INEXACT REAL Qnew;
377  INEXACT REAL hh;
378  INEXACT REAL bvirt;
379  REAL avirt, bround, around;
380  int eindex, findex, hindex;
381  REAL enow, fnow;
382 
383  enow = e[0];
384  fnow = f[0];
385  eindex = findex = 0;
386  if ((fnow > enow) == (fnow > -enow)) {
387  Q = enow;
388  enow = e[++eindex];
389  } else {
390  Q = fnow;
391  fnow = f[++findex];
392  }
393  hindex = 0;
394  if ((eindex < elen) && (findex < flen)) {
395  if ((fnow > enow) == (fnow > -enow)) {
396  Fast_Two_Sum(enow, Q, Qnew, hh);
397  enow = e[++eindex];
398  } else {
399  Fast_Two_Sum(fnow, Q, Qnew, hh);
400  fnow = f[++findex];
401  }
402  Q = Qnew;
403  if (hh != 0.0) {
404  h[hindex++] = hh;
405  }
406  while ((eindex < elen) && (findex < flen)) {
407  if ((fnow > enow) == (fnow > -enow)) {
408  Two_Sum(Q, enow, Qnew, hh);
409  enow = e[++eindex];
410  } else {
411  Two_Sum(Q, fnow, Qnew, hh);
412  fnow = f[++findex];
413  }
414  Q = Qnew;
415  if (hh != 0.0) {
416  h[hindex++] = hh;
417  }
418  }
419  }
420  while (eindex < elen) {
421  Two_Sum(Q, enow, Qnew, hh);
422  enow = e[++eindex];
423  Q = Qnew;
424  if (hh != 0.0) {
425  h[hindex++] = hh;
426  }
427  }
428  while (findex < flen) {
429  Two_Sum(Q, fnow, Qnew, hh);
430  fnow = f[++findex];
431  Q = Qnew;
432  if (hh != 0.0) {
433  h[hindex++] = hh;
434  }
435  }
436  if ((Q != 0.0) || (hindex == 0)) {
437  h[hindex++] = Q;
438  }
439  return hindex;
440  }
441 
442 
443  /*****************************************************************************/
444  /* */
445  /* estimate() Produce a one-word estimate of an expansion's value. */
446  /* */
447  /* See either version of my paper for details. */
448  /* */
449  /*****************************************************************************/
450 
451  REAL estimate(const int& elen, REAL* e)
452  {
453  REAL Q;
454  int eindex;
455 
456  Q = e[0];
457  for (eindex = 1; eindex < elen; ++eindex) {
458  Q += e[eindex];
459  }
460  return Q;
461  }
462 
463  /*****************************************************************************/
464  /* */
465  /* orient2dfast() Approximate 2D orientation test. Nonrobust. */
466  /* orient2dexact() Exact 2D orientation test. Robust. */
467  /* orient2dslow() Another exact 2D orientation test. Robust. */
468  /* orient2d() Adaptive exact 2D orientation test. Robust. */
469  /* */
470  /* Return a positive value if the points pa, pb, and pc occur */
471  /* in counterclockwise order; a negative value if they occur */
472  /* in clockwise order; and zero if they are collinear. The */
473  /* result is also a rough approximation of twice the signed */
474  /* area of the triangle defined by the three points. */
475  /* */
476  /* Only the first and last routine should be used; the middle two are for */
477  /* timings. */
478  /* */
479  /* The last three use exact arithmetic to ensure a correct answer. The */
480  /* result returned is the determinant of a matrix. In orient2d() only, */
481  /* this determinant is computed adaptively, in the sense that exact */
482  /* arithmetic is used only to the degree it is needed to ensure that the */
483  /* returned value has the correct sign. Hence, orient2d() is usually quite */
484  /* fast, but will run more slowly when the input points are collinear or */
485  /* nearly so. */
486  /* */
487  /*****************************************************************************/
488 
489  REAL orient2dadapt(REAL* pa, REAL* pb, REAL* pc, const REAL& detsum)
490  {
491  INEXACT REAL acx, acy, bcx, bcy;
492  REAL acxtail, acytail, bcxtail, bcytail;
493  INEXACT REAL detleft, detright;
494  REAL detlefttail, detrighttail;
495  REAL det, errbound;
496  REAL B[4], C1[8], C2[12], D[16];
497  INEXACT REAL B3;
498  int C1length, C2length, Dlength;
499  REAL u[4];
500  INEXACT REAL u3;
501  INEXACT REAL s1, t1;
502  REAL s0, t0;
503 
504  INEXACT REAL bvirt;
505  REAL avirt, bround, around;
506  INEXACT REAL c;
507  INEXACT REAL abig;
508  REAL ahi, alo, bhi, blo;
509  REAL err1, err2, err3;
510  INEXACT REAL x_i, x_j;
511  REAL x_0;
512 
513  acx = (REAL) (pa[0] - pc[0]);
514  bcx = (REAL) (pb[0] - pc[0]);
515  acy = (REAL) (pa[1] - pc[1]);
516  bcy = (REAL) (pb[1] - pc[1]);
517 
518  Two_Product(acx, bcy, detleft, detlefttail);
519  Two_Product(acy, bcx, detright, detrighttail);
520 
521  Two_Two_Diff(detleft, detlefttail, detright, detrighttail,
522  B3, B[2], B[1], B[0]);
523  B[3] = B3;
524 
525  det = estimate(4, B);
526  // errbound = ccwerrboundB * detsum;
527  errbound = detsum;
528  if ((det >= errbound) || (-det >= errbound)) {
529  return det;
530  }
531 
532  Two_Diff_Tail(pa[0], pc[0], acx, acxtail);
533  Two_Diff_Tail(pb[0], pc[0], bcx, bcxtail);
534  Two_Diff_Tail(pa[1], pc[1], acy, acytail);
535  Two_Diff_Tail(pb[1], pc[1], bcy, bcytail);
536 
537  if ((acxtail == 0.0) && (acytail == 0.0)
538  && (bcxtail == 0.0) && (bcytail == 0.0)) {
539  return det;
540  }
541 
542  // errbound = ccwerrboundC * detsum + resulterrbound * Absolute(det);
543  errbound = detsum + Absolute(det);
544  det += (acx * bcytail + bcy * acxtail)
545  - (acy * bcxtail + bcx * acytail);
546  if ((det >= errbound) || (-det >= errbound)) {
547  return det;
548  }
549 
550  Two_Product(acxtail, bcy, s1, s0);
551  Two_Product(acytail, bcx, t1, t0);
552  Two_Two_Diff(s1, s0, t1, t0, u3, u[2], u[1], u[0]);
553  u[3] = u3;
554  C1length = fast_expansion_sum_zeroelim(4, B, 4, u, C1);
555 
556  Two_Product(acx, bcytail, s1, s0);
557  Two_Product(acy, bcxtail, t1, t0);
558  Two_Two_Diff(s1, s0, t1, t0, u3, u[2], u[1], u[0]);
559  u[3] = u3;
560  C2length = fast_expansion_sum_zeroelim(C1length, C1, 4, u, C2);
561 
562  Two_Product(acxtail, bcytail, s1, s0);
563  Two_Product(acytail, bcxtail, t1, t0);
564  Two_Two_Diff(s1, s0, t1, t0, u3, u[2], u[1], u[0]);
565  u[3] = u3;
566  Dlength = fast_expansion_sum_zeroelim(C2length, C2, 4, u, D);
567 
568  return(D[Dlength - 1]);
569  }
570 
572  {
573  REAL detleft, detright, det;
574  REAL detsum, errbound;
575 
576  detleft = (pa[0] - pc[0]) * (pb[1] - pc[1]);
577  detright = (pa[1] - pc[1]) * (pb[0] - pc[0]);
578  det = detleft - detright;
579 
580  if (detleft > 0.0) {
581  if (detright <= 0.0) {
582  return det;
583  } else {
584  detsum = detleft + detright;
585  }
586  } else if (detleft < 0.0) {
587  if (detright >= 0.0) {
588  return det;
589  } else {
590  detsum = -detleft - detright;
591  }
592  } else {
593  return det;
594  }
595 
596  // errbound = ccwerrboundA * detsum;
597  errbound = detsum;
598  if ((det >= errbound) || (-det >= errbound)) {
599  return det;
600  }
601 
602  return orient2dadapt(pa, pb, pc, detsum);
603  }
604 
605 
607 
613 
614  //-------------------------------------------------------------------------/
615  //Copyright (C) 2003, 2004, 2005, ALL RIGHTS RESERVED.
616  //Centre for Sys. Eng. & App. Mech. FEMAGSoft S.A.
617  //Universite Cathalique de Louvain 4, Avenue Albert Einstein
618  //Batiment Euler, Avenue Georges Lemaitre, 4 B-1348 Louvain-la-Neuve
619  //B-1348, Louvain-la-Neuve Belgium
620  //Belgium
621  //-------------------------------------------------------------------------/
622  //
623  //Name: splay.h (self-adjusting balanced binary search tree)
624  //Purpose: declaration and implentation of splay tree class for fast
625  // binary searching
626  //Author: Liang, Wu (wu@mema.ucl.ac.be, wuliang@femagsoft.com)
627  //Created: 03/2002
628  //Modified: 2003, 2004, 2005
629  //-------------------------------------------------------------------------/
630 
631  template <class T, class KeyType>
632  class SplayTree;
633 
634  template <class T, class KeyType>
635  class BTreeNode
636  {
637  public:
638  friend class SplayTree<T, KeyType>;
639  BTreeNode( ) : m_data(), m_left( NULL ), m_right( NULL ), m_visited(false) { }
640  BTreeNode( const T & data, BTreeNode *lt, BTreeNode *rt )
641  : m_data(data),m_left( lt ), m_right( rt ), m_visited(false) { }
642 
643  T& data() { return m_data; }
644  BTreeNode* Left() { return m_left; }
645  BTreeNode* Right() { return m_right; }
646  void SetVisited(const bool& visited) { m_visited=visited; }
647  bool GetVisited() { return m_visited; }
648  KeyType keyValue() { return m_data->keyValue(); }
649 
650  private:
654  bool m_visited;
655 
656  };
657 
658 
659  template <class T, class KeyType>
660  class SplayTree
661  {
662  public:
663  explicit SplayTree( ):m_root(NULL),m_size(0) { }
664  SplayTree( const SplayTree & rhs );
665  ~SplayTree( );
666 
667  void MakeEmpty( );
668  bool IsEmpty( ) const;
669  long int Size() { return m_size; }
671 
672  void Find( const KeyType& keys, BTreeNode<T, KeyType>* & res);
675  // We only use this function for polygon Triangulation to find the direct
676  // left edge of an event vertex;
677  void FindMaxSmallerThan( const KeyType& keys, BTreeNode<T, KeyType>* &res);
678 
679  void Insert( const T & x );
680  void Delete( const KeyType& keys);
681  void Delete( const KeyType& keys, BTreeNode<T, KeyType>* &res);
684 
685  const SplayTree & operator=( const SplayTree & rhs );
686  void PreOrder( void(*Visit)(BTreeNode<T,KeyType> *u) )
687  { PreOrder(Visit, m_root); }
688  void InOrder( void(*Visit)(BTreeNode<T,KeyType> *u) )
689  { InOrder(Visit, m_root); }
690 
691  void InOrder( void(*Visit)(BTreeNode<T,KeyType>*u, double y), double y)
692  { InOrder(Visit, m_root, y); }
693 
694  void PostOrder( void(*Visit)(BTreeNode<T,KeyType> *u) )
695  { PostOrder(Visit, m_root); }
696 
697  int Height( ) const { return Height(m_root); } //height of root
698  int Height(BTreeNode<T, KeyType> *t) const; //Height of subtree t;
701 
702  private:
704  long int m_size{};
705 
706  void reclaimMemory( BTreeNode<T, KeyType> * t ) const;
708 
709  //Transverse
710  void PreOrder( void(*Visit)(BTreeNode<T, KeyType> *u), BTreeNode<T, KeyType> *t);
711  void InOrder( void(*Visit)(BTreeNode<T, KeyType> *u), BTreeNode<T, KeyType> *t);
712  void PostOrder( void(*Visit)(BTreeNode<T, KeyType> *u), BTreeNode<T, KeyType> *t);
713 
714  void InOrder( void(*Visit)(BTreeNode<T, KeyType>*, double y),
715  BTreeNode<T, KeyType> *t, double y);
716 
717 
718 
719  // Tree manipulations
720  void rotateWithLeftChild( BTreeNode<T, KeyType> * & k2 ) const;
721  void rotateWithRightChild( BTreeNode<T, KeyType> * & k1 ) const;
722  void splay( const KeyType& keys, BTreeNode<T, KeyType> * & t ) const;
723  };
724 
725  //----------------------------------------------------------------------
726  //Constructor;
727  //----------------------------------------------------------------------
728  template <class T, class KeyType>
730  {
731  *this = rhs;
732  }
733 
734  //-----------------------------------------------------------------------
735  //Destructor.
736  //-----------------------------------------------------------------------
737  template <class T, class KeyType>
739  {
740  MakeEmpty( );
741  }
742 
743  //------------------------------------------------------------------------
744  //Insert x into the tree.
745  //------------------------------------------------------------------------
746  template <class T, class KeyType>
748  {
749 
751  newNode->m_data=x;
752 
753  if( m_root == NULL )
754  {
755  newNode->m_left = newNode->m_right = NULL;
756  m_root = newNode; ++m_size;
757  }
758  else
759  {
760  KeyType keys=x->keyValue();
761  splay( keys, m_root );
762  KeyType rootk=m_root->keyValue();
763  if( keys < rootk )
764  {
765  newNode->m_left = m_root->m_left;
766  newNode->m_right = m_root;
767  m_root->m_left = NULL;
768  m_root = newNode;
769  ++m_size;
770  }
771  else if( keys > rootk )
772  {
773 
774  newNode->m_right = m_root->m_right;
775  newNode->m_left = m_root;
776  m_root->m_right = NULL;
777  m_root = newNode;
778  ++m_size;
779  }
780  else
781  {
782  delete newNode;//TK: don't leak
783 
784  //slight incresed the keyvalue to avoid duplicated keys
785  x->increaseKeyValue(1.0e-10);
786  Insert(x);
787 
788  }
789  }
790  }
791 
792  //---------------------------------------------------------------------
793  //Remove the node with the keys from the tree, and retrieve the result
794  //---------------------------------------------------------------------
795  template <class T, class KeyType>
797  {
799 
800  splay( keys, m_root );
801  if( m_root->keyValue() != keys ) { res=NULL; return; } // Item not found; do nothing
802 
803  res = m_root;
804 
805  if( m_root->m_left == NULL )
806  newTree = m_root->m_right;
807  else
808  {
809  // Find the maximum in the m_left subtree
810  // Splay it to the root; and then attach m_right child
811  newTree = m_root->m_left;
812  splay( keys, newTree );
813  newTree->m_right = m_root->m_right;
814  }
815 
816  m_root = newTree;
817  m_size--;
818  }
819 
820  //---------------------------------------------------------------------
821  //Remove the node with the keys from the tree.
822  //---------------------------------------------------------------------
823  template <class T, class KeyType>
824  void SplayTree<T, KeyType>::Delete( const KeyType& keys)
825  {
827 
828  splay( keys, m_root );
829  KeyType rootk=m_root->keyValue();
830  if( rootk != keys ) { return; } // Item not found; do nothing
831 
832  if( m_root->m_left == NULL ) newTree = m_root->m_right;
833  else
834  {
835  // Find the maximum in the _left subtree
836  // Splay it to the root; and then attach _right child
837  newTree = m_root->m_left;
838  splay( keys, newTree );
839  newTree->m_right = m_root->m_right;
840  }
841 
842  delete m_root;
843  m_root = newTree;
844  m_size--;
845  }
846 
847 
848 
849  //---------------------------------------------------------------------
850  //Find and Delete the node with min keys from the tree;
851  //---------------------------------------------------------------------
852  template <class T, class KeyType>
854  {
855  if( IsEmpty( ) ) { min=NULL; return; }
856 
857  double keys=-1.0e30;
858  splay( keys, m_root );
859 
860  min = m_root;
861 
863  if( m_root->m_left == NULL ) newTree = m_root->m_right;
864  else
865  {
866  newTree = m_root->m_left;
867  splay( keys, newTree );
868  newTree->m_right = m_root->m_right;
869  }
870 
871  m_size--;
872  m_root = newTree;
873 
874  }
875 
876  //----------------------------------------------------------------------
877  //Find and Delete the node with max keys from the tree;
878  //----------------------------------------------------------------------
879  template <class T, class KeyType>
881  {
882  if( IsEmpty( ) ) { max=NULL; return; }
883 
884  double keys=1.0e30;
885  splay( keys, m_root );
886 
887  max = m_root;
888 
890  if( m_root->m_left == NULL ) newTree = m_root->m_right;
891  else
892  {
893  newTree = m_root->m_left;
894  splay( keys, newTree );
895  newTree->m_right = m_root->m_right;
896  }
897  m_size--;
898  m_root = newTree;
899  }
900 
901 
902  //----------------------------------------------------------------------
903  //Find the smallest item in the tree, but won't delete it from the tree.
904  //----------------------------------------------------------------------
905  template <class T, class KeyType>
907  {
908  if( IsEmpty( ) ) { min=NULL; return; }
909  BTreeNode<T, KeyType> *ptr = m_root;
910 
911  while( ptr->m_left != NULL ) ptr = ptr->m_left;
912  splay( ptr->keyValue(), m_root );
913  min = ptr;
914  }
915 
916  //----------------------------------------------------------------------
917  //Find the largest item in the tree. but won't delete it from the tree.
918  //----------------------------------------------------------------------
919  template <class T, class KeyType>
921  {
922  if( IsEmpty( ) ) { max=NULL; return; }
923 
924  BTreeNode<T, KeyType> *ptr = m_root;
925  while( ptr->m_right != NULL ) ptr = ptr->m_right;
926  splay( ptr->keyValue(), m_root );
927  max = ptr;
928  }
929 
930  //--------------------------------------------------------------------
931  //Find the node with the keys in the tree.
932  //res==NULL if it donesn't exist in the tree;
933  //--------------------------------------------------------------------
934  template <class T, class KeyType>
936  {
937  if( IsEmpty( ) ) { res=NULL; return; }
938  splay( keys, m_root );
939  if( m_root->keyValue() != keys ) { res=NULL; return; }
940  else res = m_root;
941  }
942 
943  //--------------------------------------------------------------------
944  //Find the maximum node smaller than or equal to the given key.
945  //This function specially designed for polygon Triangulation to
946  //find the direct left edge at event vertex;
947  //--------------------------------------------------------------------
948  template <class T, class KeyType>
950  {
951  if( IsEmpty( ) ) { res=NULL; return; }
952  splay( keys, m_root );
953 
954  if( m_root->data()->keyValue() < keys) res=m_root;
955  else if(m_root->m_left)
956  {
957  res=m_root->m_left;
958  while(res->m_right) res=res->m_right;
959  }
960  else
961  {
962  assert(false);
963  }
964  }
965 
966  //--------------------------------------------------------------------
967  //Make the tree logically empty.
968  //--------------------------------------------------------------------
969  template <class T, class KeyType>
971  {
973  while( !IsEmpty( ) )
974  {
975  DeleteMax(ptr);
976  delete ptr;
977  }
978  }
979 
980  //---------------------------------------------------------------------
981  //Test if the tree is logically empty.
982  //---------------------------------------------------------------------
983  template <class T, class KeyType>
985  {
986  return m_root == NULL;
987  }
988 
989  //----------------------------------------------------------------------
990  //copy overload operator.
991  //----------------------------------------------------------------------
992  template <class T, class KeyType>
994  {
995  if( this != &rhs )
996  {
997  MakeEmpty( );
998  m_root = clone( rhs.m_root );
999  m_size = rhs.m_size;
1000  }
1001 
1002  return *this;
1003  }
1004 
1005  //-----------------------------------------------------------------------
1006  //Internal method to perform a top-down splay.
1007  //x is the key of target node to splay around.
1008  //t is the root of the subtree to splay.
1009  //-----------------------------------------------------------------------
1010  template <class T, class KeyType>
1011  void SplayTree<T, KeyType>::splay( const KeyType& keys, BTreeNode<T, KeyType> * & t ) const
1012  {
1013  BTreeNode<T, KeyType> *leftTreeMax, *rightTreeMin;
1014  // static BTreeNode<T, KeyType> header;
1015  BTreeNode<T, KeyType> header;//TK: Removed static keyword. Rather a bit slower than thread problems...
1016 
1017  header.m_left = header.m_right = NULL;
1018  leftTreeMax = rightTreeMin = &header;
1019 
1020  for( ; ; )
1021  {
1022  KeyType rkey=t->keyValue();
1023  if( keys < rkey )
1024  {
1025  if(t->m_left == NULL) break;
1026  if( keys < t->m_left->keyValue() ) rotateWithLeftChild( t );
1027  if( t->m_left == NULL ) break;
1028 
1029  // Link Right
1030  rightTreeMin->m_left = t;
1031  rightTreeMin = t;
1032  t = t->m_left;
1033  }
1034  else if( keys > rkey )
1035  {
1036  if( t->m_right == NULL ) break;
1037  if( keys > t->m_right->keyValue() ) rotateWithRightChild( t );
1038  if( t->m_right == NULL ) break;
1039 
1040  // Link Left
1041  leftTreeMax->m_right = t;
1042  leftTreeMax = t;
1043  t = t->m_right;
1044  }
1045  else break;
1046  }
1047 
1048  leftTreeMax->m_right = t->m_left;
1049  rightTreeMin->m_left = t->m_right;
1050  t->m_left = header.m_right;
1051  t->m_right = header.m_left;
1052 
1053  }
1054 
1055  //--------------------------------------------------------------------
1056  //Rotate binary tree node with m_left child.
1057  //--------------------------------------------------------------------
1058  template <class T, class KeyType>
1060  {
1061  BTreeNode<T, KeyType> *k1 = k2->m_left;
1062  k2->m_left = k1->m_right;
1063  k1->m_right = k2;
1064  k2 = k1;
1065  }
1066 
1067  //---------------------------------------------------------------------
1068  //Rotate binary tree node with m_right child.
1069  //---------------------------------------------------------------------
1070  template <class T, class KeyType>
1072  {
1073  BTreeNode<T, KeyType> *k2 = k1->m_right;
1074  k1->m_right = k2->m_left;
1075  k2->m_left = k1;
1076  k1 = k2;
1077  }
1078 
1079  //----------------------------------------------------------------------
1080  //Internal method to reclaim internal nodes in subtree t.
1081  //WARNING: This is prone to running out of stack space.
1082  //----------------------------------------------------------------------
1083  template <class T, class KeyType>
1085  {
1086  if( t != t->m_left )
1087  {
1088  reclaimMemory( t->m_left );
1089  reclaimMemory( t->m_right );
1090  delete t;
1091  }
1092  }
1093 
1094  //-----------------------------------------------------------------------
1095  //Internal method to clone subtree.
1096  //WARNING: This is prone to running out of stack space.
1097  //-----------------------------------------------------------------------
1098  template <class T, class KeyType>
1100  {
1101  if( t == t->m_left ) // Cannot test against NULLNode!!!
1102  return NULL;
1103  else
1104  return new BTreeNode<T, KeyType>( t->_data, clone( t->m_left ), clone( t->m_right ) );
1105  }
1106 
1107  //-----------------------------------------------------------------------
1108  //Tranverse the tree by pre-order method;
1109  //-----------------------------------------------------------------------
1110  template<class T, class KeyType>
1112  {
1113  if(t!=NULL)
1114  {
1115  Visit(t);
1116  PreOrder(Visit,t->m_left);
1117  PreOrder(Visit,t->m_right);
1118  }
1119 
1120  }
1121 
1122  //-----------------------------------------------------------------------
1123  //Tranverse the tree by in-order method;
1124  //-----------------------------------------------------------------------
1125  template<class T, class KeyType>
1127  {
1128  if(t!=NULL)
1129  {
1130  InOrder(Visit,t->m_left);
1131  Visit(t);
1132  InOrder(Visit,t->m_right);
1133  }
1134  }
1135 
1136 
1137  //-----------------------------------------------------------------------
1138  //Tranverse the tree by in-order method;
1139  //-----------------------------------------------------------------------
1140  template<class T, class KeyType>
1141  void SplayTree<T, KeyType>::InOrder( void(*Visit)(BTreeNode<T, KeyType>*u, double y)
1142  , BTreeNode<T, KeyType> *t, double y)
1143  {
1144  if(t!=NULL)
1145  {
1146  InOrder(Visit,t->m_left, y);
1147  Visit(t, y);
1148  InOrder(Visit,t->m_right, y);
1149  }
1150  }
1151 
1152 
1153 
1154  //-----------------------------------------------------------------------
1155  //Tranverse the tree by post-order method;
1156  //-----------------------------------------------------------------------
1157  template<class T, class KeyType>
1159  {
1160  if(t!=NULL)
1161  {
1162  PostOrder(Visit,t->m_left);
1163  PostOrder(Visit,t->m_right);
1164  Visit(t);
1165  }
1166  }
1167 
1168  //-----------------------------------------------------------------------
1169  //return the height of subtree
1170  //-----------------------------------------------------------------------
1171  template<class T, class KeyType>
1173  {
1174  if(subtree==NULL) return 0;
1175  int lh=Height(subtree->m_left);
1176  int rh=Height(subtree->m_right);
1177 
1178  return (lh>rh)?(++lh):(++rh);
1179  }
1180 
1181 
1187 
1188  //-------------------------------------------------------------------------/
1189  //Copyright (C) 2003, 2004, 2005, ALL RIGHTS RESERVED.
1190  //Centre for Sys. Eng. & App. Mech. FEMAGSoft S.A.
1191  //Universite Cathalique de Louvain 4, Avenue Albert Einstein
1192  //Batiment Euler, Avenue Georges Lemaitre, 4 B-1348 Louvain-la-Neuve
1193  //B-1348, Louvain-la-Neuve Belgium
1194  //Belgium
1195  //-------------------------------------------------------------------------/
1196  //
1197  //Name: geometry.h (all geometry premitives related polygon triang-
1198  // ulation by sweep line algorithm)
1199  //Author: Liang, Wu (wu@mema.ucl.ac.be, wuliang@femagsoft.com)
1200  //Created: 03/2001
1201  //Modified: 10/2005. Modified and simplified only for polygon triangul-
1202  // ation purpose.
1203  //-------------------------------------------------------------------------/
1204 
1205 
1206  //base class for points;
1208  {
1209  public:
1210  //constructors and destructor
1211  Pointbase() :id(0),x(0),y(0),type(UNKNOWN),left(true) {}
1212  Pointbase(const Pointbase& pb);
1213  Pointbase & operator=(const Pointbase &) = default;
1214 
1215  Pointbase(const double& xx, const double& yy)
1216  :id(0), x(xx), y(yy), type(UNKNOWN), left(true) { }
1217 
1218  Pointbase(const int& idd, const double& xx, const double& yy)
1219  :id(idd), x(xx), y(yy), type(UNKNOWN),left(true) { }
1220 
1221  Pointbase(const double& xx, const double& yy, const Type& ttype)
1222  :id(0), x(xx), y(yy), type(ttype),left(true) { }
1223 
1224  Pointbase(const int& idd, const double& xx, const double& yy, const Type& ttype)
1225  :id(idd),x(xx), y(yy), type(ttype),left(true) { }
1226 
1227  //operator overloading
1228  friend bool operator==(const Pointbase&, const Pointbase&);
1229  friend bool operator>(const Pointbase&, const Pointbase&);
1230  friend bool operator<(const Pointbase&, const Pointbase&);
1231  friend bool operator!=(const Pointbase&, const Pointbase&);
1232 
1233  //public data
1234  unsigned int id; //id of point;
1235  double x, y; //coordinates;
1236  Type type; //type of points;
1237  bool left; //left chain or not;
1238 
1239  };
1240 
1241 
1242  //base class for polygon boundary
1243  //Linebase class is a directed line segment with start/end point
1244  class Linebase
1245  {
1246  public:
1247  //constructors and destructor
1248  Linebase();
1249  Linebase(Pointbase* ep1, Pointbase* ep2, const Type& type,long int & l_id);
1250  Linebase(const Linebase& line);
1251  Linebase & operator=(const Linebase& ) = delete;
1253 
1254  unsigned int id() const { return m_id; }
1255 
1256  //two end points
1257  Pointbase* endPoint(const int& i) const { return m_endp[i]; }
1258  Type type() const { return m_type; }
1259  double keyValue() const { return m_key; }
1260  void setKeyValue(const double& y);
1261  //slightly increased the key to avoid duplicated key for searching tree.
1262  void increaseKeyValue(const double& diff) { m_key+=diff; }
1263  //reverse a directed line segment; reversable only for inserted diagonals
1264  void reverse();
1265 
1266  //set and return helper of a directed line segment;
1267  void setHelper(const unsigned int& i) { m_helper=i; }
1268  unsigned int helper() { return m_helper; }
1269 
1270  protected:
1271  unsigned int m_id; //id of a line segment;
1272  Pointbase* m_endp[2]; //two end points;
1273 
1274  Type m_type; //type of a line segement, input/insert
1275  double m_key; //key of a line segment for splay tree searching
1276  unsigned int m_helper; //helper of a line segemnt
1277  };
1278 
1284 
1285  //-------------------------------------------------------------------------/
1286  //Copyright (C) 2003, 2004, 2005, ALL RIGHTS RESERVED.
1287  //Centre for Sys. Eng. & App. Mech. FEMAGSoft S.A.
1288  //Universite Cathalique de Louvain 4, Avenue Albert Einstein
1289  //Batiment Euler, Avenue Georges Lemaitre, 4 B-1348 Louvain-la-Neuve
1290  //B-1348, Louvain-la-Neuve Belgium
1291  //Belgium
1292  //-------------------------------------------------------------------------/
1293  //
1294  //Name: geometry.cc (all geometry premitive implementations related
1295  // to polygon triangulation by sweep line algorithm)
1296  //Author: Liang, Wu (wu@mema.ucl.ac.be, wuliang@femagsoft.com)
1297  //Created: 03/2001
1298  //Modified: 10/2005. Modified and simplified only for polygon triangul-
1299  // ation purpose.
1300  //-------------------------------------------------------------------------/
1301 
1302 
1303  //Jonathan schewchuk's exact arithmetic code, see predicates.cc for details;
1304  extern double orient2d(double* pa, double* pb, double* pc);
1305 
1306  //----------------------------------------------------------------------------
1307  //square of the distance of two points;
1308  //----------------------------------------------------------------------------
1309  double dist_sqr(const Pointbase& sp, const Pointbase& ep)
1310  {
1311  return sqr(sp.x-ep.x)+sqr(sp.y-ep.y);
1312  }
1313 
1314  //----------------------------------------------------------------------------
1315  //square of the distance of two points;
1316  //----------------------------------------------------------------------------
1317  double dist_sqr(double *pa, double *pb)
1318  {
1319  return sqr(pa[0]-pb[0])+sqr(pa[1]-pb[1]);
1320  }
1321 
1323  {
1324  node->data()->setKeyValue(y);
1325  }
1326 
1327  //----------------------------------------------------------------------------
1328  //copy constructor
1329  //----------------------------------------------------------------------------
1331  {
1332  this->id=pb.id;
1333  this->x=pb.x;
1334  this->y=pb.y;
1335  this->type=pb.type;
1336  this->left=pb.left;
1337  }
1338 
1339  //----------------------------------------------------------------------------
1340  //operator ( ==, >, < and != ) overloading for pointbase class
1341  //----------------------------------------------------------------------------
1342  bool operator==(const Pointbase& pa, const Pointbase& pb)
1343  {
1344  return (pa.x==pb.x && pa.y==pb.y);
1345  }
1346 
1347  //----------------------------------------------------------------------------
1348  bool operator>(const Pointbase& pa, const Pointbase& pb)
1349  {
1350  return( (pa.y > pb.y) || ( (pa.y==pb.y) && (pa.x < pb.x)) );
1351  }
1352 
1353  //----------------------------------------------------------------------------
1354  bool operator<(const Pointbase& pa, const Pointbase& pb)
1355  {
1356  return( (pa.y < pb.y) || ( (pa.y==pb.y) && (pa.x > pb.x)) );
1357  }
1358 
1359  //----------------------------------------------------------------------------
1360  bool operator!=(const Pointbase& pa, const Pointbase& pb)
1361  {
1362  return !(pa.x==pb.x && pa.y==pb.y);
1363  }
1364 
1365  //----------------------------------------------------------------------------
1366  //Linebase construct
1367  //----------------------------------------------------------------------------
1368  Linebase::Linebase():m_type(UNKNOWN), m_key(0), m_helper(0)
1369  {
1370  for(int i=0; i<2; ++i) m_endp[i]=0;
1371  m_id=0;
1372  }
1373 
1374  //-----------------------------------------------------------------------------
1375  //Linebase construct
1376  //-----------------------------------------------------------------------------
1377  Linebase::Linebase(Pointbase* sp, Pointbase* ep, const Type& type, long int & l_id):m_type(type), m_key(0), m_helper(0)
1378  {
1379  m_endp[0]=sp;
1380  m_endp[1]=ep;
1381  m_id=++l_id;
1382  }
1383 
1384  //----------------------------------------------------------------------------
1385  //copy constructor
1386  //----------------------------------------------------------------------------
1388  {
1389  this->m_id=line.m_id;
1390  this->m_endp[0]=line.m_endp[0];
1391  this->m_endp[1]=line.m_endp[1];
1392  this->m_key=line.m_key;
1393  this->m_type=line.m_type;
1394  this->m_helper=line.m_helper;
1395  }
1396 
1397 
1398  //----------------------------------------------------------------------------
1399  //reverse a directed line segment, reverseable only for insert diagonals
1400  //----------------------------------------------------------------------------
1402  {
1403  assert(m_type==INSERT);
1404  Pointbase* tmp=m_endp[0];
1405  m_endp[0]=m_endp[1];
1406  m_endp[1]=tmp;
1407  }
1408 
1409  void Linebase::setKeyValue(const double& y)
1410  {
1411  if( m_endp[1]->y==m_endp[0]->y )
1412  m_key=m_endp[0]->x < m_endp[1]->x ? m_endp[0]->x:m_endp[1]->x;
1413  else m_key=( y - m_endp[0]->y ) * ( m_endp[1]->x - m_endp[0]->x ) / (m_endp[1]->y - m_endp[0]->y ) + m_endp[0]->x;
1414  }
1415 
1416 }//end namespace internal_poltrig
1417 
1419 {
1420 public:
1421  //constructor and destructor
1422  Polygon(const std::vector<double>& x,const std::vector<double>& y);
1423  ~Polygon();
1424 
1425  // main member function for polygon triangulation;
1426  void partition2Monotone();
1427  void searchMonotones();
1428  void triangulation();
1429 
1430  //return all triangles
1431  const Triangles* triangles() { return &m_triangles; }
1432 
1435 
1436  //private member functions.
1437 private:
1438  long int m_l_id;//previous a global, but that gives mem. crashes. Must be reinitted for every polygon.
1439 
1440  void set_contour (const std::vector<double>& x,const std::vector<double>& y);
1441  void initializate();
1442 
1443  //prev or next point/edge id for a given ith point/edge;
1444  unsigned int prev(const unsigned int& i);
1445  unsigned int next(const unsigned int& i);
1446 
1447  //handle event vertext according to vertex type;
1448  void handleStartVertex(const unsigned int& );
1449  void handleEndVertex(const unsigned int& );
1450  void handleSplitVertex(const unsigned int& );
1451  void handleMergeVertex(const unsigned int& );
1452  void handleRegularVertexUp(const unsigned int& );
1453  void handleRegularVertexDown(const unsigned int& );
1454 
1455  //add diagonal between two vertices;
1456  void addDiagonal(const unsigned int& i, const unsigned int& j);
1457 
1458 
1459  //angle ABC for three given points, for monotone polygon searching purpose;
1460  double angleCosb(double *A, double *B, double *C);
1461  //find the next edge, for monotone polygon searching purpose;
1462  unsigned int selectNextEdge(internal_poltrig::Linebase* edge);
1463 
1464  //triangulate a monotone polygon piece;
1466 
1467  //private data memebers
1468  internal_poltrig::PQueue m_qpoints; //priority queue for event points
1469  internal_poltrig::EdgeBST m_edgebst; //edge binary searching tree (splaytree)
1470  internal_poltrig::Monopolys m_mpolys; //all monotone polygon piece list;
1471  Triangles m_triangles; //all triangle list;
1472 
1473  //data for monotone piece searching purpose;
1474  internal_poltrig::AdjEdgeMap m_startAdjEdgeMap; //all edges starting from given points (map)
1475  internal_poltrig::LineMap m_diagonals; //added diagonals to partition polygon to
1476  //monotont pieces, not all diagonals of
1477 
1478  void init_vertices_and_lines();
1479  unsigned int m_ncontours; //number of contours
1480  std::vector<unsigned int> m_nVertices; //
1483  double m_xmin,m_xmax, m_ymin,m_ymax; //boundary box for polygon
1484 
1485 };
1486 
1487 
1489 {
1490  int sid,eid;
1491  int num=0;
1492 
1494 
1495  for(unsigned j=0; j<m_ncontours; ++j)
1496  {
1497  for(unsigned i=1; i<=m_nVertices[j]; ++i)//fixme: 0-based?
1498  {
1499  sid=num+i;
1500  eid=(i==m_nVertices[j])?num+1:num+i+1;
1503  m_edges[m_l_id]=line;
1504  }
1505  num+=m_nVertices[j];
1506  }
1507 
1508  int sum=0;
1509  for(unsigned int i=0; i<m_ncontours; ++i)
1510  {
1511  sum+= m_nVertices[i];
1512  m_nVertices[i]=sum;
1513  }
1514 
1515 }
1516 
1517 
1518 //----------------------------------------------------------------------------
1519 //get input
1520 //----------------------------------------------------------------------------
1521 void PolygonTriangulator::Polygon::set_contour(const std::vector<double>& x,const std::vector<double>& y)
1522 {
1523  assert(x.size()==y.size());
1524 
1525  m_nVertices.push_back( x.size() );
1526  unsigned int i = m_points.size()+1/*1*/;//fixme: get rid of the +1 ?
1527  double xx,yy;
1529  for (unsigned int j = 0; j < m_nVertices[m_ncontours]; ++j, ++i)
1530  {
1531  xx=x.at(j);
1532  yy=y.at(j);
1535  if(xx > m_xmax ) m_xmax=xx;
1536  if(xx < m_xmin ) m_xmin=xx;
1537  if(yy > m_ymax ) m_ymax=yy;
1538  if(yy < m_ymin ) m_ymin=yy;
1539  m_points[i]=point;
1540  }
1541 
1542  ++m_ncontours;
1543 
1544 }
1545 
1546 
1547 
1548 
1549 //----------------------------------------------------------------------------
1550 //polygon class constructor
1551 //----------------------------------------------------------------------------
1552 PolygonTriangulator::Polygon::Polygon(const std::vector<double>& x,const std::vector<double>& y)
1553 {
1554  m_l_id = 0;
1555  m_ncontours=0;
1556 
1557  m_xmin = m_ymin = std::numeric_limits<double>::infinity();
1558  m_xmax = m_ymax = - std::numeric_limits<double>::infinity();
1559 
1560 
1561  set_contour(x,y);
1562  init_vertices_and_lines();
1563  initializate();
1564 }
1565 
1566 //----------------------------------------------------------------------------
1567 //polygon destructor
1568 //----------------------------------------------------------------------------
1570 {
1571  //clear all dynamic allocated memory
1573  for(; itp!=m_points.end(); ++itp)
1574  {
1575  delete itp->second;
1576  }
1577 
1578  internal_poltrig::LineMap::iterator itl=m_edges.begin();
1579  for(; itl!=m_edges.end(); ++itl)
1580  {
1581  delete itl->second;
1582  }
1583 
1584 }
1585 
1586 //----------------------------------------------------------------------------
1587 //return the previous point (or edge) id for a given ith point (or edge);
1588 //----------------------------------------------------------------------------
1589 unsigned int PolygonTriangulator::Polygon::prev(const unsigned int& i)
1590 {
1591  unsigned int j(0),prevLoop(0),currentLoop(0);
1592 
1593  while ( i > m_nVertices[currentLoop] )
1594  {
1595  prevLoop=currentLoop;
1596  ++currentLoop;
1597  }
1598 
1599  if( i==1 || (i==m_nVertices[prevLoop]+1) ) j=m_nVertices[currentLoop];
1600  else if( i <= m_nVertices[currentLoop] ) j=i-1;
1601 
1602  return j;
1603 }
1604 
1605 //----------------------------------------------------------------------------
1606 //return the next point (or edge) id for a given ith point (or edge);
1607 //----------------------------------------------------------------------------
1608 unsigned int PolygonTriangulator::Polygon::next(const unsigned int& i)
1609 {
1610  unsigned int j(0),prevLoop(0),currentLoop(0);
1611 
1612  while ( i > m_nVertices[currentLoop] )
1613  {
1614  prevLoop=currentLoop;
1615  ++currentLoop;
1616  }
1617 
1618  if( i < m_nVertices[currentLoop] ) j=i+1;
1619  else if ( i==m_nVertices[currentLoop] )
1620  {
1621  if( currentLoop==0) j=1;
1622  else j=m_nVertices[prevLoop]+1;
1623  }
1624 
1625  return j;
1626 }
1627 
1628 //----------------------------------------------------------------------------
1629 //polygon initialization;
1630 //to find types of all polygon vertices;
1631 //create a priority queue for all vertices;
1632 //construct an edge set for each vertex (the set holds all edges starting from
1633 //the vertex, only for loop searching purpose).
1634 //----------------------------------------------------------------------------
1636 {
1638  for(; it!=m_points.end(); ++it)
1639  {
1640  int id=it->first;
1641  int idp=prev(id);
1642  int idn=next(id);
1643  internal_poltrig::Pointbase p=*m_points[id], pnext=*m_points[idn], pprev=*m_points[idp];
1644 
1645  if( p > pnext && pprev > p )
1646  m_points[id]->type=internal_poltrig::REGULAR_DOWN;
1647  else if (p > pprev && pnext > p)
1648  m_points[id]->type=internal_poltrig::REGULAR_UP;
1649  else
1650  {
1651  double pa[2], pb[2], pc[2];
1652 
1653  pa[0]=m_points[idp]->x;
1654  pa[1]=m_points[idp]->y;
1655 
1656  pb[0]=m_points[id]->x;
1657  pb[1]=m_points[id]->y;
1658 
1659  pc[0]=m_points[idn]->x;
1660  pc[1]=m_points[idn]->y;
1661 
1662  double area=internal_poltrig::orient2d(pa,pb,pc);
1663 
1664  if( pprev > p && pnext > p ) m_points[id]->type=(area >0) ? internal_poltrig::END: internal_poltrig::MERGE ;
1665  if( pprev < p && pnext < p ) m_points[id]->type=(area >0) ? internal_poltrig::START : internal_poltrig::SPLIT;
1666 
1667  }
1668 
1669  m_qpoints.push(*(it->second));
1670 
1671  m_startAdjEdgeMap[id].insert(id);
1672 
1673  }
1674 }
1675 
1676 //----------------------------------------------------------------------------
1677 //Add a diagonal from point id i to j
1678 //----------------------------------------------------------------------------
1679 void PolygonTriangulator::Polygon::addDiagonal(const unsigned int& i, const unsigned int& j)
1680 {
1682  internal_poltrig::Linebase* diag=new internal_poltrig::Linebase(m_points[i], m_points[j], type,m_l_id);
1683  m_edges[diag->id()]=diag;
1684 
1685  m_startAdjEdgeMap[i].insert(diag->id());
1686  m_startAdjEdgeMap[j].insert(diag->id());
1687 
1688  m_diagonals[diag->id()]=diag;
1689 
1690 }
1691 
1692 //----------------------------------------------------------------------------
1693 //Handle start vertex
1694 //----------------------------------------------------------------------------
1696 {
1697  double y=m_points[i]->y;
1698  m_edgebst.InOrder(internal_poltrig::UpdateKey, y);
1699 
1700  m_edges[i]->setHelper(i);
1701  m_edges[i]->setKeyValue(y);
1702  m_edgebst.Insert(m_edges[i]);
1703 
1704 }
1705 
1706 //----------------------------------------------------------------------------
1707 //Handle end vertex
1708 //----------------------------------------------------------------------------
1710 {
1711  double y=m_points[i]->y;
1712  m_edgebst.InOrder(internal_poltrig::UpdateKey, y);
1713 
1714  unsigned int previ=prev(i);
1715  internal_poltrig::Linebase* edge=m_edges[previ];
1716  unsigned int helper=m_edges[previ]->helper();
1717 
1718 
1719  if(m_points[helper]->type==internal_poltrig::MERGE) addDiagonal(i, helper);
1720  m_edgebst.Delete(edge->keyValue());
1721 
1722 }
1723 
1724 //----------------------------------------------------------------------------
1725 //Handle split vertex
1726 //----------------------------------------------------------------------------
1728 {
1729  double x=m_points[i]->x, y=m_points[i]->y;
1730  m_edgebst.InOrder(internal_poltrig::UpdateKey, y);
1731 
1733  m_edgebst.FindMaxSmallerThan(x, leftnode);
1734  internal_poltrig::Linebase* leftedge=leftnode->data();
1735 
1736  unsigned int helper=leftedge->helper();
1737  addDiagonal(i, helper);
1738 
1739  leftedge->setHelper(i);
1740  m_edges[i]->setHelper(i);
1741  m_edges[i]->setKeyValue(y);
1742  m_edgebst.Insert(m_edges[i]);
1743 }
1744 
1745 //----------------------------------------------------------------------------
1746 //Handle merge vertex
1747 //----------------------------------------------------------------------------
1749 {
1750  double x=m_points[i]->x, y=m_points[i]->y;
1751  m_edgebst.InOrder(internal_poltrig::UpdateKey, y);
1752 
1753  unsigned int previ=prev(i);
1754  unsigned int helper=m_edges[previ]->helper();
1755  if (m_points[helper]->type==internal_poltrig::MERGE) addDiagonal(i, helper);
1756  m_edgebst.Delete(m_edges[previ]->keyValue());
1757 
1759  m_edgebst.FindMaxSmallerThan(x, leftnode);
1760  internal_poltrig::Linebase* leftedge=leftnode->data();
1761 
1762  helper=leftedge->helper();
1763  if(m_points[helper]->type==internal_poltrig::MERGE) addDiagonal(i, helper);
1764 
1765  leftedge->setHelper(i);
1766 }
1767 
1768 //----------------------------------------------------------------------------
1769 //Handle regular down vertex
1770 //----------------------------------------------------------------------------
1772 {
1773  double y=m_points[i]->y;
1774  m_edgebst.InOrder(internal_poltrig::UpdateKey, y);
1775 
1776  unsigned int previ=prev(i);
1777  unsigned int helper=m_edges[previ]->helper();
1778  if(m_points[helper]->type==internal_poltrig::MERGE) addDiagonal(i, helper);
1779 
1780  m_edgebst.Delete(m_edges[previ]->keyValue());
1781  m_edges[i]->setHelper(i);
1782  m_edges[i]->setKeyValue(y);
1783  m_edgebst.Insert(m_edges[i]);
1784 
1785 }
1786 
1787 //----------------------------------------------------------------------------
1789 //----------------------------------------------------------------------------
1791 {
1792  double x=m_points[i]->x, y=m_points[i]->y;
1793  m_edgebst.InOrder(internal_poltrig::UpdateKey, y);
1794 
1796  m_edgebst.FindMaxSmallerThan(x, leftnode);
1797 
1798  internal_poltrig::Linebase* leftedge=leftnode->data();
1799 
1800  unsigned int helper=leftedge->helper();
1801  if(m_points[helper]->type==internal_poltrig::MERGE) addDiagonal(i, helper);
1802  leftedge->setHelper(i);
1803 
1804 }
1805 
1806 //----------------------------------------------------------------------------
1807 //partition polygon to monotone polygon pieces
1808 //----------------------------------------------------------------------------
1810 {
1811 
1812  if(m_qpoints.top().type!=internal_poltrig::START)
1813  {
1814  std::cout<<"Please check your input polygon:\n1)orientations?\n2)duplicated points?\n";
1815  exit(1);
1816  }
1817 
1818  while(!m_qpoints.empty())
1819  {
1820  internal_poltrig::Pointbase vertex=m_qpoints.top();
1821  m_qpoints.pop();
1822  unsigned int id=vertex.id;
1823 
1824  switch(vertex.type)
1825  {
1826  case internal_poltrig::START: handleStartVertex(id); break;
1827  case internal_poltrig::END: handleEndVertex(id); break;
1828  case internal_poltrig::MERGE: handleMergeVertex(id); break;
1829  case internal_poltrig::SPLIT: handleSplitVertex(id); break;
1830  case internal_poltrig::REGULAR_UP: handleRegularVertexUp(id); break;
1831  case internal_poltrig::REGULAR_DOWN: handleRegularVertexDown(id); break;
1832  default:
1833  std::cout<<"No duplicated points please!\n";
1834  exit(1); break;
1835  }
1836  }
1837 }
1838 
1839 
1840 //----------------------------------------------------------------------------
1841 //two Auxiliary functions to find monotone polygon pieces
1842 //----------------------------------------------------------------------------
1843 
1844 //----------------------------------------------------------------------------
1845 //calculate angle B for A, B, C three given points
1846 //----------------------------------------------------------------------------
1847 double PolygonTriangulator::Polygon::angleCosb(double *pa, double *pb, double *pc)
1848 {
1849  double dxab = pa[0] - pb[0];
1850  double dyab = pa[1] - pb[1];
1851 
1852  double dxcb = pc[0] - pb[0];
1853  double dycb = pc[1] - pb[1];
1854 
1855  double dxab2 = dxab * dxab;
1856  double dyab2 = dyab * dyab;
1857  double dxcb2 = dxcb * dxcb;
1858  double dycb2 = dycb * dycb;
1859  double ab = dxab2 + dyab2;
1860  double cb = dxcb2 + dycb2;
1861 
1862  double cosb = dxab * dxcb + dyab * dycb;
1863  double denom = sqrt( ab * cb);
1864 
1865  cosb/=denom;
1866 
1867  return cosb;
1868 }
1869 
1870 //----------------------------------------------------------------------------
1871 //for any given edge, find the next edge we should choose when searching for
1872 //monotone polygon pieces;
1873 //----------------------------------------------------------------------------
1875 {
1876 
1877  unsigned int eid= edge->endPoint(1)->id;
1878  std::set<unsigned int> edges=m_startAdjEdgeMap[eid];
1879  assert(!edges.empty());
1880 
1881  unsigned int nexte=0;
1882  if( edges.size() == 1 ) nexte=*(edges.begin());
1883  else if( edges.size() > 1 )
1884  {
1885  unsigned int nexte_ccw(0), nexte_cw(0);
1886  double max=-2.0,min=2.0;
1887 
1888 
1889  std::set<unsigned int>::iterator it=edges.begin();
1890  for(; it!=edges.end(); ++it)
1891  {
1892  if(*it==edge->id()) continue;
1893  double A[2], B[2], C[2];
1894  A[0]=edge->endPoint(0)->x; A[1]=edge->endPoint(0)->y;
1895  B[0]=edge->endPoint(1)->x; B[1]=edge->endPoint(1)->y;
1896 
1897  if(edge->endPoint(1)!=m_edges[*it]->endPoint(0)) m_edges[*it]->reverse();
1898  C[0]=m_edges[*it]->endPoint(1)->x; C[1]=m_edges[*it]->endPoint(1)->y;
1899 
1900  double area=internal_poltrig::orient2d(A, B, C);
1901  double cosb=angleCosb(A, B, C);
1902 
1903  if( area > 0 && max < cosb ) { nexte_ccw=*it; max=cosb; }
1904  else if( min > cosb ) { nexte_cw=*it; min=cosb; }
1905  }
1906 
1907  nexte = (nexte_ccw!=0) ? nexte_ccw : nexte_cw;
1908  }
1909 
1910  return nexte;
1911 }
1912 
1913 //----------------------------------------------------------------------------
1914 //searching all monotone pieces;
1915 //----------------------------------------------------------------------------
1917 {
1918  internal_poltrig::LineMap edges=m_edges;
1919 
1920  while( edges.size() > m_diagonals.size() )
1921  {
1924  internal_poltrig::Pointbase* startp=it->second->endPoint(0);
1927 
1928  poly.push_back(startp->id);
1929 
1930  for(;;)
1931  {
1932  endp=next->endPoint(1);
1933  if(next->type()!=internal_poltrig::INSERT)
1934  {
1935  edges.erase(next->id());
1936  m_startAdjEdgeMap[next->endPoint(0)->id].erase(next->id());
1937  }
1938  if(endp==startp) break;
1939  poly.push_back(endp->id);
1940 
1941  unsigned int nexte=selectNextEdge(next);
1942 
1943  if(nexte==0)
1944  {
1945  std::cout<<"Please check your input polygon:\n";
1946  std::cout<<"1)orientations?\n2)with duplicated points?\n3)is a simple one?\n";
1947  exit(1);
1948  }
1949  //assert( nexte > 0);
1950  next=edges[nexte];
1951  if(next->endPoint(0) !=endp ) next->reverse();
1952  }
1953 
1954  m_mpolys.push_back(poly);
1955  }
1956 }
1957 
1958 
1959 //----------------------------------------------------------------------------
1960 //triangulate a monotone polygon;
1961 //----------------------------------------------------------------------------
1963 {
1964  internal_poltrig::PQueue qvertex;
1965  internal_poltrig::Monopoly::iterator it=mpoly.begin(), itnext;
1966  for(; itnext=it, it!=mpoly.end(); ++it)
1967  {
1968  ++itnext;
1969  if(itnext==mpoly.end()) itnext=mpoly.begin();
1970  internal_poltrig::Pointbase point=*m_points[*it], pointnext=*m_points[*itnext];
1971  point.left=(point > pointnext)? true:false;
1972  qvertex.push(point);
1973  }
1974 
1975  std::stack<internal_poltrig::Pointbase> spoint;
1976  for(int i=0; i<2; ++i) { spoint.push(qvertex.top()); qvertex.pop(); }
1977 
1978  while ( qvertex.size() > 1 )
1979  {
1980  internal_poltrig::Pointbase topQueuePoint=qvertex.top();
1981  internal_poltrig::Pointbase topStackPoint=spoint.top();
1982 
1983  if(topQueuePoint.left!=topStackPoint.left)
1984  {
1985  while ( spoint.size() > 1 )
1986  {
1987  internal_poltrig::Pointbase p1=spoint.top();
1988  spoint.pop();
1989  internal_poltrig::Pointbase p2=spoint.top();
1990  Triangle v(3);
1991  v[0]=topQueuePoint.id;
1992  v[1]=p1.id;
1993  v[2]=p2.id;
1994  sort(v.begin(),v.end());//TK
1995  m_triangles.push_back(v);
1996 
1997  }
1998  spoint.pop();
1999  spoint.push(topStackPoint);
2000  spoint.push(topQueuePoint);
2001  }
2002  else
2003  {
2004  while( spoint.size() > 1 )
2005  {
2006  internal_poltrig::Pointbase stack1Point=spoint.top();
2007  spoint.pop();
2008  internal_poltrig::Pointbase stack2Point=spoint.top();
2009  spoint.push(stack1Point);
2010  double pa[2], pb[2], pc[2];
2011  pa[0]=topQueuePoint.x; pa[1]=topQueuePoint.y;
2012  pb[0]=stack2Point.x; pb[1]=stack2Point.y;
2013  pc[0]=stack1Point.x; pc[1]=stack1Point.y;
2014 
2015  double area=internal_poltrig::orient2d(pa,pb,pc);
2016  bool left=stack1Point.left;
2017  if( (area > 0 && left) || (area < 0 && !left ) )
2018  {
2019  Triangle v(3);
2020  v[0]=topQueuePoint.id;
2021  v[1]=stack2Point.id;
2022  v[2]=stack1Point.id;
2023  sort(v.begin(),v.end());//TK
2024  m_triangles.push_back(v);
2025  spoint.pop();
2026  } else break;
2027  }
2028 
2029  spoint.push(topQueuePoint);
2030 
2031  }
2032 
2033  qvertex.pop();
2034 
2035  }
2036 
2037  internal_poltrig::Pointbase lastQueuePoint=qvertex.top();
2038  while( spoint.size() !=1 )
2039  {
2040  internal_poltrig::Pointbase topPoint=spoint.top();
2041  spoint.pop();
2042  internal_poltrig::Pointbase top2Point=spoint.top();
2043 
2044  Triangle v(3);
2045  v[0]=lastQueuePoint.id;
2046  v[1]=topPoint.id;
2047  v[2]=top2Point.id;
2048  sort(v.begin(),v.end());//TK
2049  m_triangles.push_back(v);
2050  }
2051 }
2052 
2053 //----------------------------------------------------------------------------
2054 //main triangulation function;
2057 {
2058  partition2Monotone();
2059  searchMonotones();
2060  internal_poltrig::Monopolys::iterator it=m_mpolys.begin();
2061  for(; it!=m_mpolys.end(); ++it)
2062  triangulateMonotone(*it);
2063 }
2064 
2071 
2072 PolygonTriangulator::PolygonTriangulator(const std::vector<double>& polygon_xcoords,
2073  const std::vector<double>& polygon_ycoords)
2074  : m_polygon(new Polygon(polygon_xcoords,polygon_ycoords))
2075 {
2077 }
2078 
2080 
2082 {
2083  return m_polygon->triangles();
2084 }
2085 
2086 
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
internal_poltrig::SplayTree::Find
void Find(const KeyType &keys, BTreeNode< T, KeyType > *&res)
Definition: PolygonTriangulator.cxx:935
internal_poltrig::Pointbase
Definition: PolygonTriangulator.cxx:1208
PolygonTriangulator::Polygon::m_l_id
long int m_l_id
Definition: PolygonTriangulator.cxx:1438
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
internal_poltrig::SplayTree::InOrder
void InOrder(void(*Visit)(BTreeNode< T, KeyType > *u, double y), double y)
Definition: PolygonTriangulator.cxx:691
PolygonTriangulator::Polygon::triangles
const Triangles * triangles()
Definition: PolygonTriangulator.cxx:1431
internal_poltrig::LineMap
std::map< unsigned int, Linebase * > LineMap
Definition: PolygonTriangulator.cxx:119
Two_Product
#define Two_Product(a, b, x, y)
Definition: PolygonTriangulator.cxx:333
internal_poltrig::SplayTree::PostOrder
void PostOrder(void(*Visit)(BTreeNode< T, KeyType > *u))
Definition: PolygonTriangulator.cxx:694
internal_poltrig::START
@ START
Definition: PolygonTriangulator.cxx:112
TruthTest.itp
itp
Definition: TruthTest.py:46
ReadCellNoiseFromCoolCompare.s1
s1
Definition: ReadCellNoiseFromCoolCompare.py:378
DiTauMassTools::TauTypes::lh
@ lh
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:53
PolygonTriangulator::Polygon::next
unsigned int next(const unsigned int &i)
Definition: PolygonTriangulator.cxx:1608
internal_poltrig::Monopolys
std::list< Monopoly > Monopolys
Definition: PolygonTriangulator.cxx:123
checkFileSG.line
line
Definition: checkFileSG.py:75
internal_poltrig::PointbaseMap
std::map< unsigned int, Pointbase * > PointbaseMap
Definition: PolygonTriangulator.cxx:117
internal_poltrig::SplayTree::clone
BTreeNode< T, KeyType > * clone(BTreeNode< T, KeyType > *t) const
Definition: PolygonTriangulator.cxx:1099
header
Definition: hcg.cxx:526
internal_poltrig::SplayTree::DeleteMin
void DeleteMin(BTreeNode< T, KeyType > *&min)
Definition: PolygonTriangulator.cxx:853
internal_poltrig::REGULAR_DOWN
@ REGULAR_DOWN
Definition: PolygonTriangulator.cxx:112
PolygonTriangulator::Polygon::~Polygon
~Polygon()
Definition: PolygonTriangulator.cxx:1569
PolygonTriangulator::Polygon::m_triangles
Triangles m_triangles
Definition: PolygonTriangulator.cxx:1471
keylayer_zslicemap.pb
pb
Definition: keylayer_zslicemap.py:188
PlotCalibFromCool.yy
yy
Definition: PlotCalibFromCool.py:714
DiTauMassTools::TauTypes::hh
@ hh
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:53
internal_poltrig::Triangles
std::list< Triangle > Triangles
Definition: PolygonTriangulator.cxx:125
internal_poltrig::Triangle
std::vector< unsigned int > Triangle
Definition: PolygonTriangulator.cxx:124
TRTCalib_Extractor.det
det
Definition: TRTCalib_Extractor.py:36
internal_poltrig::SplayTree::Delete
void Delete(const KeyType &keys)
Definition: PolygonTriangulator.cxx:824
internal_poltrig::Linebase::helper
unsigned int helper()
Definition: PolygonTriangulator.cxx:1268
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
internal_poltrig::Pointbase::Pointbase
Pointbase(const double &xx, const double &yy)
Definition: PolygonTriangulator.cxx:1215
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
internal_poltrig::Pointbase::x
double x
Definition: PolygonTriangulator.cxx:1235
PolygonTriangulator::~PolygonTriangulator
~PolygonTriangulator()
Definition: PolygonTriangulator.cxx:2079
PolygonTriangulator::Polygon::m_qpoints
internal_poltrig::PQueue m_qpoints
Definition: PolygonTriangulator.cxx:1468
PolygonTriangulator::Polygon::m_xmin
double m_xmin
Definition: PolygonTriangulator.cxx:1483
internal_poltrig::SplayTree::IsEmpty
bool IsEmpty() const
Definition: PolygonTriangulator.cxx:984
PolygonTriangulator::triangles
const Triangles * triangles() const
Definition: PolygonTriangulator.cxx:2081
DMTest::C
C_v1 C
Definition: C.h:26
ALFA_EventTPCnv_Dict::t0
std::vector< ALFA_RawData_p1 > t0
Definition: ALFA_EventTPCnvDict.h:42
CSV_InDetExporter.new
new
Definition: CSV_InDetExporter.py:145
PolygonTriangulator::Polygon::m_edgebst
internal_poltrig::EdgeBST m_edgebst
Definition: PolygonTriangulator.cxx:1469
TRTCalib_cfilter.p1
p1
Definition: TRTCalib_cfilter.py:130
internal_poltrig::BTreeNode::m_right
BTreeNode * m_right
Definition: PolygonTriangulator.cxx:653
ALFA_EventTPCnv_Dict::t1
std::vector< ALFA_RawDataCollection_p1 > t1
Definition: ALFA_EventTPCnvDict.h:43
PolygonTriangulator::Polygon::handleMergeVertex
void handleMergeVertex(const unsigned int &)
Definition: PolygonTriangulator.cxx:1748
skel.it
it
Definition: skel.GENtoEVGEN.py:396
PolygonTriangulator::Polygon::set_contour
void set_contour(const std::vector< double > &x, const std::vector< double > &y)
Definition: PolygonTriangulator.cxx:1521
internal_poltrig::SplayTree::Right
BTreeNode< T, KeyType > * Right(BTreeNode< T, KeyType > *node)
Definition: PolygonTriangulator.cxx:700
PolygonTriangulator::Triangles
std::list< Triangle > Triangles
Definition: PolygonTriangulator.h:36
mc.diff
diff
Definition: mc.SFGenPy8_MuMu_DD.py:14
internal_poltrig::BTreeNode::Right
BTreeNode * Right()
Definition: PolygonTriangulator.cxx:645
PolygonTriangulator::Polygon::m_edges
internal_poltrig::LineMap m_edges
Definition: PolygonTriangulator.cxx:1482
internal_poltrig::AdjEdgeMap
std::map< unsigned int, std::set< unsigned int > > AdjEdgeMap
Definition: PolygonTriangulator.cxx:126
internal_poltrig::PQueue
std::priority_queue< Pointbase > PQueue
Definition: PolygonTriangulator.cxx:120
internal_poltrig::Linebase::m_id
unsigned int m_id
Definition: PolygonTriangulator.cxx:1271
PolygonTriangulator::Polygon::handleStartVertex
void handleStartVertex(const unsigned int &)
Definition: PolygonTriangulator.cxx:1695
internal_poltrig::dist_sqr
double dist_sqr(const Pointbase &sp, const Pointbase &ep)
Definition: PolygonTriangulator.cxx:1309
internal_poltrig::BTreeNode::BTreeNode
BTreeNode(const T &data, BTreeNode *lt, BTreeNode *rt)
Definition: PolygonTriangulator.cxx:640
internal_poltrig::Linebase::type
Type type() const
Definition: PolygonTriangulator.cxx:1258
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
internal_poltrig::orient2d
REAL orient2d(REAL *pa, REAL *pb, REAL *pc)
Definition: PolygonTriangulator.cxx:571
PolygonTriangulator::Polygon::triangulateMonotone
void triangulateMonotone(internal_poltrig::Monopoly &mpoly)
Definition: PolygonTriangulator.cxx:1962
internal_poltrig::operator!=
bool operator!=(const Pointbase &pa, const Pointbase &pb)
Definition: PolygonTriangulator.cxx:1360
internal_poltrig::Pointbase::Pointbase
Pointbase()
Definition: PolygonTriangulator.cxx:1211
dbg::ptr
void * ptr(T *p)
Definition: SGImplSvc.cxx:74
PolygonTriangulator::m_polygon
Polygon * m_polygon
Definition: PolygonTriangulator.h:55
internal_poltrig::Linebase::reverse
void reverse()
Definition: PolygonTriangulator.cxx:1401
PolygonTriangulator::Polygon::m_startAdjEdgeMap
internal_poltrig::AdjEdgeMap m_startAdjEdgeMap
Definition: PolygonTriangulator.cxx:1474
internal_poltrig::BTreeNode::m_data
T m_data
Definition: PolygonTriangulator.cxx:651
x
#define x
internal_poltrig::Linebase::endPoint
Pointbase * endPoint(const int &i) const
Definition: PolygonTriangulator.cxx:1257
PolygonTriangulator::Polygon::handleEndVertex
void handleEndVertex(const unsigned int &)
Definition: PolygonTriangulator.cxx:1709
internal_poltrig::Type
Type
Definition: PolygonTriangulator.cxx:112
Two_Sum
#define Two_Sum(a, b, x, y)
Definition: PolygonTriangulator.cxx:301
internal_poltrig::SplayTree::Left
BTreeNode< T, KeyType > * Left(BTreeNode< T, KeyType > *node)
Definition: PolygonTriangulator.cxx:699
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:77
internal_poltrig::SplayTree::PreOrder
void PreOrder(void(*Visit)(BTreeNode< T, KeyType > *u))
Definition: PolygonTriangulator.cxx:686
python.Utilities.clone
clone
Definition: Utilities.py:134
internal_poltrig::SplayTree::InOrder
void InOrder(void(*Visit)(BTreeNode< T, KeyType > *u))
Definition: PolygonTriangulator.cxx:688
internal_poltrig::SplayTree::Insert
void Insert(const T &x)
Definition: PolygonTriangulator.cxx:747
internal_poltrig::Pointbase::operator==
friend bool operator==(const Pointbase &, const Pointbase &)
Definition: PolygonTriangulator.cxx:1342
PolygonTriangulator::Polygon::m_xmax
double m_xmax
Definition: PolygonTriangulator.cxx:1483
runBeamSpotCalibration.helper
helper
Definition: runBeamSpotCalibration.py:112
PolygonTriangulator::Polygon::init_vertices_and_lines
void init_vertices_and_lines()
Definition: PolygonTriangulator.cxx:1488
internal_poltrig::INSERT
@ INSERT
Definition: PolygonTriangulator.cxx:112
internal_poltrig::Linebase::m_endp
Pointbase * m_endp[2]
Definition: PolygonTriangulator.cxx:1272
PolygonTriangulator::PolygonTriangulator
PolygonTriangulator(const std::vector< double > &polygon_xcoords, const std::vector< double > &polygon_ycoords)
Definition: PolygonTriangulator.cxx:2072
m_type
TokenType m_type
the type
Definition: TProperty.cxx:44
MuonCalib::Legendre::poly
constexpr double poly(const double x)
Definition: LegendrePoly.h:116
internal_poltrig::SplayTree::FindMaxSmallerThan
void FindMaxSmallerThan(const KeyType &keys, BTreeNode< T, KeyType > *&res)
Definition: PolygonTriangulator.cxx:949
TRTCalib_cfilter.p2
p2
Definition: TRTCalib_cfilter.py:131
PolygonTriangulator::Polygon::m_mpolys
internal_poltrig::Monopolys m_mpolys
Definition: PolygonTriangulator.cxx:1470
internal_poltrig::SplayTree::SplayTree
SplayTree()
Definition: PolygonTriangulator.cxx:663
PolygonTriangulator::Polygon::partition2Monotone
void partition2Monotone()
Definition: PolygonTriangulator.cxx:1809
PolygonTriangulator::Polygon::angleCosb
double angleCosb(double *A, double *B, double *C)
Definition: PolygonTriangulator.cxx:1847
A
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
RunTileMonitoring.keyValue
keyValue
Definition: RunTileMonitoring.py:150
internal_poltrig::Linebase::m_type
Type m_type
Definition: PolygonTriangulator.cxx:1274
convertTimingResiduals.sum
sum
Definition: convertTimingResiduals.py:55
internal_poltrig::Linebase::setKeyValue
void setKeyValue(const double &y)
Definition: PolygonTriangulator.cxx:1409
PolygonTriangulator::Polygon::m_points
internal_poltrig::PointbaseMap m_points
Definition: PolygonTriangulator.cxx:1481
fillPileUpNoiseLumi.next
next
Definition: fillPileUpNoiseLumi.py:52
internal_poltrig::Linebase::Linebase
Linebase()
Definition: PolygonTriangulator.cxx:1368
internal_poltrig::operator>
bool operator>(const Pointbase &pa, const Pointbase &pb)
Definition: PolygonTriangulator.cxx:1348
lumiFormat.i
int i
Definition: lumiFormat.py:85
PolygonTriangulator.h
internal_poltrig::MERGE
@ MERGE
Definition: PolygonTriangulator.cxx:112
internal_poltrig::Pointbase::Pointbase
Pointbase(const int &idd, const double &xx, const double &yy)
Definition: PolygonTriangulator.cxx:1218
sqr
#define sqr(t)
Definition: PolygonTriangulator.cxx:110
internal_poltrig::UpdateKey
void UpdateKey(BTreeNode< Linebase *, double > *node, double y)
Definition: PolygonTriangulator.cxx:1322
internal_poltrig::SplayTree::Root
BTreeNode< T, KeyType > * Root()
Definition: PolygonTriangulator.cxx:670
PolygonTriangulator::Polygon::selectNextEdge
unsigned int selectNextEdge(internal_poltrig::Linebase *edge)
Definition: PolygonTriangulator.cxx:1874
PolygonTriangulator::Polygon::searchMonotones
void searchMonotones()
Definition: PolygonTriangulator.cxx:1916
REAL
#define REAL
Definition: PolygonTriangulator.cxx:262
res
std::pair< std::vector< unsigned int >, bool > res
Definition: JetGroupProductTest.cxx:14
internal_poltrig::END
@ END
Definition: PolygonTriangulator.cxx:112
internal_poltrig::BTreeNode::data
T & data()
Definition: PolygonTriangulator.cxx:643
hist_file_dump.f
f
Definition: hist_file_dump.py:135
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
internal_poltrig::SplayTree::Height
int Height() const
Definition: PolygonTriangulator.cxx:697
PolygonTriangulator::Polygon::initializate
void initializate()
Definition: PolygonTriangulator.cxx:1635
PolygonTriangulator::Polygon::handleSplitVertex
void handleSplitVertex(const unsigned int &)
Definition: PolygonTriangulator.cxx:1727
xAODType
Definition: ObjectType.h:13
calibdata.exit
exit
Definition: calibdata.py:236
internal_poltrig::Linebase::increaseKeyValue
void increaseKeyValue(const double &diff)
Definition: PolygonTriangulator.cxx:1262
internal_poltrig::BTreeNode::SetVisited
void SetVisited(const bool &visited)
Definition: PolygonTriangulator.cxx:646
internal_poltrig::estimate
REAL estimate(const int &elen, REAL *e)
Definition: PolygonTriangulator.cxx:451
internal_poltrig::Linebase::id
unsigned int id() const
Definition: PolygonTriangulator.cxx:1254
compute_lumi.denom
denom
Definition: compute_lumi.py:76
Absolute
#define Absolute(a)
Definition: PolygonTriangulator.cxx:270
internal_poltrig::SplayTree::m_root
BTreeNode< T, KeyType > * m_root
Definition: PolygonTriangulator.cxx:703
PolygonTriangulator::Polygon::points
internal_poltrig::PointbaseMap & points()
Definition: PolygonTriangulator.cxx:1433
internal_poltrig::SplayTree::rotateWithRightChild
void rotateWithRightChild(BTreeNode< T, KeyType > *&k1) const
Definition: PolygonTriangulator.cxx:1071
internal_poltrig
Definition: PolygonTriangulator.cxx:87
trigbs_pickEvents.num
num
Definition: trigbs_pickEvents.py:76
internal_poltrig::Linebase::~Linebase
~Linebase()
Definition: PolygonTriangulator.cxx:1252
PolygonTriangulator::Polygon::prev
unsigned int prev(const unsigned int &i)
Definition: PolygonTriangulator.cxx:1589
internal_poltrig::SplayTree::FindMax
void FindMax(BTreeNode< T, KeyType > *&max)
Definition: PolygonTriangulator.cxx:920
internal_poltrig::operator==
bool operator==(const Pointbase &pa, const Pointbase &pb)
Definition: PolygonTriangulator.cxx:1342
PolygonTriangulator::Polygon::m_ymax
double m_ymax
Definition: PolygonTriangulator.cxx:1483
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:227
internal_poltrig::SplayTree::operator=
const SplayTree & operator=(const SplayTree &rhs)
Definition: PolygonTriangulator.cxx:993
Fast_Two_Sum
#define Fast_Two_Sum(a, b, x, y)
Definition: PolygonTriangulator.cxx:290
internal_poltrig::INPUT
@ INPUT
Definition: PolygonTriangulator.cxx:112
internal_poltrig::UNKNOWN
@ UNKNOWN
Definition: PolygonTriangulator.cxx:112
dqt_zlumi_alleff_HIST.B
B
Definition: dqt_zlumi_alleff_HIST.py:110
internal_poltrig::Linebase::m_key
double m_key
Definition: PolygonTriangulator.cxx:1275
internal_poltrig::SplayTree::m_size
long int m_size
Definition: PolygonTriangulator.cxx:704
internal_poltrig::Pointbase::left
bool left
Definition: PolygonTriangulator.cxx:1237
internal_poltrig::SPLIT
@ SPLIT
Definition: PolygonTriangulator.cxx:112
internal_poltrig::SplayTree
Definition: PolygonTriangulator.cxx:117
internal_poltrig::Linebase::m_helper
unsigned int m_helper
Definition: PolygonTriangulator.cxx:1276
PolygonTriangulator::Polygon::edges
internal_poltrig::LineMap & edges()
Definition: PolygonTriangulator.cxx:1434
internal_poltrig::Linebase
Definition: PolygonTriangulator.cxx:1245
internal_poltrig::Pointbase::y
double y
Definition: PolygonTriangulator.cxx:1235
PolygonTriangulator::Polygon::addDiagonal
void addDiagonal(const unsigned int &i, const unsigned int &j)
Definition: PolygonTriangulator.cxx:1679
internal_poltrig::orient2dadapt
REAL orient2dadapt(REAL *pa, REAL *pb, REAL *pc, const REAL &detsum)
Definition: PolygonTriangulator.cxx:489
internal_poltrig::Pointbase::Pointbase
Pointbase(const double &xx, const double &yy, const Type &ttype)
Definition: PolygonTriangulator.cxx:1221
Two_Diff_Tail
#define Two_Diff_Tail(a, b, x, y)
Definition: PolygonTriangulator.cxx:305
python.PyAthena.v
v
Definition: PyAthena.py:154
internal_poltrig::Pointbase::Pointbase
Pointbase(const int &idd, const double &xx, const double &yy, const Type &ttype)
Definition: PolygonTriangulator.cxx:1224
internal_poltrig::Monopoly
std::list< unsigned int > Monopoly
Definition: PolygonTriangulator.cxx:122
Trk::vertex
@ vertex
Definition: MeasurementType.h:21
internal_poltrig::SplayTree::InOrder
void InOrder(void(*Visit)(BTreeNode< T, KeyType > *, double y), BTreeNode< T, KeyType > *t, double y)
y
#define y
internal_poltrig::fast_expansion_sum_zeroelim
int fast_expansion_sum_zeroelim(const int &elen, REAL *e, const int &flen, REAL *f, REAL *h)
Definition: PolygonTriangulator.cxx:372
h
Two_Two_Diff
#define Two_Two_Diff(a1, a0, b1, b0, x3, x2, x1, x0)
Definition: PolygonTriangulator.cxx:344
TMVAToMVAUtils::newTree
void newTree(MVAUtils::ForestTMVA *forest, const TMVA::DecisionTreeNode *node, float weight, bool isRegression, bool useYesNoLeaf)
Definition: TMVAToMVAUtils.h:15
internal_poltrig::BTreeNode
Definition: PolygonTriangulator.cxx:636
internal_poltrig::SplayTree::~SplayTree
~SplayTree()
Definition: PolygonTriangulator.cxx:738
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
PolygonTriangulator::Polygon::m_ncontours
unsigned int m_ncontours
Definition: PolygonTriangulator.cxx:1479
internal_poltrig::SplayTree::DeleteMax
void DeleteMax(BTreeNode< T, KeyType > *&max)
Definition: PolygonTriangulator.cxx:880
internal_poltrig::BTreeNode::BTreeNode
BTreeNode()
Definition: PolygonTriangulator.cxx:639
internal_poltrig::Pointbase::type
Type type
Definition: PolygonTriangulator.cxx:1236
internal_poltrig::Pointbase::operator!=
friend bool operator!=(const Pointbase &, const Pointbase &)
Definition: PolygonTriangulator.cxx:1360
internal_poltrig::Linebase::operator=
Linebase & operator=(const Linebase &)=delete
internal_poltrig::EdgeBST
SplayTree< Linebase *, double > EdgeBST
Definition: PolygonTriangulator.cxx:121
PolygonTriangulator::Polygon::m_ymin
double m_ymin
Definition: PolygonTriangulator.cxx:1483
PolygonTriangulator::Polygon::Polygon
Polygon(const std::vector< double > &x, const std::vector< double > &y)
Definition: PolygonTriangulator.cxx:1552
INEXACT
#define INEXACT
Definition: PolygonTriangulator.cxx:259
internal_poltrig::Pointbase::operator=
Pointbase & operator=(const Pointbase &)=default
internal_poltrig::BTreeNode::keyValue
KeyType keyValue()
Definition: PolygonTriangulator.cxx:648
internal_poltrig::Pointbase::operator>
friend bool operator>(const Pointbase &, const Pointbase &)
Definition: PolygonTriangulator.cxx:1348
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
internal_poltrig::REGULAR_UP
@ REGULAR_UP
Definition: PolygonTriangulator.cxx:112
internal_poltrig::SplayTree::MakeEmpty
void MakeEmpty()
Definition: PolygonTriangulator.cxx:970
area
double area(double R)
Definition: ConvertStaveServices.cxx:42
internal_poltrig::BTreeNode::m_left
BTreeNode * m_left
Definition: PolygonTriangulator.cxx:652
makeTOC.header
header
Definition: makeTOC.py:28
internal_poltrig::operator<
bool operator<(const Pointbase &pa, const Pointbase &pb)
Definition: PolygonTriangulator.cxx:1354
internal_poltrig::SplayTree::rotateWithLeftChild
void rotateWithLeftChild(BTreeNode< T, KeyType > *&k2) const
Definition: PolygonTriangulator.cxx:1059
internal_poltrig::Linebase::keyValue
double keyValue() const
Definition: PolygonTriangulator.cxx:1259
PolygonTriangulator::Polygon::triangulation
void triangulation()
Definition: PolygonTriangulator.cxx:2056
internal_poltrig::BTreeNode::m_visited
bool m_visited
Definition: PolygonTriangulator.cxx:654
python.compressB64.c
def c
Definition: compressB64.py:93
internal_poltrig::SplayTree::reclaimMemory
void reclaimMemory(BTreeNode< T, KeyType > *t) const
Definition: PolygonTriangulator.cxx:1084
PolygonTriangulator::Polygon::m_nVertices
std::vector< unsigned int > m_nVertices
Definition: PolygonTriangulator.cxx:1480
PolygonTriangulator::Polygon::m_diagonals
internal_poltrig::LineMap m_diagonals
Definition: PolygonTriangulator.cxx:1475
internal_poltrig::Linebase::setHelper
void setHelper(const unsigned int &i)
Definition: PolygonTriangulator.cxx:1267
PolygonTriangulator::Triangle
std::vector< unsigned > Triangle
Definition: PolygonTriangulator.h:35
python.SystemOfUnits.pc
float pc
Definition: SystemOfUnits.py:99
internal_poltrig::BTreeNode::GetVisited
bool GetVisited()
Definition: PolygonTriangulator.cxx:647
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35
node
Definition: memory_hooks-stdcmalloc.h:74
internal_poltrig::BTreeNode::Left
BTreeNode * Left()
Definition: PolygonTriangulator.cxx:644
internal_poltrig::SplayTree::Size
long int Size()
Definition: PolygonTriangulator.cxx:669
internal_poltrig::SplayTree::splay
void splay(const KeyType &keys, BTreeNode< T, KeyType > *&t) const
Definition: PolygonTriangulator.cxx:1011
internal_poltrig::Pointbase::id
unsigned int id
Definition: PolygonTriangulator.cxx:1234
PolygonTriangulator::Polygon::handleRegularVertexDown
void handleRegularVertexDown(const unsigned int &)
Definition: PolygonTriangulator.cxx:1771
PolygonTriangulator::Polygon
Definition: PolygonTriangulator.cxx:1419
internal_poltrig::SplayTree::FindMin
void FindMin(BTreeNode< T, KeyType > *&min)
Definition: PolygonTriangulator.cxx:906
PolygonTriangulator::Polygon::handleRegularVertexUp
void handleRegularVertexUp(const unsigned int &)
Definition: PolygonTriangulator.cxx:1790
internal_poltrig::Pointbase::operator<
friend bool operator<(const Pointbase &, const Pointbase &)
Definition: PolygonTriangulator.cxx:1354