pythoncdt 2.0.1__tar.gz → 2.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/CDT/CMakeLists.txt +1 -1
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/CDT/conanfile.py +1 -1
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/CDT/include/CDTUtils.h +12 -13
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/CDT/include/Triangulation.h +46 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/CDT/include/Triangulation.hpp +135 -37
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/CDT/src/CDT.cpp +29 -0
- pythoncdt-2.1.0/CDT/visualizer/data/issue-230.txt +11 -0
- pythoncdt-2.1.0/CDT/visualizer/data/issue-235.txt +17 -0
- pythoncdt-2.1.0/CDT/visualizer/data/issue-237.txt +17 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/visualizer/main.cpp +25 -4
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/PKG-INFO +1 -1
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/src/cdt_bindings.cpp +9 -2
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/src/pythoncdt/_core.pyi +6 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/tests/stubtest-allowlist.txt +1 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/tests/test_bindings.py +3 -2
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/.clang-format +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/.github/dependabot.yml +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/.github/release-drafter.yml +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/.github/workflows/ci.yml +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/.github/workflows/release-drafter.yml +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/.github/workflows/wheels.yml +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/.gitignore +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/.gitmodules +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/.pre-commit-config.yaml +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/.clang-format +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/.github/workflows/ci_builds.yml +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/.github/workflows/documentation.yml +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/.gitignore +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/.gitmodules +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/.mailmap +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/CDT/LICENSE +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/CDT/LICENSE-LLVM.txt +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/CDT/LICENSE-predicates.txt +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/CDT/conan_basic_setup.cmake +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/CDT/extras/VerifyTopology.h +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/CDT/include/CDT.h +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/CDT/include/CDT.hpp +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/CDT/include/CDTUtils.hpp +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/CDT/include/KDTree.h +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/CDT/include/LocatorKDTree.h +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/CDT/include/portable_nth_element.hpp +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/CDT/include/predicates.h +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/CDT/include/remove_at.hpp +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/LICENSE +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/visualizer/CMakeLists.txt +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/visualizer/LICENSE +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/visualizer/data/Capital A.txt +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/visualizer/data/Constrained Sweden.txt +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/visualizer/data/Hanging.txt +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/visualizer/data/Hanging2.txt +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/visualizer/data/HangingIntersection.txt +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/visualizer/data/LakeSuperior.txt +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/visualizer/data/Letter u.txt +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/visualizer/data/OnEdge.txt +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/visualizer/data/OnEdge2.txt +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/visualizer/data/Orange County.txt +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/visualizer/data/ProblematicCase1.txt +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/visualizer/data/Sweden with constraints.txt +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/visualizer/data/Sweden with duplicate points.txt +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/visualizer/data/Sweden.txt +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/visualizer/data/cdt.txt +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/visualizer/data/cdt_duplicates.txt +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/visualizer/data/corner cases.txt +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/visualizer/data/crossing-edges.txt +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/visualizer/data/ditch.txt +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/visualizer/data/duplicates.txt +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/visualizer/data/gh_issue.txt +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/visualizer/data/guitar no box.txt +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/visualizer/data/guitar.txt +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/visualizer/data/island.txt +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/visualizer/data/issue-42-full-boundary-overlap-2.txt +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/visualizer/data/issue-42-full-boundary-overlap.txt +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/visualizer/data/issue-42-hole-overlaps-bondary.txt +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/visualizer/data/issue-42-multiple-boundary-overlaps-conform-to-edge.txt +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/visualizer/data/issue-42-multiple-boundary-overlaps.txt +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/visualizer/data/issue-65-wrong-edges.txt +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/visualizer/data/kidney.txt +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/visualizer/data/overlapping constraints.txt +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/visualizer/data/overlapping constraints2.txt +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/visualizer/data/points_on_constraint_edge.txt +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/visualizer/data/regression_issue_38_wrong_hull.txt +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/visualizer/data/regression_issue_38_wrong_hull_small.txt +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/visualizer/data/square with crack.txt +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/visualizer/data/unit square.txt +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/CMakeLists.txt +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/LICENSE +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/README.md +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/benchmark_gil_release.py +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/benchmark_list_vs_array_access.py +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/pyproject.toml +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/src/pythoncdt/__init__.py +0 -0
- {pythoncdt-2.0.1 → pythoncdt-2.1.0}/src/pythoncdt/py.typed +0 -0
|
@@ -10,7 +10,7 @@ from conan.tools.env import Environment
|
|
|
10
10
|
|
|
11
11
|
class CDTConan(ConanFile):
|
|
12
12
|
name = "cdt"
|
|
13
|
-
version = "2.0
|
|
13
|
+
version = "2.1.0"
|
|
14
14
|
license = "MPL-2.0 AND BSD-3-Clause AND Apache-2.0 WITH LLVM-exception"
|
|
15
15
|
url = "https://github.com/artem-ogre/CDT"
|
|
16
16
|
description = "Numerically robust C++ implementation of constrained Delaunay triangulation (CDT)"
|
|
@@ -97,6 +97,7 @@ using std::unordered_set;
|
|
|
97
97
|
#include <boost/functional/hash.hpp>
|
|
98
98
|
#include <boost/lexical_cast.hpp>
|
|
99
99
|
#include <boost/tuple/tuple.hpp>
|
|
100
|
+
#include <boost/tuple/tuple_comparison.hpp>
|
|
100
101
|
#include <boost/unordered_map.hpp>
|
|
101
102
|
#include <boost/unordered_set.hpp>
|
|
102
103
|
namespace CDT
|
|
@@ -117,22 +118,20 @@ std::string to_string(const T& value)
|
|
|
117
118
|
} // namespace CDT
|
|
118
119
|
#endif
|
|
119
120
|
|
|
120
|
-
/// Ensure precise floating-point math without contraction to fused multiply-add
|
|
121
|
+
/// Ensure precise floating-point math without contraction to fused multiply-add
|
|
122
|
+
/// operations.
|
|
121
123
|
#ifdef _MSC_VER
|
|
122
|
-
#define CDT_ENSURE_PRECISE_MATH
|
|
123
|
-
__pragma(float_control(push)) \
|
|
124
|
-
|
|
125
|
-
__pragma(fp_contract(off))
|
|
124
|
+
#define CDT_ENSURE_PRECISE_MATH \
|
|
125
|
+
__pragma(float_control(push)) __pragma(float_control(precise, on)) \
|
|
126
|
+
__pragma(fp_contract(off))
|
|
126
127
|
#elif defined(__clang__)
|
|
127
|
-
#define CDT_ENSURE_PRECISE_MATH
|
|
128
|
-
_Pragma("float_control(push)") \
|
|
129
|
-
|
|
130
|
-
_Pragma("clang fp contract(off)")
|
|
128
|
+
#define CDT_ENSURE_PRECISE_MATH \
|
|
129
|
+
_Pragma("float_control(push)") _Pragma("float_control(precise, on)") \
|
|
130
|
+
_Pragma("clang fp contract(off)")
|
|
131
131
|
#elif defined(__GNUC__)
|
|
132
|
-
#define CDT_ENSURE_PRECISE_MATH
|
|
133
|
-
_Pragma("GCC push_options") \
|
|
134
|
-
|
|
135
|
-
_Pragma("GCC optimize(\"fp-contract=off\")")
|
|
132
|
+
#define CDT_ENSURE_PRECISE_MATH \
|
|
133
|
+
_Pragma("GCC push_options") _Pragma("GCC optimize(\"no-fast-math\")") \
|
|
134
|
+
_Pragma("GCC optimize(\"fp-contract=off\")")
|
|
136
135
|
#else
|
|
137
136
|
#define CDT_ENSURE_PRECISE_MATH _Pragma("STDC FP_CONTRACT OFF")
|
|
138
137
|
#endif
|
|
@@ -91,6 +91,32 @@ struct CDT_EXPORT RefinementCriterion
|
|
|
91
91
|
};
|
|
92
92
|
};
|
|
93
93
|
|
|
94
|
+
/**
|
|
95
|
+
* Enum of bad triangles refinement orders
|
|
96
|
+
*/
|
|
97
|
+
struct CDT_EXPORT RefinementOrder
|
|
98
|
+
{
|
|
99
|
+
/**
|
|
100
|
+
* The Enum itself
|
|
101
|
+
* @note needed to pre c++11 compilers that don't support 'class enum'
|
|
102
|
+
*/
|
|
103
|
+
enum Enum
|
|
104
|
+
{
|
|
105
|
+
FIFO, ///< in the order found
|
|
106
|
+
WorstFirst, ///< worst first
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
/// FIFO queue with `top()` like `std::priority_queue`
|
|
111
|
+
template <typename T>
|
|
112
|
+
struct FifoQueue : std::queue<T>
|
|
113
|
+
{
|
|
114
|
+
const T& top() const
|
|
115
|
+
{
|
|
116
|
+
return this->front();
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
|
|
94
120
|
/**
|
|
95
121
|
* Counts of the refinements that Triangulation::refineTriangles was not able
|
|
96
122
|
* to perform
|
|
@@ -764,9 +790,24 @@ public:
|
|
|
764
790
|
* @param minEdgeLength don't split edges/triangles already this short:
|
|
765
791
|
* acute corners and close fixed edges can otherwise force ever-shrinking
|
|
766
792
|
* splits. 0 never gives up.
|
|
793
|
+
* @param refinementOrder bad triangles refinement order
|
|
767
794
|
* @return refinements that could not be performed
|
|
768
795
|
* @throw FinalizedError if triangulation was already finalized
|
|
769
796
|
*/
|
|
797
|
+
Unrefined refineTriangles(
|
|
798
|
+
VertInd maxVerticesToInsert,
|
|
799
|
+
RefinementCriterion::Enum refinementCriterion =
|
|
800
|
+
RefinementCriterion::SmallestAngle,
|
|
801
|
+
T refinementThreshold = degToRad(T(20)),
|
|
802
|
+
TriIndUSet* toEraseOrNull = NULL,
|
|
803
|
+
T minEdgeLength = T(1e-6),
|
|
804
|
+
RefinementOrder::Enum refinementOrder = RefinementOrder::FIFO);
|
|
805
|
+
/**
|
|
806
|
+
* #refineTriangles with a custom queue of bad triangles
|
|
807
|
+
* @tparam TQueue FifoQueue or `std::priority_queue` of
|
|
808
|
+
* `tuple<T, TriInd, VerticesArr3>`: badness, triangle, its vertices
|
|
809
|
+
*/
|
|
810
|
+
template <typename TQueue>
|
|
770
811
|
Unrefined refineTriangles(
|
|
771
812
|
VertInd maxVerticesToInsert,
|
|
772
813
|
RefinementCriterion::Enum refinementCriterion =
|
|
@@ -1056,6 +1097,9 @@ private:
|
|
|
1056
1097
|
const Triangle& tri,
|
|
1057
1098
|
RefinementCriterion::Enum refinementCriterion,
|
|
1058
1099
|
T refinementThreshold) const;
|
|
1100
|
+
T triangleBadness(
|
|
1101
|
+
const Triangle& tri,
|
|
1102
|
+
RefinementCriterion::Enum refinementCriterion) const;
|
|
1059
1103
|
/// Check if the triangle's smallest angle is enclosed by two fixed edges:
|
|
1060
1104
|
/// such an angle comes from the input and can not be made any larger
|
|
1061
1105
|
bool isSmallestAngleFixed(const Triangle& tri) const;
|
|
@@ -1210,6 +1254,8 @@ private:
|
|
|
1210
1254
|
void insertVertices_KDTreeBFS(VertInd superGeomVertCount, Box2d<T> box);
|
|
1211
1255
|
std::pair<TriInd, TriInd> edgeTriangles(VertInd a, VertInd b) const;
|
|
1212
1256
|
bool hasEdge(VertInd a, VertInd b) const;
|
|
1257
|
+
/// Vertex opposed to a non-fixed edge that lies on it within tolerance
|
|
1258
|
+
VertInd opposedVertexOnEdge(const Edge& edge, T tolerance) const;
|
|
1213
1259
|
bool
|
|
1214
1260
|
hasAnotherFixedEdgeAtSmallAngle(VertInd v, const Edge& excludeEdge) const;
|
|
1215
1261
|
void setAdjacentTriangle(const VertInd v, const TriInd t);
|
|
@@ -585,12 +585,6 @@ void Triangulation<T, TNearPointLocator>::insertEdgeIteration(
|
|
|
585
585
|
if(iA == iB) // edge connects a vertex to itself
|
|
586
586
|
return;
|
|
587
587
|
|
|
588
|
-
if(hasEdge(iA, iB))
|
|
589
|
-
{
|
|
590
|
-
fixEdge(edge, originalEdge);
|
|
591
|
-
return;
|
|
592
|
-
}
|
|
593
|
-
|
|
594
588
|
const V2d<T>& a = vertices[iA];
|
|
595
589
|
const V2d<T>& b = vertices[iB];
|
|
596
590
|
const T distanceTolerance =
|
|
@@ -598,16 +592,28 @@ void Triangulation<T, TNearPointLocator>::insertEdgeIteration(
|
|
|
598
592
|
? T(0)
|
|
599
593
|
: m_minDistToConstraintEdge * distance(a, b);
|
|
600
594
|
|
|
595
|
+
if(hasEdge(iA, iB))
|
|
596
|
+
{
|
|
597
|
+
const VertInd iV = opposedVertexOnEdge(edge, distanceTolerance);
|
|
598
|
+
if(iV != noVertex)
|
|
599
|
+
{
|
|
600
|
+
remaining.push_back(Edge(iV, iB));
|
|
601
|
+
remaining.push_back(Edge(iA, iV));
|
|
602
|
+
return;
|
|
603
|
+
}
|
|
604
|
+
fixEdge(edge, originalEdge);
|
|
605
|
+
return;
|
|
606
|
+
}
|
|
607
|
+
|
|
601
608
|
TriInd iT;
|
|
602
609
|
// Note: 'L' is left and 'R' is right of the inserted constraint edge
|
|
603
610
|
VertInd iVL, iVR;
|
|
604
611
|
tie(iT, iVL, iVR) = intersectedTriangle(iA, a, b, distanceTolerance);
|
|
605
|
-
// if one of the triangle vertices is on the edge,
|
|
612
|
+
// if one of the triangle vertices is on the edge, split edge at it
|
|
606
613
|
if(iT == noNeighbor)
|
|
607
614
|
{
|
|
608
|
-
const Edge edgePart(iA, iVL);
|
|
609
|
-
fixEdge(edgePart, originalEdge);
|
|
610
615
|
remaining.push_back(Edge(iVL, iB));
|
|
616
|
+
remaining.push_back(Edge(iA, iVL));
|
|
611
617
|
return;
|
|
612
618
|
}
|
|
613
619
|
Triangle t = triangles[iT];
|
|
@@ -789,8 +795,27 @@ void Triangulation<T, TNearPointLocator>::conformToEdgeIteration(
|
|
|
789
795
|
if(iA == iB) // edge connects a vertex to itself
|
|
790
796
|
return;
|
|
791
797
|
|
|
798
|
+
const V2d<T>& a = vertices[iA];
|
|
799
|
+
const V2d<T>& b = vertices[iB];
|
|
800
|
+
const T distanceTolerance =
|
|
801
|
+
m_minDistToConstraintEdge == T(0)
|
|
802
|
+
? T(0)
|
|
803
|
+
: m_minDistToConstraintEdge * distance(a, b);
|
|
804
|
+
|
|
792
805
|
if(hasEdge(iA, iB))
|
|
793
806
|
{
|
|
807
|
+
const VertInd iV = opposedVertexOnEdge(edge, distanceTolerance);
|
|
808
|
+
if(iV != noVertex)
|
|
809
|
+
{
|
|
810
|
+
#ifdef CDT_CXX11_IS_SUPPORTED
|
|
811
|
+
remaining.emplace_back(Edge(iV, iB), originals, overlaps);
|
|
812
|
+
remaining.emplace_back(Edge(iA, iV), originals, overlaps);
|
|
813
|
+
#else
|
|
814
|
+
remaining.push_back(make_tuple(Edge(iV, iB), originals, overlaps));
|
|
815
|
+
remaining.push_back(make_tuple(Edge(iA, iV), originals, overlaps));
|
|
816
|
+
#endif
|
|
817
|
+
return;
|
|
818
|
+
}
|
|
794
819
|
fixEdge(edge);
|
|
795
820
|
if(overlaps > 0)
|
|
796
821
|
overlapCount[edge] = overlaps;
|
|
@@ -802,27 +827,18 @@ void Triangulation<T, TNearPointLocator>::conformToEdgeIteration(
|
|
|
802
827
|
return;
|
|
803
828
|
}
|
|
804
829
|
|
|
805
|
-
const V2d<T>& a = vertices[iA];
|
|
806
|
-
const V2d<T>& b = vertices[iB];
|
|
807
|
-
const T distanceTolerance =
|
|
808
|
-
m_minDistToConstraintEdge == T(0)
|
|
809
|
-
? T(0)
|
|
810
|
-
: m_minDistToConstraintEdge * distance(a, b);
|
|
811
830
|
TriInd iT;
|
|
812
831
|
VertInd iVleft, iVright;
|
|
813
832
|
tie(iT, iVleft, iVright) = intersectedTriangle(iA, a, b, distanceTolerance);
|
|
814
|
-
// if one of the triangle vertices is on the edge,
|
|
833
|
+
// if one of the triangle vertices is on the edge, split edge at it
|
|
815
834
|
if(iT == noNeighbor)
|
|
816
835
|
{
|
|
817
|
-
const Edge edgePart(iA, iVleft);
|
|
818
|
-
fixEdge(edgePart);
|
|
819
|
-
if(overlaps > 0)
|
|
820
|
-
overlapCount[edgePart] = overlaps;
|
|
821
|
-
detail::insert_unique(pieceToOriginals[edgePart], originals);
|
|
822
836
|
#ifdef CDT_CXX11_IS_SUPPORTED
|
|
823
837
|
remaining.emplace_back(Edge(iVleft, iB), originals, overlaps);
|
|
838
|
+
remaining.emplace_back(Edge(iA, iVleft), originals, overlaps);
|
|
824
839
|
#else
|
|
825
840
|
remaining.push_back(make_tuple(Edge(iVleft, iB), originals, overlaps));
|
|
841
|
+
remaining.push_back(make_tuple(Edge(iA, iVleft), originals, overlaps));
|
|
826
842
|
#endif
|
|
827
843
|
return;
|
|
828
844
|
}
|
|
@@ -1474,6 +1490,19 @@ bool Triangulation<T, TNearPointLocator>::isRefinementNeeded(
|
|
|
1474
1490
|
return false;
|
|
1475
1491
|
}
|
|
1476
1492
|
|
|
1493
|
+
template <typename T, typename TNearPointLocator>
|
|
1494
|
+
T Triangulation<T, TNearPointLocator>::triangleBadness(
|
|
1495
|
+
const Triangle& tri,
|
|
1496
|
+
const RefinementCriterion::Enum refinementCriterion) const
|
|
1497
|
+
{
|
|
1498
|
+
const V2d<T>& a = vertices[tri.vertices[0]];
|
|
1499
|
+
const V2d<T>& b = vertices[tri.vertices[1]];
|
|
1500
|
+
const V2d<T>& c = vertices[tri.vertices[2]];
|
|
1501
|
+
return refinementCriterion == RefinementCriterion::SmallestAngle
|
|
1502
|
+
? -smallestAngle(a, b, c)
|
|
1503
|
+
: area(a, b, c);
|
|
1504
|
+
}
|
|
1505
|
+
|
|
1477
1506
|
template <typename T, typename TNearPointLocator>
|
|
1478
1507
|
bool Triangulation<T, TNearPointLocator>::isSmallestAngleFixed(
|
|
1479
1508
|
const Triangle& tri) const
|
|
@@ -1665,9 +1694,7 @@ TriIndVec Triangulation<T, TNearPointLocator>::resolveEncroachedEdges(
|
|
|
1665
1694
|
const Edge triEdge(t.vertices[i], t.vertices[cw(i)]);
|
|
1666
1695
|
if(fixedEdges.find(triEdge) == fixedEdges.end())
|
|
1667
1696
|
continue;
|
|
1668
|
-
if(isEdgeEncroached(triEdge)
|
|
1669
|
-
(circumcenterOrNull &&
|
|
1670
|
-
isEdgeEncroachedBy(triEdge, *circumcenterOrNull)))
|
|
1697
|
+
if(isEdgeEncroached(triEdge))
|
|
1671
1698
|
{
|
|
1672
1699
|
encroachedEdges.push(triEdge);
|
|
1673
1700
|
}
|
|
@@ -2533,6 +2560,31 @@ bool Triangulation<T, TNearPointLocator>::hasEdge(
|
|
|
2533
2560
|
return edgeTriangles(a, b).first != invalidIndexSizeType;
|
|
2534
2561
|
}
|
|
2535
2562
|
|
|
2563
|
+
template <typename T, typename TNearPointLocator>
|
|
2564
|
+
VertInd Triangulation<T, TNearPointLocator>::opposedVertexOnEdge(
|
|
2565
|
+
const Edge& edge,
|
|
2566
|
+
const T tolerance) const
|
|
2567
|
+
{
|
|
2568
|
+
if(fixedEdges.count(edge))
|
|
2569
|
+
return noVertex;
|
|
2570
|
+
const V2d<T>& a = vertices[edge.v1()];
|
|
2571
|
+
const V2d<T>& b = vertices[edge.v2()];
|
|
2572
|
+
const std::pair<TriInd, TriInd> tris = edgeTriangles(edge.v1(), edge.v2());
|
|
2573
|
+
const VertInd opposed[] = {
|
|
2574
|
+
opposedVertex(triangles[tris.first], tris.second),
|
|
2575
|
+
opposedVertex(triangles[tris.second], tris.first)};
|
|
2576
|
+
for(int i = 0; i < 2; ++i)
|
|
2577
|
+
{
|
|
2578
|
+
const V2d<T>& v = vertices[opposed[i]];
|
|
2579
|
+
// near line ab and inside its diametral circle: both parts are
|
|
2580
|
+
// shorter than ab, so splitting terminates
|
|
2581
|
+
if(locatePointLine(v, a, b, tolerance) == PtLineLocation::OnLine &&
|
|
2582
|
+
detail::isEncroachingOnEdge(v, a, b))
|
|
2583
|
+
return opposed[i];
|
|
2584
|
+
}
|
|
2585
|
+
return noVertex;
|
|
2586
|
+
}
|
|
2587
|
+
|
|
2536
2588
|
/// Checks whether vertex v has a fixed edge, other than excludeEdge, incident
|
|
2537
2589
|
/// to it at a small angle: recognizes a subsegment endpoint as a shared corner
|
|
2538
2590
|
/// even after v's segments have already been split.
|
|
@@ -2606,6 +2658,38 @@ void Triangulation<T, TNearPointLocator>::tryInitNearestPointLocator()
|
|
|
2606
2658
|
}
|
|
2607
2659
|
|
|
2608
2660
|
template <typename T, typename TNearPointLocator>
|
|
2661
|
+
Unrefined Triangulation<T, TNearPointLocator>::refineTriangles(
|
|
2662
|
+
const VertInd maxVerticesToInsert,
|
|
2663
|
+
const RefinementCriterion::Enum refinementCriterion,
|
|
2664
|
+
const T refinementThreshold,
|
|
2665
|
+
TriIndUSet* const toEraseOrNull,
|
|
2666
|
+
const T minEdgeLength,
|
|
2667
|
+
const RefinementOrder::Enum refinementOrder)
|
|
2668
|
+
{
|
|
2669
|
+
switch(refinementOrder)
|
|
2670
|
+
{
|
|
2671
|
+
case RefinementOrder::FIFO:
|
|
2672
|
+
return refineTriangles<FifoQueue<tuple<T, TriInd, VerticesArr3> > >(
|
|
2673
|
+
maxVerticesToInsert,
|
|
2674
|
+
refinementCriterion,
|
|
2675
|
+
refinementThreshold,
|
|
2676
|
+
toEraseOrNull,
|
|
2677
|
+
minEdgeLength);
|
|
2678
|
+
case RefinementOrder::WorstFirst:
|
|
2679
|
+
return refineTriangles<
|
|
2680
|
+
std::priority_queue<tuple<T, TriInd, VerticesArr3> > >(
|
|
2681
|
+
maxVerticesToInsert,
|
|
2682
|
+
refinementCriterion,
|
|
2683
|
+
refinementThreshold,
|
|
2684
|
+
toEraseOrNull,
|
|
2685
|
+
minEdgeLength);
|
|
2686
|
+
}
|
|
2687
|
+
assert(false); // unreachable code
|
|
2688
|
+
return Unrefined();
|
|
2689
|
+
}
|
|
2690
|
+
|
|
2691
|
+
template <typename T, typename TNearPointLocator>
|
|
2692
|
+
template <typename TQueue>
|
|
2609
2693
|
Unrefined Triangulation<T, TNearPointLocator>::refineTriangles(
|
|
2610
2694
|
const VertInd maxVerticesToInsert,
|
|
2611
2695
|
const RefinementCriterion::Enum refinementCriterion,
|
|
@@ -2635,7 +2719,8 @@ Unrefined Triangulation<T, TNearPointLocator>::refineTriangles(
|
|
|
2635
2719
|
unrefined);
|
|
2636
2720
|
|
|
2637
2721
|
// refine triangulation by inserting bad-quality triangles' circumcenters
|
|
2638
|
-
|
|
2722
|
+
// keep vertices to detect triangles modified after enqueueing
|
|
2723
|
+
TQueue badTriangles;
|
|
2639
2724
|
for(TriInd iT(0), n(triangles.size()); iT < n; ++iT)
|
|
2640
2725
|
{
|
|
2641
2726
|
const Triangle& t = triangles[iT];
|
|
@@ -2643,29 +2728,32 @@ Unrefined Triangulation<T, TNearPointLocator>::refineTriangles(
|
|
|
2643
2728
|
!(toEraseOrNull && toEraseOrNull->count(iT)) &&
|
|
2644
2729
|
isRefinementNeeded(t, refinementCriterion, refinementThreshold))
|
|
2645
2730
|
{
|
|
2646
|
-
badTriangles.push(
|
|
2731
|
+
badTriangles.push(make_tuple(
|
|
2732
|
+
triangleBadness(t, refinementCriterion), iT, t.vertices));
|
|
2647
2733
|
}
|
|
2648
2734
|
}
|
|
2649
2735
|
|
|
2650
2736
|
while(!badTriangles.empty() && remainingVertexBudget > 0)
|
|
2651
2737
|
{
|
|
2652
|
-
const TriInd iT = badTriangles.
|
|
2738
|
+
const TriInd iT = get<1>(badTriangles.top());
|
|
2739
|
+
const VerticesArr3 vv = get<2>(badTriangles.top());
|
|
2740
|
+
const Triangle& t = triangles[iT];
|
|
2653
2741
|
badTriangles.pop();
|
|
2654
2742
|
if(toEraseOrNull && toEraseOrNull->count(iT))
|
|
2655
2743
|
continue;
|
|
2656
|
-
if(
|
|
2657
|
-
|
|
2744
|
+
if(vv != t.vertices)
|
|
2745
|
+
continue; // skip triangle that got modified since put in queue
|
|
2746
|
+
if(!isRefinementNeeded(t, refinementCriterion, refinementThreshold) ||
|
|
2658
2747
|
(refinementCriterion == RefinementCriterion::SmallestAngle &&
|
|
2659
|
-
isSmallestAngleFixed(
|
|
2748
|
+
isSmallestAngleFixed(t)))
|
|
2660
2749
|
{
|
|
2661
2750
|
// fixed-edge sharp angle is impossible to refine
|
|
2662
2751
|
continue;
|
|
2663
2752
|
}
|
|
2664
2753
|
// copy: resolveEncroachedEdges below can re-allocate 'triangles'
|
|
2665
|
-
const
|
|
2666
|
-
const V2d<T>&
|
|
2667
|
-
const V2d<T>&
|
|
2668
|
-
const V2d<T>& v2 = vertices[badTVerts[2]];
|
|
2754
|
+
const V2d<T>& v0 = vertices[vv[0]];
|
|
2755
|
+
const V2d<T>& v1 = vertices[vv[1]];
|
|
2756
|
+
const V2d<T>& v2 = vertices[vv[2]];
|
|
2669
2757
|
const T shortestEdge = std::min(
|
|
2670
2758
|
distance(v0, v1), std::min(distance(v1, v2), distance(v2, v0)));
|
|
2671
2759
|
if(shortestEdge <= minEdgeLength)
|
|
@@ -2708,9 +2796,16 @@ Unrefined Triangulation<T, TNearPointLocator>::refineTriangles(
|
|
|
2708
2796
|
typedef TriIndVec::const_iterator It;
|
|
2709
2797
|
for(It it = badTris.begin(); it != badTris.end(); ++it)
|
|
2710
2798
|
{
|
|
2711
|
-
|
|
2799
|
+
const Triangle& bad = triangles[*it];
|
|
2800
|
+
badTriangles.push(make_tuple(
|
|
2801
|
+
triangleBadness(bad, refinementCriterion),
|
|
2802
|
+
*it,
|
|
2803
|
+
bad.vertices));
|
|
2712
2804
|
}
|
|
2713
|
-
badTriangles.push(
|
|
2805
|
+
badTriangles.push(make_tuple(
|
|
2806
|
+
triangleBadness(triangles[iT], refinementCriterion),
|
|
2807
|
+
iT,
|
|
2808
|
+
triangles[iT].vertices));
|
|
2714
2809
|
continue;
|
|
2715
2810
|
}
|
|
2716
2811
|
// splitting was given up on: inserting would encroach anyway
|
|
@@ -2769,7 +2864,10 @@ Unrefined Triangulation<T, TNearPointLocator>::refineTriangles(
|
|
|
2769
2864
|
!touchesSuperTriangle(t) &&
|
|
2770
2865
|
isRefinementNeeded(t, refinementCriterion, refinementThreshold))
|
|
2771
2866
|
{
|
|
2772
|
-
badTriangles.push(
|
|
2867
|
+
badTriangles.push(make_tuple(
|
|
2868
|
+
triangleBadness(t, refinementCriterion),
|
|
2869
|
+
currTri,
|
|
2870
|
+
t.vertices));
|
|
2773
2871
|
}
|
|
2774
2872
|
currTri = t.next(iVert).first;
|
|
2775
2873
|
} while(currTri != start);
|
|
@@ -30,6 +30,35 @@ template struct CDT_EXPORT Box2d<double>;
|
|
|
30
30
|
template class CDT_EXPORT Triangulation<float>;
|
|
31
31
|
template class CDT_EXPORT Triangulation<double>;
|
|
32
32
|
|
|
33
|
+
template CDT_EXPORT Unrefined Triangulation<float>::refineTriangles<
|
|
34
|
+
FifoQueue<tuple<float, TriInd, VerticesArr3> > >(
|
|
35
|
+
VertInd,
|
|
36
|
+
RefinementCriterion::Enum,
|
|
37
|
+
float,
|
|
38
|
+
TriIndUSet*,
|
|
39
|
+
float);
|
|
40
|
+
template CDT_EXPORT Unrefined Triangulation<double>::refineTriangles<
|
|
41
|
+
FifoQueue<tuple<double, TriInd, VerticesArr3> > >(
|
|
42
|
+
VertInd,
|
|
43
|
+
RefinementCriterion::Enum,
|
|
44
|
+
double,
|
|
45
|
+
TriIndUSet*,
|
|
46
|
+
double);
|
|
47
|
+
template CDT_EXPORT Unrefined Triangulation<float>::refineTriangles<
|
|
48
|
+
std::priority_queue<tuple<float, TriInd, VerticesArr3> > >(
|
|
49
|
+
VertInd,
|
|
50
|
+
RefinementCriterion::Enum,
|
|
51
|
+
float,
|
|
52
|
+
TriIndUSet*,
|
|
53
|
+
float);
|
|
54
|
+
template CDT_EXPORT Unrefined Triangulation<double>::refineTriangles<
|
|
55
|
+
std::priority_queue<tuple<double, TriInd, VerticesArr3> > >(
|
|
56
|
+
VertInd,
|
|
57
|
+
RefinementCriterion::Enum,
|
|
58
|
+
double,
|
|
59
|
+
TriIndUSet*,
|
|
60
|
+
double);
|
|
61
|
+
|
|
33
62
|
template CDT_EXPORT DuplicatesInfo
|
|
34
63
|
RemoveDuplicates<float>(std::vector<V2d<float> >&);
|
|
35
64
|
template CDT_EXPORT DuplicatesInfo
|
|
@@ -157,6 +157,7 @@ public:
|
|
|
157
157
|
, m_minRefinementEdgeLength(1e-6)
|
|
158
158
|
, m_refinementCriterion(CDT::RefinementCriterion::SmallestAngle)
|
|
159
159
|
, m_refinementThreshold(20.0)
|
|
160
|
+
, m_refinementOrder(CDT::RefinementOrder::FIFO)
|
|
160
161
|
, m_vertexInsertionOrder(CDT::VertexInsertionOrder::Auto)
|
|
161
162
|
, m_intersectingEdgesStrategy(
|
|
162
163
|
CDT::IntersectingConstraintEdges::TryResolve)
|
|
@@ -281,6 +282,13 @@ public slots:
|
|
|
281
282
|
updateCDT();
|
|
282
283
|
}
|
|
283
284
|
|
|
285
|
+
void setRefinementOrder(int index)
|
|
286
|
+
{
|
|
287
|
+
m_refinementOrder = index == 0 ? CDT::RefinementOrder::FIFO
|
|
288
|
+
: CDT::RefinementOrder::WorstFirst;
|
|
289
|
+
updateCDT();
|
|
290
|
+
}
|
|
291
|
+
|
|
284
292
|
void hidePoints(int isHidePoints)
|
|
285
293
|
{
|
|
286
294
|
m_isHidePoints = (isHidePoints != 0);
|
|
@@ -535,7 +543,8 @@ private:
|
|
|
535
543
|
m_refinementCriterion,
|
|
536
544
|
threshold,
|
|
537
545
|
&toErase,
|
|
538
|
-
m_minRefinementEdgeLength
|
|
546
|
+
m_minRefinementEdgeLength,
|
|
547
|
+
m_refinementOrder);
|
|
539
548
|
// store positions: finalizing invalidates the indices
|
|
540
549
|
storeUnrefined(m_cdt.findEncroachedFixedEdges());
|
|
541
550
|
}
|
|
@@ -877,6 +886,7 @@ private:
|
|
|
877
886
|
CoordType m_minRefinementEdgeLength;
|
|
878
887
|
CDT::RefinementCriterion::Enum m_refinementCriterion;
|
|
879
888
|
CoordType m_refinementThreshold; // degrees if SmallestAngle, else raw area
|
|
889
|
+
CDT::RefinementOrder::Enum m_refinementOrder;
|
|
880
890
|
CDT::VertexInsertionOrder::Enum m_vertexInsertionOrder;
|
|
881
891
|
CDT::IntersectingConstraintEdges::Enum m_intersectingEdgesStrategy;
|
|
882
892
|
CoordType m_minDistToConstraintEdge;
|
|
@@ -983,9 +993,9 @@ public:
|
|
|
983
993
|
new QLabel("intersectingEdgesStrategy"), isecStrategy);
|
|
984
994
|
triangulationConfig->addRow(
|
|
985
995
|
new QLabel("minDistToConstraintEdge"), distTolerance);
|
|
986
|
-
triangulationConfig->addRow(triType);
|
|
987
|
-
triangulationConfig->addRow(finalizeWith);
|
|
988
|
-
triangulationConfig->addRow(fixDupes);
|
|
996
|
+
triangulationConfig->addRow(new QLabel("triangulation"), triType);
|
|
997
|
+
triangulationConfig->addRow(new QLabel("finalize"), finalizeWith);
|
|
998
|
+
triangulationConfig->addRow(new QLabel("duplicates"), fixDupes);
|
|
989
999
|
QGroupBox* triOptGroup = new QGroupBox("Triangulation");
|
|
990
1000
|
triOptGroup->setLayout(triangulationConfig);
|
|
991
1001
|
|
|
@@ -1025,6 +1035,15 @@ public:
|
|
|
1025
1035
|
m_cdtWidget,
|
|
1026
1036
|
SLOT(setRefinementCriterion(int)));
|
|
1027
1037
|
|
|
1038
|
+
QComboBox* refinementOrder = new QComboBox;
|
|
1039
|
+
refinementOrder->addItem("FIFO");
|
|
1040
|
+
refinementOrder->addItem("worst first");
|
|
1041
|
+
connect(
|
|
1042
|
+
refinementOrder,
|
|
1043
|
+
SIGNAL(currentIndexChanged(int)),
|
|
1044
|
+
m_cdtWidget,
|
|
1045
|
+
SLOT(setRefinementOrder(int)));
|
|
1046
|
+
|
|
1028
1047
|
QDoubleSpinBox* refinementThreshold = new QDoubleSpinBox;
|
|
1029
1048
|
refinementThreshold->setDecimals(6);
|
|
1030
1049
|
refinementThreshold->setRange(0.0, 1000000.0);
|
|
@@ -1063,6 +1082,8 @@ public:
|
|
|
1063
1082
|
new QLabel(tr("Refinement points")), refinementSpinbox);
|
|
1064
1083
|
limitsLayout->addRow(
|
|
1065
1084
|
new QLabel(tr("Refinement criterion")), refinementCriterion);
|
|
1085
|
+
limitsLayout->addRow(
|
|
1086
|
+
new QLabel(tr("Refinement order")), refinementOrder);
|
|
1066
1087
|
limitsLayout->addRow(
|
|
1067
1088
|
new QLabel(tr("Refinement threshold")), refinementThreshold);
|
|
1068
1089
|
limitsLayout->addRow(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pythoncdt
|
|
3
|
-
Version: 2.0
|
|
3
|
+
Version: 2.1.0
|
|
4
4
|
Summary: Python bindings for CDT: constrained Delaunay triangulation
|
|
5
5
|
Keywords: cdt,computational-geometry,conforming,constrained,constrained-delaunay-triangulation,delaunay,delaunay-triangulation,fast,refinement,robust,triangle,triangulation
|
|
6
6
|
Author: Artem Amirkhanov
|
|
@@ -214,6 +214,10 @@ PYBIND11_MODULE(_core, m, py::mod_gil_not_used())
|
|
|
214
214
|
.value("SMALLEST_ANGLE", CDT::RefinementCriterion::SmallestAngle)
|
|
215
215
|
.value("LARGEST_AREA", CDT::RefinementCriterion::LargestArea);
|
|
216
216
|
|
|
217
|
+
py::enum_<CDT::RefinementOrder::Enum>(m, "RefinementOrder")
|
|
218
|
+
.value("FIFO", CDT::RefinementOrder::FIFO)
|
|
219
|
+
.value("WORST_FIRST", CDT::RefinementOrder::WorstFirst);
|
|
220
|
+
|
|
217
221
|
py::class_<CDT::Unrefined>(m, "Unrefined")
|
|
218
222
|
.def_readonly(
|
|
219
223
|
"short_edge_triangles", &CDT::Unrefined::shortEdgeTriangles)
|
|
@@ -440,7 +444,8 @@ PYBIND11_MODULE(_core, m, py::mod_gil_not_used())
|
|
|
440
444
|
CDT::RefinementCriterion::Enum refinement_criterion,
|
|
441
445
|
coord_t refinement_threshold,
|
|
442
446
|
py::object to_erase,
|
|
443
|
-
coord_t min_edge_length
|
|
447
|
+
coord_t min_edge_length,
|
|
448
|
+
CDT::RefinementOrder::Enum refinement_order) {
|
|
444
449
|
const bool has_to_erase = !to_erase.is_none();
|
|
445
450
|
if (has_to_erase && !py::isinstance<py::set>(to_erase))
|
|
446
451
|
throw py::type_error("to_erase must be a set or None!");
|
|
@@ -455,7 +460,8 @@ PYBIND11_MODULE(_core, m, py::mod_gil_not_used())
|
|
|
455
460
|
refinement_criterion,
|
|
456
461
|
refinement_threshold,
|
|
457
462
|
has_to_erase ? &triangles_to_erase : NULL,
|
|
458
|
-
min_edge_length
|
|
463
|
+
min_edge_length,
|
|
464
|
+
refinement_order);
|
|
459
465
|
}
|
|
460
466
|
if (has_to_erase)
|
|
461
467
|
{
|
|
@@ -472,6 +478,7 @@ PYBIND11_MODULE(_core, m, py::mod_gil_not_used())
|
|
|
472
478
|
py::arg("refinement_threshold") = CDT::degToRad(coord_t(20)),
|
|
473
479
|
py::arg("to_erase") = py::none(),
|
|
474
480
|
py::arg("min_edge_length") = coord_t(1e-6),
|
|
481
|
+
py::arg("refinement_order") = CDT::RefinementOrder::FIFO,
|
|
475
482
|
"Triangles from `to_erase` are not refined; the triangles that "
|
|
476
483
|
"replace them are added to it in place.")
|
|
477
484
|
.def("find_encroached_fixed_edges", [](Triangulation& t) {
|
|
@@ -36,6 +36,11 @@ class RefinementCriterion(_Enum):
|
|
|
36
36
|
LARGEST_AREA: ClassVar[RefinementCriterion]
|
|
37
37
|
__members__: ClassVar[dict[str, RefinementCriterion]]
|
|
38
38
|
|
|
39
|
+
class RefinementOrder(_Enum):
|
|
40
|
+
FIFO: ClassVar[RefinementOrder]
|
|
41
|
+
WORST_FIRST: ClassVar[RefinementOrder]
|
|
42
|
+
__members__: ClassVar[dict[str, RefinementOrder]]
|
|
43
|
+
|
|
39
44
|
class Unrefined:
|
|
40
45
|
@property
|
|
41
46
|
def short_edge_triangles(self) -> int: ...
|
|
@@ -131,6 +136,7 @@ class Triangulation:
|
|
|
131
136
|
refinement_threshold: float = ...,
|
|
132
137
|
to_erase: set[int] | None = None,
|
|
133
138
|
min_edge_length: float = ...,
|
|
139
|
+
refinement_order: RefinementOrder = ...,
|
|
134
140
|
) -> Unrefined: ...
|
|
135
141
|
def find_unrefined_triangles(
|
|
136
142
|
self,
|
|
@@ -211,7 +211,8 @@ def triangulation_with_sharp_input_corner() -> cdt.Triangulation:
|
|
|
211
211
|
(cdt.RefinementCriterion.LARGEST_AREA, 2.0, lambda t, threshold: max(triangle_areas(t)) <= threshold),
|
|
212
212
|
],
|
|
213
213
|
)
|
|
214
|
-
|
|
214
|
+
@pytest.mark.parametrize("order", [cdt.RefinementOrder.FIFO, cdt.RefinementOrder.WORST_FIRST])
|
|
215
|
+
def test_refine_triangles_fulfills_criterion(criterion, threshold, is_criterion_fulfilled, order) -> None:
|
|
215
216
|
vv, ee = read_input_file(DATA_DIR / "Capital A.txt")
|
|
216
217
|
t = cdt.Triangulation(cdt.VertexInsertionOrder.AS_PROVIDED, cdt.IntersectingConstraintEdges.NOT_ALLOWED, 0.0)
|
|
217
218
|
t.insert_vertices(vv)
|
|
@@ -219,7 +220,7 @@ def test_refine_triangles_fulfills_criterion(criterion, threshold, is_criterion_
|
|
|
219
220
|
|
|
220
221
|
to_erase = t.collect_outer_triangles_and_holes()
|
|
221
222
|
assert to_erase == t.collect_outer_triangles_and_holes(), "Collecting triangles must not change the triangulation"
|
|
222
|
-
unrefined = t.refine_triangles(1000, criterion, threshold, to_erase)
|
|
223
|
+
unrefined = t.refine_triangles(1000, criterion, threshold, to_erase, refinement_order=order)
|
|
223
224
|
gave_up = [
|
|
224
225
|
unrefined.short_edge_triangles,
|
|
225
226
|
unrefined.circumcenter_outside,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/visualizer/data/issue-42-full-boundary-overlap-2.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/visualizer/data/issue-42-multiple-boundary-overlaps.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pythoncdt-2.0.1 → pythoncdt-2.1.0}/CDT/visualizer/data/regression_issue_38_wrong_hull_small.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|