GEOS 3.14.0dev
HullTriangulation.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2021 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/algorithm/hull/HullTri.h>
18#include <geos/triangulate/tri/TriList.h>
19#include <geos/triangulate/quadedge/TriangleVisitor.h>
20
21
22namespace geos {
23namespace geom {
24class Geometry;
25class GeometryFactory;
26class Coordinate;
27}
28namespace triangulate {
29namespace quadedge {
30class QuadEdge;
31class QuadEdgeSubdivision;
32}
33}
34}
35
36namespace geos {
37namespace algorithm { // geos::algorithm
38namespace hull { // geos::algorithm::hull
39
40
41class HullTriangulation
42{
43 using Geometry = geos::geom::Geometry;
44 using GeometryFactory = geos::geom::GeometryFactory;
45 using Coordinate = geos::geom::Coordinate;
46 template<typename TriType>
49 using QuadEdgeSubdivision = geos::triangulate::quadedge::QuadEdgeSubdivision;
51
52private:
53
54 static void toTris(
55 QuadEdgeSubdivision& subdiv,
56 TriList<HullTri>& triList);
57
68 static geom::CoordinateSequence traceBoundary(
69 TriList<HullTri>& triList);
70
71 static HullTri* findBorderTri(
72 TriList<HullTri>& triList);
73
74
75
76public:
77
78 HullTriangulation() {};
79
80 static void createDelaunayTriangulation(
81 const Geometry* geom,
82 TriList<HullTri>& triList);
83
92 static std::unique_ptr<Geometry> traceBoundaryPolygon(
93 TriList<HullTri>& triList,
94 const GeometryFactory* factory);
95
96 static HullTri* nextBorderTri(HullTri* triStart);
97
106 static std::unique_ptr<Geometry> geomunion(
107 TriList<HullTri>& triList,
108 const GeometryFactory* factory);
109
110
111 class HullTriVisitor : public TriangleVisitor
112 {
113
114 private:
115
116 TriList<HullTri>& triList;
117
118 public:
119
120 HullTriVisitor(TriList<HullTri>& p_triList)
121 : triList(p_triList)
122 {};
123
124 void visit(std::array<QuadEdge*, 3>& triEdges) override;
125
126 }; // HullTriVisitor
127
128
129}; // HullTriangulation
130
131
132
133} // geos::algorithm::hull
134} // geos::algorithm
135} // geos
136
Coordinate is the lightweight class used to store coordinates.
Definition Coordinate.h:217
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition GeometryFactory.h:70
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition Geometry.h:197
A class that contains the QuadEdges representing a planar subdivision that models a triangulation.
Definition QuadEdgeSubdivision.h:78
A class that represents the edge data structure which implements the quadedge algebra.
Definition QuadEdge.h:53
An interface for algorithms which process the triangles in a QuadEdgeSubdivision.
Definition TriangleVisitor.h:33
Definition TriList.h:50
Basic namespace for all GEOS functionalities.
Definition geos.h:39