3 #include "testing/testing.h"
16 #include <type_traits>
18 #define DO_CPP_TESTS 1
20 #define DO_RANDOM_TESTS 0
41 std::istringstream ss(spec);
44 std::istringstream hdrss(line);
45 int nverts, nedges, nfaces;
46 hdrss >> nverts >> nedges >> nfaces;
54 while (i < nverts && getline(ss, line)) {
55 std::istringstream iss(line);
60 verts[i] = vec2<T>(p0, p1);
64 while (i < nedges && getline(ss, line)) {
65 std::istringstream ess(line);
68 edges[i] = std::pair<int, int>(e0, e1);
72 while (i < nfaces && getline(ss, line)) {
73 std::istringstream fss(line);
85 if (std::is_same<mpq_class, T>::value) {
102 int n =
static_cast<int>(out_to_orig.size());
103 for (
int i = 0; i < n; ++i) {
104 for (
int orig : out_to_orig[i]) {
105 if (orig == orig_index) {
125 template<>
double math_to_double<mpq_class>(
const mpq_class
v)
134 template<> mpq_class
math_abs(
const mpq_class
v)
150 int nv =
static_cast<int>(out.vert.size());
151 for (
int i = 0; i < nv; ++i) {
165 int ne =
static_cast<int>(out.edge.size());
166 for (
int i = 0; i < ne; ++i) {
167 if ((out.edge[i].first == out_index_1 && out.edge[i].second == out_index_2) ||
168 (out.edge[i].first == out_index_2 && out.edge[i].second == out_index_1)) {
178 return out_edge_index < static_cast<int>(out.edge_orig.size()) &&
179 out.edge_orig[out_edge_index].contains(in_edge_index);
187 int nf =
static_cast<int>(out.face.size());
188 int npolyv =
static_cast<int>(poly.
size());
189 for (
int f = 0; f < nf; ++f) {
190 if (out.face[f].size() != poly.
size()) {
193 for (
int cycle_start = 0; cycle_start < npolyv; ++cycle_start) {
195 for (
int k = 0; ok && k < npolyv; ++k) {
196 if (out.face[f][(cycle_start + k) % npolyv] != poly[k]) {
214 Array<int> tri{out_index_1, out_index_2, out_index_3};
221 return out_face_index < static_cast<int>(out.face_orig.size()) &&
222 out.face_orig[out_face_index].contains(in_face_index);
229 os <<
r.vert.size() <<
" verts, " <<
r.edge.size() <<
" edges, " <<
r.face.size() <<
" faces\n";
231 for (
int i :
r.vert.index_range()) {
232 os <<
"v" << i <<
" = " <<
r.vert[i] <<
"\n";
234 for (
int j :
r.vert_orig[i].index_range()) {
235 os <<
r.vert_orig[i][j] <<
" ";
240 for (
int i :
r.edge.index_range()) {
241 os <<
"e" << i <<
" = (" <<
r.edge[i].first <<
", " <<
r.edge[i].second <<
")\n";
243 for (
int j :
r.edge_orig[i].size()) {
244 os <<
r.edge_orig[i][j] <<
" ";
249 for (
int i :
r.face.index_range()) {
250 os <<
"f" << i <<
" = ";
251 for (
int j :
r.face[i].index_range()) {
252 os <<
r.face[i][j] <<
" ";
256 for (
int j :
r.face_orig[i].index_range()) {
257 os <<
r.face_orig[i][j] <<
" ";
269 const Array<std::pair<int, int>> &edges,
276 constexpr
const char *drawfile =
"./cdt_test_draw.html";
278 constexpr
const char *drawfile =
"/tmp/cdt_test_draw.html";
280 constexpr
int max_draw_width = 1400;
281 constexpr
int max_draw_height = 1000;
282 constexpr
int thin_line = 1;
283 constexpr
int vert_radius = 3;
284 constexpr
bool draw_vert_labels =
true;
285 constexpr
bool draw_edge_labels =
false;
287 if (
verts.size() == 0) {
290 vec2<double> vmin(1e10, 1e10);
291 vec2<double> vmax(-1e10, -1e10);
292 for (
const vec2<T> &
v :
verts) {
293 for (
int i = 0; i < 2; ++i) {
303 double draw_margin = ((vmax.x - vmin.x) + (vmax.y - vmin.y)) * 0.05;
304 double minx = vmin.x - draw_margin;
305 double maxx = vmax.x + draw_margin;
306 double miny = vmin.y - draw_margin;
307 double maxy = vmax.y + draw_margin;
309 double width = maxx - minx;
310 double height = maxy - miny;
312 int view_width = max_draw_width;
313 int view_height =
static_cast<int>(view_width * aspect);
314 if (view_height > max_draw_height) {
315 view_height = max_draw_height;
316 view_width =
static_cast<int>(view_height / aspect);
318 double scale = view_width /
width;
320 #define SX(x) ((math_to_double(x) - minx) * scale)
321 #define SY(y) ((maxy - math_to_double(y)) * scale)
325 f.open(drawfile, std::ios_base::app);
331 std::cout <<
"Could not open file " << drawfile <<
"\n";
335 f <<
"<div>" <<
label <<
"</div>\n<div>\n"
336 <<
"<svg version=\"1.1\" "
337 "xmlns=\"http://www.w3.org/2000/svg\" "
338 "xmlns:xlink=\"http://www.w3.org/1999/xlink\" "
339 "xml:space=\"preserve\"\n"
340 <<
"width=\"" << view_width <<
"\" height=\"" << view_height <<
"\">n";
342 for (
const std::pair<int, int> &
e : edges) {
343 const vec2<T> &uco =
verts[
e.first];
344 const vec2<T> &vco =
verts[
e.second];
345 int strokew = thin_line;
346 f <<
"<line fill=\"none\" stroke=\"black\" stroke-width=\"" << strokew <<
"\" x1=\""
347 <<
SX(uco[0]) <<
"\" y1=\"" <<
SY(uco[1]) <<
"\" x2=\"" <<
SX(vco[0]) <<
"\" y2=\""
348 <<
SY(vco[1]) <<
"\">\n";
349 f <<
" <title>[" <<
e.first <<
"][" <<
e.second <<
"]</title>\n";
351 if (draw_edge_labels) {
352 f <<
"<text x=\"" <<
SX(0.5 * (uco[0] + vco[0])) <<
"\" y=\"" <<
SY(0.5 * (uco[1] + vco[1]))
353 <<
"\" font-size=\"small\">";
354 f <<
"[" <<
e.first <<
"][" <<
e.second <<
"]</text>\n";
359 for (
const vec2<T> &vco :
verts) {
360 f <<
"<circle fill=\"black\" cx=\"" <<
SX(vco[0]) <<
"\" cy=\"" <<
SY(vco[1]) <<
"\" r=\""
361 << vert_radius <<
"\">\n";
362 f <<
" <title>[" << i <<
"]" << vco <<
"</title>\n";
364 if (draw_vert_labels) {
365 f <<
"<text x=\"" <<
SX(vco[0]) + vert_radius <<
"\" y=\"" <<
SY(vco[1]) - vert_radius
366 <<
"\" font-size=\"small\">[" << i <<
"]</text>\n";
383 void expect_coord_near<mpq_class>(
const vec2<mpq_class> &testco,
const vec2<mpq_class> &refco)
392 EXPECT_NEAR(testco[0], refco[0], 1
e-5);
393 EXPECT_NEAR(testco[1], refco[1], 1
e-5);
413 const char *spec = R
"(1 0 0
422 if (out.vert.size() >= 1) {
423 expect_coord_near<T>(out.vert[0], vec2<T>(0, 0));
429 const char *spec = R
"(2 0 0
441 EXPECT_NE(v0_out, -1);
442 EXPECT_NE(v1_out, -1);
443 EXPECT_NE(v0_out, v1_out);
444 if (out.vert.size() >= 1) {
445 expect_coord_near<T>(out.vert[v0_out], vec2<T>(0.0, -0.75));
446 expect_coord_near<T>(out.vert[v1_out], vec2<T>(0.0, 0.75));
451 graph_draw<T>(
"TwoPt", out.vert, out.edge, out.face);
457 const char *spec = R
"(3 0 0
471 EXPECT_TRUE(v0_out != -1 && v1_out != -1 && v2_out != -1);
472 EXPECT_TRUE(v0_out != v1_out && v0_out != v2_out && v1_out != v2_out);
476 EXPECT_TRUE(e0_out != -1 && e1_out != -1 && e2_out != -1);
477 EXPECT_TRUE(e0_out != e1_out && e0_out != e2_out && e1_out != e2_out);
481 graph_draw<T>(
"ThreePt", out.vert, out.edge, out.face);
488 const char *spec = R
"(4 3 0
506 EXPECT_TRUE(v0_out != -1 && v1_out != -1 && v2_out != -1 && v3_out != -1);
510 EXPECT_TRUE(e0_out != -1 && e1_out != -1 && e2_out != -1);
515 graph_draw<T>(
"MixedPts", out.vert, out.edge, out.face);
521 const char *spec = R
"(4 0 0
533 EXPECT_NE(e_diag_out, -1);
535 graph_draw<T>(
"Quad0", out.vert, out.edge, out.face);
541 const char *spec = R
"(4 0 0
553 EXPECT_NE(e_diag_out, -1);
555 graph_draw<T>(
"Quad1", out.vert, out.edge, out.face);
561 const char *spec = R
"(4 0 0
573 EXPECT_NE(e_diag_out, -1);
575 graph_draw<T>(
"Quad2", out.vert, out.edge, out.face);
581 const char *spec = R
"(4 0 0
593 EXPECT_NE(e_diag_out, -1);
595 graph_draw<T>(
"Quad3", out.vert, out.edge, out.face);
601 const char *spec = R
"(4 0 0
613 EXPECT_NE(e_diag_out, -1);
615 graph_draw<T>(
"Quad4", out.vert, out.edge, out.face);
621 const char *spec = R
"(6 1 1
637 graph_draw<T>(
"LineInSquare - full", out.vert, out.edge, out.face);
643 graph_draw<T>(
"LineInSquare - constraints", out2.vert, out2.edge, out2.face);
649 const char *spec = R
"(4 2 0
667 EXPECT_TRUE(v0_out != -1 && v1_out != -1 && v2_out != -1 && v3_out != -1);
668 if (out.vert.size() == 5) {
669 int v_intersect = -1;
670 for (
int i = 0; i < 5; i++) {
671 if (!
ELEM(i, v0_out, v1_out, v2_out, v3_out)) {
676 EXPECT_NE(v_intersect, -1);
677 if (v_intersect != -1) {
678 expect_coord_near<T>(out.vert[v_intersect], vec2<T>(0, 0));
682 graph_draw<T>(
"CrossSegs", out.vert, out.edge, out.face);
689 const char *spec = R
"(7 5 0
710 graph_draw<T>(
"DiamondCross", out.vert, out.edge, out.face);
716 const char *spec = R
"(12 9 0
745 if (out.vert.size() == 8 && out.edge.size() == 15 && out.face.size() == 8) {
747 for (
int i = 0; i < 12; ++i) {
749 EXPECT_NE(v_out[i], -1);
756 for (
int i = 0; i < 8; ++i) {
758 EXPECT_NE(e_out[i], -1);
765 EXPECT_TRUE(e_cross_1 != -1 && e_cross_2 != -1 && e_cross_3 != -1);
771 graph_draw<T>(
"TwoDiamondsCross", out.vert, out.edge, out.face);
778 const char *spec = R
"(27 21 0
835 graph_draw<T>(
"ManyCross", out.vert, out.edge, out.face);
841 const char *spec = R
"(6 0 2
857 if (out.vert.size() == 6 && out.edge.size() == 9 && out.face.size() == 4) {
859 for (
int i = 0; i < 6; i++) {
861 EXPECT_NE(v_out[i], -1);
865 EXPECT_NE(f0_out, -1);
866 EXPECT_NE(f1_out, -1);
870 EXPECT_NE(e0_out, -1);
871 EXPECT_NE(e1_out, -1);
872 EXPECT_NE(e2_out, -1);
880 graph_draw<T>(
"TwoFace", out.vert, out.edge, out.face);
886 const char *spec = R
"(6 0 2
902 if (out.vert.size() == 10 && out.edge.size() == 18 && out.face.size() == 9) {
904 for (
int i = 0; i < 6; i++) {
956 graph_draw<T>(
"TwoFace2", out.vert, out.edge, out.face);
962 const char *spec = R
"(12 0 3
985 if (out.vert.size() == 14 && out.edge.size() == 33 && out.face.size() == 20) {
987 for (
int i = 0; i < 12; i++) {
989 EXPECT_NE(v_out[i], -1);
993 T x = out.vert[v_int1][0] -
T(1);
998 expect_coord_near<T>(out.vert[v_int1], vec2<T>(1, 0.5));
999 expect_coord_near<T>(out.vert[v_int2], vec2<T>(0.5, 1));
1000 EXPECT_EQ(out.vert_orig[v_int1].size(), 0);
1001 EXPECT_EQ(out.vert_orig[v_int2].size(), 0);
1003 EXPECT_NE(f0_out, -1);
1006 EXPECT_NE(f1_out, -1);
1013 EXPECT_NE(f2_out, -1);
1018 graph_draw<T>(
"OverlapFaces - full", out.vert, out.edge, out.face);
1025 graph_draw<T>(
"OverlapFaces - inside", out2.vert, out2.edge, out2.face);
1031 graph_draw<T>(
"OverlapFaces - constraints", out3.vert, out3.edge, out3.face);
1037 graph_draw<T>(
"OverlapFaces - valid bmesh", out4.vert, out4.edge, out4.face);
1043 const char *spec = R
"(8 0 2
1062 graph_draw<T>(
"TwoSquaresOverlap", out.vert, out.edge, out.face);
1068 const char *spec = R
"(6 0 2
1084 if (out.vert.size() == 5 && out.edge.size() == 7 && out.face.size() == 3) {
1087 for (
int i = 0; i < 6; i++) {
1089 EXPECT_NE(v_out[i], -1);
1090 EXPECT_NE(v_out[i], v_int);
1111 EXPECT_NE(f02i, -1);
1115 EXPECT_NE(f24i, -1);
1119 EXPECT_NE(f10i, -1);
1124 graph_draw<T>(
"TwoFaceEdgeOverlap", out.vert, out.edge, out.face);
1130 const char *spec = R
"(6 0 2
1147 graph_draw<T>(
"TriInTri", out.vert, out.edge, out.face);
1153 const char *spec = R
"(8 0 2
1158 0.14644660940672627 0.5
1159 0.5 0.14644660940672627
1160 0.8535533905932737 0.5
1161 0.5 0.8535533905932737
1172 graph_draw<T>(
"DiamondInSquare", out.vert, out.edge, out.face);
1178 const char *spec = R
"(8 8 0
1183 0.14644660940672627 0.5
1184 0.5 0.14644660940672627
1185 0.8535533905932737 0.5
1186 0.5 0.8535533905932737
1203 graph_draw<T>(
"DiamondInSquareWire", out.vert, out.edge, out.face);
1209 const char *spec = R
"(5 3 0
1224 graph_draw<T>(
"RepeatEdge", out.vert, out.edge, out.face);
1230 const char *spec = R
"(3 0 2
1245 graph_draw<T>(
"RepeatTri", out.vert, out.edge, out.face);
1251 empty_test<double>();
1256 onept_test<double>();
1261 twopt_test<double>();
1266 threept_test<double>();
1271 mixedpts_test<double>();
1276 quad0_test<double>();
1281 quad1_test<double>();
1286 quad2_test<double>();
1291 quad3_test<double>();
1296 quad4_test<double>();
1301 lineinsquare_test<double>();
1306 crosssegs_test<double>();
1311 diamondcross_test<double>();
1316 twodiamondscross_test<double>();
1321 manycross_test<double>();
1326 twoface_test<double>();
1331 twoface2_test<double>();
1336 overlapfaces_test<double>();
1339 TEST(delaunay_d, TwoSquaresOverlap)
1341 twosquaresoverlap_test<double>();
1344 TEST(delaunay_d, TwoFaceEdgeOverlap)
1346 twofaceedgeoverlap_test<double>();
1351 triintri_test<double>();
1356 diamondinsquare_test<double>();
1359 TEST(delaunay_d, DiamondInSquareWire)
1361 diamondinsquarewire_test<double>();
1366 repeatedge_test<double>();
1371 repeattri_test<double>();
1375 TEST(delaunay_m, Empty)
1377 empty_test<mpq_class>();
1380 TEST(delaunay_m, OnePt)
1382 onept_test<mpq_class>();
1384 TEST(delaunay_m, TwoPt)
1386 twopt_test<mpq_class>();
1389 TEST(delaunay_m, ThreePt)
1391 threept_test<mpq_class>();
1394 TEST(delaunay_m, MixedPts)
1396 mixedpts_test<mpq_class>();
1399 TEST(delaunay_m, Quad0)
1401 quad0_test<mpq_class>();
1404 TEST(delaunay_m, Quad1)
1406 quad1_test<mpq_class>();
1409 TEST(delaunay_m, Quad2)
1411 quad2_test<mpq_class>();
1414 TEST(delaunay_m, Quad3)
1416 quad3_test<mpq_class>();
1419 TEST(delaunay_m, Quad4)
1421 quad4_test<mpq_class>();
1424 TEST(delaunay_m, LineInSquare)
1426 lineinsquare_test<mpq_class>();
1429 TEST(delaunay_m, CrossSegs)
1431 crosssegs_test<mpq_class>();
1434 TEST(delaunay_m, DiamondCross)
1436 diamondcross_test<mpq_class>();
1439 TEST(delaunay_m, TwoDiamondsCross)
1441 twodiamondscross_test<mpq_class>();
1444 TEST(delaunay_m, ManyCross)
1446 manycross_test<mpq_class>();
1449 TEST(delaunay_m, TwoFace)
1451 twoface_test<mpq_class>();
1454 TEST(delaunay_m, TwoFace2)
1456 twoface2_test<mpq_class>();
1459 TEST(delaunay_m, OverlapFaces)
1461 overlapfaces_test<mpq_class>();
1464 TEST(delaunay_m, TwoSquaresOverlap)
1466 twosquaresoverlap_test<mpq_class>();
1469 TEST(delaunay_m, TwoFaceEdgeOverlap)
1471 twofaceedgeoverlap_test<mpq_class>();
1474 TEST(delaunay_m, TriInTri)
1476 triintri_test<mpq_class>();
1479 TEST(delaunay_m, DiamondInSquare)
1481 diamondinsquare_test<mpq_class>();
1484 TEST(delaunay_m, DiamondInSquareWire)
1486 diamondinsquarewire_test<mpq_class>();
1489 TEST(delaunay_m, RepeatEdge)
1491 repeatedge_test<mpq_class>();
1494 TEST(delaunay_m, RepeatTri)
1496 repeattri_test<mpq_class>();
1506 float vert_coords[][2] = {
1507 {0.0, 0.0}, {1.0, 0.0}, {0.5, 1.0}, {1.1, 1.0}, {1.1, 0.0}, {1.6, 1.0}};
1508 int faces[] = {0, 1, 2, 3, 4, 5};
1509 int faces_len[] = {3, 3};
1510 int faces_start[] = {0, 3};
1517 input.
edges =
nullptr;
1535 RANDOM_TRI_BETWEEN_CIRCLES,
1538 template<
typename T>
1539 void rand_delaunay_test(
int test_kind,
1546 constexpr
bool print_timing =
true;
1548 Array<double> times(max_lg_size + 1);
1551 for (
int lg_size = start_lg_size; lg_size <= max_lg_size; ++lg_size) {
1552 int size = 1 << lg_size;
1553 times[lg_size] = 0.0;
1554 if (
size == 1 && test_kind != RANDOM_PTS) {
1558 for (
int rep = 0; rep < reps_per_size; ++rep) {
1563 std::string test_label;
1564 switch (test_kind) {
1577 test_label =
"Random poly with " +
std::to_string(nedges) +
" edges";
1579 case RANDOM_TILTED_GRID: {
1592 case RANDOM_CIRCLE: {
1600 case RANDOM_TRI_BETWEEN_CIRCLES: {
1608 " triangles between circles (inner radius=" +
std::to_string(param) +
")";
1611 std::cout <<
"unknown delaunay test type\n";
1616 test_label +=
" (inside)";
1619 test_label +=
" (constraints)";
1622 test_label +=
" (valid bmesh)";
1627 in.vert = Array<vec2<T>>(npts);
1629 in.edge = Array<std::pair<int, int>>(nedges);
1632 in.face = Array<Vector<int>>(nfaces);
1636 switch (test_kind) {
1640 for (
int i = 0; i <
size; i++) {
1643 if (test_kind != RANDOM_PTS) {
1645 in.edge[i - 1].first = i - 1;
1646 in.edge[i - 1].second = i;
1650 if (test_kind == RANDOM_POLY) {
1651 in.edge[
size - 1].first =
size - 1;
1652 in.edge[
size - 1].second = 0;
1656 case RANDOM_TILTED_GRID: {
1657 for (
int i = 0; i <
size; ++i) {
1658 for (
int j = 0; j <
size; ++j) {
1659 in.vert[i *
size + j][0] =
T(i * param + j);
1660 in.vert[i *
size + j][1] =
T(i);
1663 for (
int i = 0; i <
size; ++i) {
1665 in.edge[i].first = i *
size;
1666 in.edge[i].second = i *
size +
size - 1;
1668 in.edge[
size + i].first = i;
1673 case RANDOM_CIRCLE: {
1675 double angle_delta = 2.0 *
M_PI /
size;
1676 for (
int i = 0; i <
size; i++) {
1677 in.vert[i][0] =
T(
cos(start_angle + i * angle_delta));
1678 in.vert[i][1] =
T(
sin(start_angle + i * angle_delta));
1679 in.face[0].append(i);
1683 case RANDOM_TRI_BETWEEN_CIRCLES: {
1684 for (
int i = 0; i <
size; i++) {
1692 in.vert[ia][0] =
T(
cos(angle1));
1693 in.vert[ia][1] =
T(
sin(angle1));
1694 in.vert[ib][0] =
T(
cos(angle2));
1695 in.vert[ib][1] =
T(
sin(angle2));
1696 in.vert[ic][0] =
T((param *
cos(angle3)));
1697 in.vert[ic][1] =
T((param *
sin(angle3)));
1699 in.face[i].append(ia);
1700 int orient =
orient2d(in.vert[ia], in.vert[ib], in.vert[ic]);
1702 in.face[i].append(ib);
1703 in.face[i].append(ic);
1706 in.face[i].append(ic);
1707 in.face[i].append(ib);
1716 EXPECT_NE(out.vert.size(), 0);
1719 graph_draw<T>(test_label, out.vert, out.edge, out.face);
1724 std::cout <<
"\nsize,time\n";
1725 for (
int lg_size = 0; lg_size <= max_lg_size; lg_size++) {
1726 int size = 1 << lg_size;
1727 std::cout <<
size <<
"," << times[lg_size] <<
"\n";
1733 TEST(delaunay_d, RandomPts)
1735 rand_delaunay_test<double>(RANDOM_PTS, 0, 7, 1, 0.0,
CDT_FULL);
1738 TEST(delaunay_d, RandomSegs)
1740 rand_delaunay_test<double>(RANDOM_SEGS, 1, 7, 1, 0.0,
CDT_FULL);
1743 TEST(delaunay_d, RandomPoly)
1745 rand_delaunay_test<double>(RANDOM_POLY, 1, 7, 1, 0.0,
CDT_FULL);
1748 TEST(delaunay_d, RandomPolyConstraints)
1750 rand_delaunay_test<double>(RANDOM_POLY, 1, 7, 1, 0.0,
CDT_CONSTRAINTS);
1753 TEST(delaunay_d, RandomPolyValidBmesh)
1760 rand_delaunay_test<double>(RANDOM_TILTED_GRID, 1, 6, 1, 0.0,
CDT_FULL);
1763 TEST(delaunay_d, TiltedGridA)
1765 rand_delaunay_test<double>(RANDOM_TILTED_GRID, 1, 6, 1, 1.0,
CDT_FULL);
1768 TEST(delaunay_d, TiltedGridB)
1770 rand_delaunay_test<double>(RANDOM_TILTED_GRID, 1, 6, 1, 0.01,
CDT_FULL);
1773 TEST(delaunay_d, RandomCircle)
1775 rand_delaunay_test<double>(RANDOM_CIRCLE, 1, 7, 1, 0.0,
CDT_FULL);
1778 TEST(delaunay_d, RandomTrisCircle)
1780 rand_delaunay_test<double>(RANDOM_TRI_BETWEEN_CIRCLES, 1, 6, 1, 0.25,
CDT_FULL);
1783 TEST(delaunay_d, RandomTrisCircleB)
1785 rand_delaunay_test<double>(RANDOM_TRI_BETWEEN_CIRCLES, 1, 6, 1, 1
e-4,
CDT_FULL);
1789 TEST(delaunay_m, RandomPts)
1791 rand_delaunay_test<mpq_class>(RANDOM_PTS, 0, 7, 1, 0.0,
CDT_FULL);
1794 TEST(delaunay_m, RandomSegs)
1796 rand_delaunay_test<mpq_class>(RANDOM_SEGS, 1, 7, 1, 0.0,
CDT_FULL);
1799 TEST(delaunay_m, RandomPoly)
1801 rand_delaunay_test<mpq_class>(RANDOM_POLY, 1, 7, 1, 0.0,
CDT_FULL);
1804 TEST(delaunay_d, RandomPolyInside)
1806 rand_delaunay_test<double>(RANDOM_POLY, 1, 7, 1, 0.0,
CDT_INSIDE);
1809 TEST(delaunay_m, RandomPolyInside)
1811 rand_delaunay_test<mpq_class>(RANDOM_POLY, 1, 7, 1, 0.0,
CDT_INSIDE);
1814 TEST(delaunay_m, RandomPolyConstraints)
1816 rand_delaunay_test<mpq_class>(RANDOM_POLY, 1, 7, 1, 0.0,
CDT_CONSTRAINTS);
1819 TEST(delaunay_m, RandomPolyValidBmesh)
1826 rand_delaunay_test<mpq_class>(RANDOM_TILTED_GRID, 1, 6, 1, 0.0,
CDT_FULL);
1829 TEST(delaunay_m, TiltedGridA)
1831 rand_delaunay_test<mpq_class>(RANDOM_TILTED_GRID, 1, 6, 1, 1.0,
CDT_FULL);
1834 TEST(delaunay_m, TiltedGridB)
1836 rand_delaunay_test<mpq_class>(RANDOM_TILTED_GRID, 1, 6, 1, 0.01,
CDT_FULL);
1839 TEST(delaunay_m, RandomCircle)
1841 rand_delaunay_test<mpq_class>(RANDOM_CIRCLE, 1, 7, 1, 0.0,
CDT_FULL);
1844 TEST(delaunay_m, RandomTrisCircle)
1846 rand_delaunay_test<mpq_class>(RANDOM_TRI_BETWEEN_CIRCLES, 1, 6, 1, 0.25,
CDT_FULL);
1849 TEST(delaunay_m, RandomTrisCircleB)
1851 rand_delaunay_test<double>(RANDOM_TRI_BETWEEN_CIRCLES, 1, 6, 1, 1
e-4,
CDT_FULL);
CDT_result * BLI_delaunay_2d_cdt_calc(const CDT_input *input, const CDT_output_type output_type)
@ CDT_CONSTRAINTS_VALID_BMESH
void BLI_delaunay_2d_cdt_free(CDT_result *result)
EXPECT_EQ(BLI_expr_pylike_eval(expr, nullptr, 0, &result), EXPR_PYLIKE_INVALID)
Math vector functions needed specifically for mesh intersect and boolean.
void BLI_rng_free(struct RNG *rng) ATTR_NONNULL(1)
struct RNG * BLI_rng_new(unsigned int seed)
double BLI_rng_get_double(struct RNG *rng) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble GLdouble r _GL_VOID_RET _GL_VOID GLfloat GLfloat r _GL_VOID_RET _GL_VOID GLint GLint r _GL_VOID_RET _GL_VOID GLshort GLshort r _GL_VOID_RET _GL_VOID GLdouble GLdouble r
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei width
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei height
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
Read Guarded memory(de)allocation.
Group RGB to Bright Vector Camera Vector Combine Material Light Line Style Layer Add Ambient Diffuse Glossy Refraction Transparent Toon Principled Hair Volume Principled Light Particle Volume Image Sky Noise Wave Voronoi Brick Texture Vector Combine Vertex Separate Vector White RGB Map Separate Set Z Dilate Combine Combine Color Channel Split ID Combine Luminance Directional Alpha Distance Hue Movie Ellipse Bokeh View Corner Anti Mix RGB Hue Separate TEX_NODE_PROC TEX_NODE_PROC TEX_NODE_PROC TEX_NODE_PROC TEX_NODE_PROC Boolean Random Edge Subdivision Point Object Attribute Attribute Attribute Color Attribute Attribute Vector Point Attribute Sample Collection Attribute Attribute Combine Attribute Grid
Platform independent time functions.
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
ATTR_WARN_UNUSED_RESULT const BMVert * v
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
INLINE Rall1d< T, V, S > cos(const Rall1d< T, V, S > &arg)
INLINE Rall1d< T, V, S > sin(const Rall1d< T, V, S > &arg)
void expect_coord_near< double >(const vec2< double > &testco, const vec2< double > &refco)
double math_to_double< double >(const double v)
static int get_orig_index(const Array< Vector< int >> &out_to_orig, int orig_index)
int get_output_edge_index(const CDT_result< T > &out, int out_index_1, int out_index_2)
void diamondinsquare_test()
static double math_to_double(const T UNUSED(v))
void expect_coord_near(const vec2< T > &testco, const vec2< T > &refco)
void diamondinsquarewire_test()
bool output_edge_has_input_id(const CDT_result< T > &out, int out_edge_index, int in_edge_index)
int get_output_tri_index(const CDT_result< T > &out, int out_index_1, int out_index_2, int out_index_3)
void graph_draw(const std::string &label, const Array< vec2< T >> &verts, const Array< std::pair< int, int >> &edges, const Array< Vector< int >> &UNUSED(faces))
int get_vertex_by_coord(const CDT_result< T > &out, double x, double y)
void twosquaresoverlap_test()
bool output_face_has_input_id(const CDT_result< T > &out, int out_face_index, int in_face_index)
void twodiamondscross_test()
std::ostream & operator<<(std::ostream &os, const CDT_result< T > &r)
int get_output_face_index(const CDT_result< T > &out, const Array< int > &poly)
static T math_abs(const T v)
void twofaceedgeoverlap_test()
CDT_input< T > fill_input_from_string(const char *spec)
int orient2d(const double2 &a, const double2 &b, const double2 &c)
std::string to_string(const T &n)
double PIL_check_seconds_timer(void)
__forceinline const avxi abs(const avxi &a)
ccl_device_inline float2 fabs(const float2 &a)