Skip to content

Commit 2cef8d4

Browse files
committed
#139 Add a regression test
1 parent 556dbf1 commit 2cef8d4

File tree

4 files changed

+91
-0
lines changed

4 files changed

+91
-0
lines changed

CDT/tests/cdt.test.cpp

+29
Original file line numberDiff line numberDiff line change
@@ -782,3 +782,32 @@ TEST_CASE("Don't flip constraint edge when resolving intersection", "")
782782
REQUIRE(topologyString(cdt) == topologyString(outFile));
783783
}
784784
}
785+
786+
TEST_CASE(
787+
"Regression: resolving edges intersection with a hanging edge in a "
788+
"pseudo-polygon",
789+
"")
790+
{
791+
const auto inputFile = std::string("HangingIntersection.txt");
792+
const auto order = VertexInsertionOrder::Auto;
793+
const auto intersectingEdgesStrategy = IntersectingConstraintEdges::Resolve;
794+
const auto minDistToConstraintEdge = 1e-6;
795+
const auto outFile = "expected/" +
796+
inputFile.substr(0, inputFile.size() - 4) + "__f64_" +
797+
to_string(order) + "_" +
798+
to_string(intersectingEdgesStrategy) + "_all.txt";
799+
800+
const auto [vv, ee] = readInputFromFile<double>("inputs/" + inputFile);
801+
auto cdt = Triangulation<double>(
802+
order, intersectingEdgesStrategy, minDistToConstraintEdge);
803+
cdt.insertVertices(vv);
804+
cdt.insertEdges(ee);
805+
REQUIRE(CDT::verifyTopology(cdt));
806+
807+
if(updateFiles)
808+
topologyToFile(outFile, cdt);
809+
else
810+
{
811+
REQUIRE(topologyString(cdt) == topologyString(outFile));
812+
}
813+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
17
2+
0 1 6 4294967295 5 3
3+
0 3 2 2 7 4294967295
4+
0 4 3 3 9 1
5+
0 6 4 0 12 2
6+
1 2 8 4294967295 8 6
7+
1 7 6 6 14 0
8+
1 8 7 4 15 5
9+
2 3 9 1 10 8
10+
2 9 8 7 16 4
11+
3 4 10 2 12 11
12+
3 5 9 11 13 7
13+
3 10 5 9 13 10
14+
4 6 10 3 14 9
15+
5 10 9 11 16 10
16+
6 7 10 5 15 12
17+
7 8 10 6 16 14
18+
8 9 10 8 13 15
19+
20+
4
21+
3 10
22+
6 10
23+
7 10
24+
8 10
25+
26+
2
27+
6 10 0
28+
8 10 0
29+
30+
4
31+
3 10
32+
1
33+
3 7
34+
6 10
35+
1
36+
6 8
37+
7 10
38+
1
39+
3 7
40+
8 10
41+
1
42+
6 8
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
7 2
2+
725.0 415.0
3+
855.0 390.0
4+
945.0 455.0
5+
1100.0 373.0
6+
1215.0 410.0
7+
1250.0 510.0
8+
943.0 540.0
9+
3 5
10+
0 4
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
7 2
2+
725.0 415.0
3+
855.0 390.0
4+
945.0 455.0
5+
1100.0 373.0
6+
1215.0 410.0
7+
1250.0 510.0
8+
943.0 540.0
9+
3 5
10+
0 4

0 commit comments

Comments
 (0)