GEOS  3.13.0dev
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 #include <geos/triangulate/tri/TriList.h>
20 
21 
22 // Forward declarations
23 namespace geos {
24 namespace geom {
25 class Coordinate;
26 }
27 }
28 
32 
33 
34 namespace geos {
35 namespace triangulate {
36 namespace polygon {
37 
38 
48 class GEOS_DLL TriDelaunayImprover {
49 
50 private:
51 
52  // Members
53  static constexpr std::size_t MAX_ITERATION = 200;
54  TriList<Tri>& triList;
55 
64  std::size_t improveScan(TriList<Tri>& triList);
65 
73  bool improveNonDelaunay(Tri* tri, TriIndex index);
74 
88  static bool isConvex(const Coordinate& adj0, const Coordinate& adj1,
89  const Coordinate& opp0, const Coordinate& opp1);
90 
103  static bool isDelaunay(const Coordinate& adj0, const Coordinate& adj1,
104  const Coordinate& opp0, const Coordinate& opp1);
105 
116  static bool
117  isInCircle(const Coordinate& a, const Coordinate& b,
118  const Coordinate& c, const Coordinate& p);
119 
120  void improve();
121 
122 
123 public:
124 
126  : triList(p_triList)
127  {};
128 
137  static void improve(TriList<Tri>& triList);
138 
139 
140 };
141 
142 
143 
144 } // namespace geos.triangulate.polygon
145 } // namespace geos.triangulate
146 } // namespace geos
147 
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:216
Definition: TriDelaunayImprover.h:48
static void improve(TriList< Tri > &triList)
Definition: TriList.h:54
Definition: Tri.h:49
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25