CDT  2.1.0
C++ library for constrained Delaunay triangulation
Loading...
Searching...
No Matches
CDT.cpp
Go to the documentation of this file.
1/* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
13
14#ifdef CDT_USE_AS_COMPILED_LIBRARY
15
16#include "CDT.hpp"
17#include "CDTUtils.hpp"
18#include "Triangulation.hpp"
19#include "VerifyTopology.h"
20
21namespace CDT
22{
23
24template struct CDT_EXPORT V2d<float>;
25template struct CDT_EXPORT V2d<double>;
26
27template struct CDT_EXPORT Box2d<float>;
28template struct CDT_EXPORT Box2d<double>;
29
30template class CDT_EXPORT Triangulation<float>;
31template class CDT_EXPORT Triangulation<double>;
32
35 VertInd,
37 float,
39 float);
42 VertInd,
44 double,
46 double);
48 std::priority_queue<tuple<float, TriInd, VerticesArr3> > >(
49 VertInd,
51 float,
53 float);
55 std::priority_queue<tuple<double, TriInd, VerticesArr3> > >(
56 VertInd,
58 double,
60 double);
61
62template CDT_EXPORT DuplicatesInfo
64template CDT_EXPORT DuplicatesInfo
66
68 std::vector<V2d<float> >&,
69 std::vector<Edge>&);
71 std::vector<V2d<double> >&,
72 std::vector<Edge>&);
73
74template CDT_EXPORT float degToRad<float>(float);
75template CDT_EXPORT double degToRad<double>(double);
76
77template CDT_EXPORT float
78orient2D<float>(const V2d<float>&, const V2d<float>&, const V2d<float>&);
79template CDT_EXPORT double
81
82template CDT_EXPORT float
83area<float>(const V2d<float>&, const V2d<float>&, const V2d<float>&);
84template CDT_EXPORT double
85area<double>(const V2d<double>&, const V2d<double>&, const V2d<double>&);
86
87template CDT_EXPORT V2d<float>
89template CDT_EXPORT V2d<double>
91
92template CDT_EXPORT float
94template CDT_EXPORT double smallestAngle<double>(
95 const V2d<double>&,
96 const V2d<double>&,
97 const V2d<double>&);
98
99template CDT_EXPORT bool
100verifyTopology<float>(const CDT::Triangulation<float>&);
101template CDT_EXPORT bool
102verifyTopology<double>(const CDT::Triangulation<double>&);
103
104template CDT_EXPORT bool verifyWinding<float>(const CDT::Triangulation<float>&);
105template CDT_EXPORT bool
106verifyWinding<double>(const CDT::Triangulation<double>&);
107
108template CDT_EXPORT float distance(const V2d<float>& a, const V2d<float>& b);
109template CDT_EXPORT double distance(const V2d<double>& a, const V2d<double>& b);
110
111template CDT_EXPORT float
112distanceSquared(const V2d<float>& a, const V2d<float>& b);
113template CDT_EXPORT double
114distanceSquared(const V2d<double>& a, const V2d<double>& b);
115
116} // namespace CDT
117
118#endif
Utilities and helpers - implementation.
Public API - implementation.
Triangulation class - implementation.
Helper function to verify if triangulation has no inconsistencies.
Data structure representing a 2D constrained Delaunay triangulation.
Unrefined refineTriangles(VertInd maxVerticesToInsert, RefinementCriterion::Enum refinementCriterion=RefinementCriterion::SmallestAngle, T refinementThreshold=degToRad(T(20)), TriIndUSet *toEraseOrNull=NULL, T minEdgeLength=T(1e-6), RefinementOrder::Enum refinementOrder=RefinementOrder::FIFO)
Triangles refinement by splitting bad triangles.
void RemoveDuplicates(std::vector< TVertex, TAllocator > &vertices, const std::vector< std::size_t > &duplicates)
Remove duplicates in-place from vector of custom points.
Definition CDT.h:321
DuplicatesInfo RemoveDuplicatesAndRemapEdges(std::vector< TVertex, TVertexAllocator > &vertices, TGetVertexCoordX getX, TGetVertexCoordY getY, TEdgeIter edgesFirst, TEdgeIter edgesLast, TGetEdgeVertexStart getStart, TGetEdgeVertexEnd getEnd, TMakeEdgeFromStartAndEnd makeEdge)
Find point duplicates, remove them from vector (in-place) and remap edges (in-place)
Definition CDT.h:365
Namespace containing triangulation functionality.
CDT_EXPORT T degToRad(T degrees)
Convert an angle from degrees to radians.
Definition CDTUtils.hpp:330
bool verifyTopology(const CDT::Triangulation< T, TNearPointLocator > &cdt)
Verify that triangulation topology is consistent.
CDT_EXPORT T area(const V2d< T > &a, const V2d< T > &b, const V2d< T > &c)
Surface area of a triangle ABC.
Definition CDTUtils.hpp:303
CDT_EXPORT T distance(const V2d< T > &a, const V2d< T > &b)
Distance between two 2D points.
Definition CDTUtils.hpp:251
IndexSizeType VertInd
Vertex index.
Definition CDTUtils.h:253
CDT_EXPORT T orient2D(const V2d< T > &p, const V2d< T > &v1, const V2d< T > &v2)
Orient p against line v1-v2 2D: robust geometric predicate.
Definition CDTUtils.hpp:47
CDT_EXPORT T distanceSquared(const V2d< T > &a, const V2d< T > &b)
Squared distance between two 2D points.
Definition CDTUtils.hpp:257
unordered_set< TriInd > TriIndUSet
Hash table of triangles.
Definition CDTUtils.h:403
CDT_EXPORT V2d< T > circumcenter(V2d< T > a, V2d< T > b, V2d< T > c)
Position of ABC triangle circumcenter.
Definition CDTUtils.hpp:309
bool verifyWinding(const CDT::Triangulation< T, TNearPointLocator > &cdt)
Check that every triangle is wound counter-clockwise: degenerate and inverted triangles are topologic...
CDT_EXPORT T smallestAngle(const V2d< T > &a, const V2d< T > &b, const V2d< T > &c)
Smallest angle of triangle ABC in radians.
Definition CDTUtils.hpp:322
2D bounding box
Definition CDTUtils.h:278
Information about removed duplicated vertices.
Definition CDT.h:67
FIFO queue with top() like std::priority_queue
Counts of the refinements that Triangulation::refineTriangles was not able to perform.
2D vector
Definition CDTUtils.h:191