Skip to content

Commit 922cb9b

Browse files
author
Adam Hosticka
committed
complex test case to find outer planar graph face
1 parent 101dea5 commit 922cb9b

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

test/test_planar_faces.cpp

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,60 @@ void test_cycle_with_chain() {
9393
assert(equal_cycles(faces[1], {2, 5, 4, 5, 2, 1, 0, 3}));
9494
}
9595

96+
void test_complex_outer() {
97+
std::vector<Point> p = {
98+
Point(334, 181),
99+
Point(403, 177),
100+
Point(463, 181),
101+
Point(524, 181),
102+
Point(521, 568),
103+
Point(460, 564),
104+
Point(405, 572),
105+
Point(335, 563),
106+
Point(333, 386),
107+
Point(400, 387),
108+
Point(466, 389),
109+
Point(523, 396),
110+
Point(521, 353),
111+
Point(466, 351),
112+
Point(409, 354),
113+
Point(333, 350),
114+
};
115+
116+
std::vector<std::vector<size_t>> adj = {
117+
{1, 15},
118+
{0, 2, 14},
119+
{1, 3, 13},
120+
{2, 12},
121+
{5, 11},
122+
{6, 4, 10},
123+
{7, 5, 9},
124+
{8, 6},
125+
{9, 7, 15},
126+
{10, 8, 6},
127+
{11, 9, 5},
128+
{12, 10, 4},
129+
{3, 13, 11},
130+
{12, 14, 2},
131+
{13, 15, 1},
132+
{14, 0, 8},
133+
};
134+
135+
auto faces = find_faces(p, adj);
136+
assert(faces.size() == 8u);
137+
assert(equal_cycles(faces[0], {15, 8, 7, 6, 5, 4, 11, 12, 3, 2, 1, 0}));
138+
assert(equal_cycles(faces[1], {1, 14, 15, 0}));
139+
assert(equal_cycles(faces[2], {2, 13, 14, 1}));
140+
assert(equal_cycles(faces[3], {3, 12, 13, 2}));
141+
assert(equal_cycles(faces[4], {5, 10, 11, 4}));
142+
assert(equal_cycles(faces[5], {6, 9, 10, 5}));
143+
assert(equal_cycles(faces[6], {7, 8, 9, 6}));
144+
assert(equal_cycles(faces[7], {15, 14, 13, 12, 11, 10, 9, 8}));
145+
}
146+
96147
int main() {
97148
test_simple();
98149
test_degenerate();
99150
test_cycle_with_chain();
151+
test_complex_outer();
100152
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy