GEOS  3.10.0
TriDelaunayImprover.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2020 Paul Ramsey <pramsey@cleverelephant.ca>
7  *
8  * This is free software; you can redistribute and/or modify it under
9  * the terms of the GNU Lesser General Public Licence as published
10  * by the Free Software Foundation.
11  * See the COPYING file for more information.
12  *
13  **********************************************************************/
14 
15 #pragma once
16 
17 #include <geos/triangulate/tri/TriEdge.h>
18 #include <geos/triangulate/tri/Tri.h>
19 
20 
21 // Forward declarations
22 namespace geos {
23 namespace geom {
24 class Coordinate;
25 }
26 namespace triangulate {
27 namespace tri {
28 class TriList;
29 }
30 }
31 }
32 
36 
37 
38 namespace geos {
39 namespace triangulate {
40 namespace polygon {
41 
42 
52 class GEOS_DLL TriDelaunayImprover {
53 
54 private:
55 
56  // Members
57  static constexpr std::size_t MAX_ITERATION = 200;
58  TriList& triList;
59 
68  std::size_t improveScan(TriList& triList);
69 
77  bool improveNonDelaunay(Tri* tri, TriIndex index);
78 
92  static bool isConvex(const Coordinate& adj0, const Coordinate& adj1,
93  const Coordinate& opp0, const Coordinate& opp1);
94 
107  static bool isDelaunay(const Coordinate& adj0, const Coordinate& adj1,
108  const Coordinate& opp0, const Coordinate& opp1);
109 
120  static bool
121  isInCircle(const Coordinate& a, const Coordinate& b,
122  const Coordinate& c, const Coordinate& p);
123 
124  void improve();
125 
126 
127 public:
128 
129  TriDelaunayImprover(TriList& p_triList)
130  : triList(p_triList)
131  {};
132 
141  static void improve(TriList& triList);
142 
143 
144 };
145 
146 
147 
148 } // namespace geos.triangulate.polygon
149 } // namespace geos.triangulate
150 } // namespace geos
151 
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
Definition: TriDelaunayImprover.h:52
Definition: TriList.h:48
Definition: Tri.h:50
Basic namespace for all GEOS functionalities.
Definition: Angle.h:26