51 double a_xyTol)
override;
54 double a_xyTol)
override;
58 std::list<std::vector<size_t>>& a_loops,
59 std::vector<int>& a_loopType,
70 std::cout <<
"o1.m_loops.size(): " << a_output.
m_loops.size() << std::endl;
72 for (
auto loop : a_output.
m_loops)
75 std::cout <<
"loop type: " << a_output.
m_loopTypes[i] <<
" loop number: " << i << std::endl;
78 std::cout << idx <<
", ";
80 std::cout << std::endl << std::endl;
84 std::cout <<
"m_pts[" << idx <<
"]: " <<
"{" << a_output.
m_pts[idx].x <<
", " 85 << a_output.
m_pts[idx].y <<
"}" << std::endl;
121 polyPts.
XyTol() = a_tol;
122 polyPts.
Pts() = a_input;
140 std::list<std::vector<size_t>> loops;
144 std::vector<int> loopType;
145 if (MePolyOffsetter::OUTSIDE_POLY == a_pType || loops.size() < 2)
223 std::list<std::vector<size_t>>& a_loops,
224 std::vector<int>& a_loopType,
225 const std::vector<Pt3d>& a_pts)
229 a_out.
m_loops.reserve(a_loops.size());
230 std::list<std::vector<size_t>>::iterator it(a_loops.begin());
231 for (; it != a_loops.end(); ++it)
233 a_out.
m_loops.push_back(std::vector<size_t>(it->begin(), it->end()));
236 if (!a_loopType.empty())
239 lt.assign(a_loops.size(), a_pType);
280 std::vector<Pt3d> input = {{0, 0, 0}, {1, 1, 0}, {1, 0, 0}};
283 TS_ASSERT_EQUALS(1, out.
m_loops.size());
286 std::vector<size_t> baseLoop = {0, 1, 2};
305 std::vector<Pt3d> input = {{0, 0, 0}, {0, 1, 0}, {1, 1, 0}, {1, 0, 0}};
308 TS_ASSERT_EQUALS(1, out.
m_loops.size());
311 std::vector<size_t> baseLoop = {0, 1, 2, 3};
335 std::vector<Pt3d> input = {{0, 0, 0}, {1, 1, 0}, {0, 2, 0}, {1, 2, 0}, {1, 0, 0}};
338 TS_ASSERT_EQUALS(2, out.
m_loops.size());
341 std::vector<Pt3d> base = input;
343 std::vector<size_t> baseLoop = {1, 2, 3};
345 baseLoop = {0, 1, 4};
347 std::vector<int> baseType = {0, 0};
369 std::vector<Pt3d> input = {{0, 2, 0}, {1, 2, 0}, {1, 0, 0}, {0, 0, 0}, {1, 1, 0}};
372 TS_ASSERT_EQUALS(2, out.
m_loops.size());
375 std::vector<Pt3d> base = input;
377 std::vector<size_t> baseLoop = {4, 2, 3};
379 baseLoop = {0, 1, 4};
381 std::vector<int> baseType = {0, 0};
409 std::vector<Pt3d> input = {{0, 0, 0}, {3, 3, 0}, {0, 6, 0}, {2, 6, 0}, {2, 0, 0}};
412 TS_ASSERT_EQUALS(2, out.
m_loops.size());
415 std::vector<Pt3d> base = input;
416 base.push_back(
Pt3d(2, 2, 0));
417 base.push_back(
Pt3d(2, 4, 0));
419 std::vector<size_t> baseLoop = {6, 2, 3};
421 baseLoop = {0, 5, 4};
423 std::vector<int> baseType = {0, 0};
451 std::vector<Pt3d> input = {{2, 6, 0}, {2, 0, 0}, {0, 0, 0}, {3, 3, 0}, {0, 6, 0}};
454 TS_ASSERT_EQUALS(2, out.
m_loops.size());
457 std::vector<Pt3d> base = input;
458 base.push_back(
Pt3d(2, 2, 0));
459 base.push_back(
Pt3d(2, 4, 0));
461 std::vector<size_t> baseLoop = {5, 1, 2};
463 baseLoop = {0, 6, 4};
465 std::vector<int> baseType = {0, 0};
482 std::vector<Pt3d> input = {{1, 0, 0}, {0, 0, 0}, {0, 0, 0}, {1, 1, 0}};
485 TS_ASSERT_EQUALS(1, out.
m_loops.size());
488 std::vector<Pt3d> base = input;
490 std::vector<size_t> baseLoop = {0, 1, 3};
492 std::vector<int> baseType = {0};
520 std::vector<Pt3d> input = {{4, 6, 0}, {2, 3, 0}, {4, 0, 0}, {0, 0, 0}, {2, 3, 0}, {0, 6, 0}};
523 TS_ASSERT_EQUALS(2, out.
m_loops.size());
526 std::vector<Pt3d> base = input;
528 std::vector<size_t> baseLoop = {1, 2, 3};
530 baseLoop = {0, 1, 5};
532 std::vector<int> baseType = {0, 0};
560 std::vector<Pt3d> input = {{4, 2, 0}, {0, 6, 0}, {4, 6, 0}, {4, 2, 0}, {4, 0, 0}, {0, 0, 0}};
563 TS_ASSERT_EQUALS(2, out.
m_loops.size());
566 std::vector<Pt3d> base = input;
568 std::vector<size_t> baseLoop = {0, 1, 2};
570 baseLoop = {0, 4, 5};
572 std::vector<int> baseType = {0, 0};
600 std::vector<Pt3d> input = {{0, 0, 0}, {0, 6, 0}, {4, 6, 0}, {4, 4, 0},
601 {0, 4, 0}, {0, 2, 0}, {4, 2, 0}, {4, 0, 0}};
604 TS_ASSERT_EQUALS(2, out.
m_loops.size());
607 std::vector<Pt3d> base = input;
609 std::vector<size_t> baseLoop = {4, 1, 2, 3};
611 baseLoop = {0, 5, 6, 7};
613 std::vector<int> baseType = {0, 0};
641 std::vector<Pt3d> input = {{2, 4, 0}, {0, 4, 0}, {0, 2, 0}, {4, 2, 0},
642 {4, 0, 0}, {0, 0, 0}, {0, 6, 0}, {4, 6, 0}};
645 TS_ASSERT_EQUALS(2, out.
m_loops.size());
648 std::vector<Pt3d> base = input;
650 std::vector<size_t> baseLoop = {2, 3, 4, 5};
652 baseLoop = {0, 1, 6, 7};
654 std::vector<int> baseType = {0, 0};
682 std::vector<Pt3d> input = {{4, 4, 0}, {0, 4, 0}, {0, 2, 0}, {4, 2, 0}, {4, 0, 0},
683 {0, 0, 0}, {0, 3, 0}, {0, 6, 0}, {4, 6, 0}};
686 TS_ASSERT_EQUALS(2, out.
m_loops.size());
689 std::vector<Pt3d> base = input;
691 std::vector<size_t> baseLoop = {2, 3, 4, 5};
693 baseLoop = {0, 1, 7, 8};
695 std::vector<int> baseType = {0, 0};
723 std::vector<Pt3d> input = {{4, 4, 0}, {0, 4, 0}, {0, 2, 0}, {4, 2, 0}, {4, 0, 0}, {0, 0, 0},
724 {0, 2, 0}, {0, 3, 0}, {0, 4, 0}, {0, 6, 0}, {4, 6, 0}};
727 TS_ASSERT_EQUALS(2, out.
m_loops.size());
730 std::vector<Pt3d> base = input;
732 std::vector<size_t> baseLoop = {2, 3, 4, 5};
734 baseLoop = {0, 1, 9, 10};
736 std::vector<int> baseType = {0, 0};
764 std::vector<Pt3d> input = {{8, 4, 0}, {4, 4, 0}, {4, 2, 0}, {8, 2, 0}, {8, 0, 0}, {0, 0, 0},
765 {0, 2, 0}, {4, 2, 0}, {4, 4, 0}, {0, 4, 0}, {0, 6, 0}, {8, 6, 0}};
768 TS_ASSERT_EQUALS(2, out.
m_loops.size());
771 std::vector<Pt3d> base = input;
773 std::vector<size_t> baseLoop = {2, 3, 4, 5, 6};
775 baseLoop = {0, 1, 9, 10, 11};
777 std::vector<int> baseType = {0, 0};
805 std::vector<Pt3d> input = {{8, 4, 0}, {4, 4, 0}, {4, 2, 0}, {8, 2, 0}, {8, 0, 0}, {0, 0, 0},
806 {0, 1, 0}, {4, 1, 0}, {4, 5, 0}, {0, 5, 0}, {0, 6, 0}, {8, 6, 0}};
809 TS_ASSERT_EQUALS(2, out.
m_loops.size());
812 std::vector<Pt3d> base = input;
814 std::vector<size_t> baseLoop = {2, 3, 4, 5, 6, 7};
816 baseLoop = {0, 1, 8, 9, 10, 11};
818 std::vector<int> baseType = {0, 0};
846 std::vector<Pt3d> input = {{8, 4, 0}, {4, 4, 0}, {4, 2, 0}, {8, 2, 0}, {8, 0, 0}, {0, 0, 0},
847 {0, 3, 0}, {4, 3, 0}, {4, 5, 0}, {0, 5, 0}, {0, 6, 0}, {8, 6, 0}};
850 TS_ASSERT_EQUALS(2, out.
m_loops.size());
853 std::vector<Pt3d> base = input;
855 std::vector<size_t> baseLoop = {7, 2, 3, 4, 5, 6};
857 baseLoop = {0, 1, 8, 9, 10, 11};
859 std::vector<int> baseType = {0, 0};
887 std::vector<Pt3d> input = {{8, 4, 0}, {4, 4, 0}, {4, 2, 0}, {8, 2, 0},
888 {8, 0, 0}, {0, 0, 0}, {0, 2.5, 0}, {4, 2.5, 0},
889 {4, 3.5, 0}, {0, 3.5, 0}, {0, 6, 0}, {8, 6, 0}};
892 TS_ASSERT_EQUALS(2, out.
m_loops.size());
895 std::vector<Pt3d> base = input;
897 std::vector<size_t> baseLoop = {7, 2, 3, 4, 5, 6};
899 baseLoop = {0, 1, 8, 9, 10, 11};
901 std::vector<int> baseType = {0, 0};
929 std::vector<Pt3d> input = {{0, 0, 0}, {8, 0, 0}, {8, 2, 0}, {6, 4, 0}, {4, 2, 0}, {3, 3, 0},
930 {4, 4, 0}, {6, 2, 0}, {8, 4, 0}, {8, 6, 0}, {0, 6, 0}};
933 TS_ASSERT_EQUALS(2, out.
m_loops.size());
936 std::vector<Pt3d> base = input;
937 base.push_back(
Pt3d(7, 3, 0));
938 base.push_back(
Pt3d(5, 3, 0));
940 std::vector<size_t> baseLoop = {12, 4, 5, 6};
942 baseLoop = {0, 1, 2, 11, 8, 9, 10};
944 std::vector<int> baseType = {2, 1};
972 std::vector<Pt3d> input = {{8, 6, 0}, {0, 6, 0}, {0, 0, 0}, {8, 0, 0}, {8, 2, 0}, {6, 4, 0},
973 {4, 2, 0}, {3, 3, 0}, {4, 4, 0}, {6, 2, 0}, {8, 4, 0}};
976 TS_ASSERT_EQUALS(2, out.
m_loops.size());
979 std::vector<Pt3d> base = input;
980 base.push_back(
Pt3d(7, 3, 0));
981 base.push_back(
Pt3d(5, 3, 0));
983 std::vector<size_t> baseLoop = {12, 6, 7, 8};
985 baseLoop = {0, 1, 2, 3, 4, 11, 10};
987 std::vector<int> baseType = {2, 1};
1015 std::vector<Pt3d> input = {{6, 4, 0}, {4, 2, 0}, {3, 3, 0}, {4, 4, 0}, {6, 2, 0}, {8, 4, 0},
1016 {8, 6, 0}, {0, 6, 0}, {0, 0, 0}, {6, 0, 0}, {8, 2, 0}};
1019 TS_ASSERT_EQUALS(2, out.
m_loops.size());
1022 std::vector<Pt3d> base = input;
1023 base.push_back(
Pt3d(5, 3, 0));
1024 base.push_back(
Pt3d(7, 3, 0));
1026 std::vector<size_t> baseLoop = {11, 1, 2, 3};
1028 baseLoop = {12, 5, 6, 7, 8, 9, 10};
1030 std::vector<int> baseType = {2, 1};
1058 std::vector<Pt3d> input = {{6, 4, 0}, {4, 2, 0}, {3, 3, 0}, {4, 4, 0}, {6, 2, 0}, {8, 4, 0},
1059 {8, 6, 0}, {0, 6, 0}, {0, 0, 0}, {6, 0, 0}, {6, 2, 0}};
1062 TS_ASSERT_EQUALS(2, out.
m_loops.size());
1065 std::vector<Pt3d> basePts = {{6, 4, 0}, {4, 2, 0}, {3, 3, 0}, {4, 4, 0}, {6, 2, 0}, {8, 4, 0},
1066 {8, 6, 0}, {0, 6, 0}, {0, 0, 0}, {6, 0, 0}, {6, 2, 0}, {5, 3, 0}};
1068 std::vector<size_t> baseLoop = {11, 1, 2, 3};
1070 baseLoop = {4, 5, 6, 7, 8, 9};
1072 std::vector<int> basePolyType = {2, 1};
1100 std::vector<Pt3d> input = {{8, 6, 0}, {0, 6, 0}, {0, 0, 0}, {4, 0, 0}, {5, 2, 0},
1101 {3, 4, 0}, {3, 2, 0}, {4, 0, 0}, {8, 0, 0}};
1104 TS_ASSERT_EQUALS(1, out.
m_loops.size());
1107 std::vector<Pt3d> basePts = {{8, 6, 0}, {0, 6, 0}, {0, 0, 0}, {4, 0, 0}, {5, 2, 0},
1108 {3, 4, 0}, {3, 2, 0}, {4, 0, 0}, {8, 0, 0}};
1110 std::vector<size_t> baseLoop = {0, 1, 2, 3, 8};
1112 std::vector<int> basePolyType = {1};
1130 o.
m_pts = {{0, 0, 0}, {3, 0, 0}, {3, 2, 0}, {0, 2, 0},
1131 {4, 0, 0}, {6, 0, 0}, {6, 2, 0}, {4, 2, 0}};
1132 std::vector<size_t> v0 = {0, 1, 2, 3};
1134 std::vector<size_t> v1 = {4, 5, 6, 7};
1136 o.
m_loopTypes.assign(2, MePolyOffsetter::INSIDE_POLY);
1138 std::vector<MePolyOffsetterOutput> vO(1, o);
1140 TS_ASSERT_EQUALS(2, o1.
m_loops.size());
1168 o.
m_pts = {{0, 0, 0}, {8, 0, 0}, {8, 4, 0}, {0, 4, 0},
1169 {2, 1, 0}, {4, 1, 0}, {4, 2, 0}, {2, 2, 0}};
1170 std::vector<size_t> v0 = {0, 1, 2, 3};
1172 std::vector<size_t> v1 = {4, 5, 6, 7};
1174 o.
m_loopTypes.assign(2, MePolyOffsetter::INSIDE_POLY);
1176 std::vector<MePolyOffsetterOutput> vO(1, o);
1178 TS_ASSERT_EQUALS(1, o1.
m_loops.size());
1183 std::vector<int> baseLoopType = {1};
1206 o.
m_pts = {{2, 1, 0}, {4, 1, 0}, {4, 2, 0}, {2, 2, 0},
1207 {0, 0, 0}, {8, 0, 0}, {8, 4, 0}, {0, 4, 0}};
1208 std::vector<size_t> v0 = {0, 1, 2, 3};
1210 std::vector<size_t> v1 = {4, 5, 6, 7};
1212 o.
m_loopTypes.assign(2, MePolyOffsetter::INSIDE_POLY);
1214 std::vector<MePolyOffsetterOutput> vO(1, o);
1216 TS_ASSERT_EQUALS(1, o1.
m_loops.size());
1221 std::vector<int> baseLoopType = {1};
1244 o.
m_pts = {{2, 1, 0}, {4, 1, 0}, {4, 2, 0}, {2, 2, 0}, {0, 0, 0}, {8, 0, 0},
1245 {8, 4, 0}, {0, 4, 0}, {5, 1, 0}, {7, 1, 0}, {7, 2, 0}, {5, 2, 0},
1246 {5, 3, 0}, {7, 3, 0}, {7, 3.5, 0}, {5, 3.5, 0}};
1247 std::vector<size_t> v0 = {0, 1, 2, 3};
1249 std::vector<size_t> v1 = {4, 5, 6, 7};
1251 std::vector<size_t> v2 = {8, 9, 10, 11};
1253 std::vector<size_t> v3 = {12, 13, 14, 15};
1255 o.
m_loopTypes.assign(4, MePolyOffsetter::INSIDE_POLY);
1257 std::vector<MePolyOffsetterOutput> vO(1, o);
1259 TS_ASSERT_EQUALS(1, o1.
m_loops.size());
1264 std::vector<int> baseLoopType = {1};
1287 o.
m_pts = {{0, 0, 0}, {2, 0, 0}, {2, 3, 0}, {8, 3, 0}, {8, 4, 0},
1288 {0, 4, 0}, {4, 1, 0}, {5, 1, 0}, {5, 2, 0}, {4, 2, 0}};
1289 std::vector<size_t> v0 = {0, 1, 2, 3, 4, 5};
1291 std::vector<size_t> v1 = {6, 7, 8, 9};
1293 o.
m_loopTypes.assign(2, MePolyOffsetter::INSIDE_POLY);
1295 std::vector<MePolyOffsetterOutput> vO(1, o);
1297 TS_ASSERT_EQUALS(2, o1.
m_loops.size());
1303 std::vector<int> baseLoopType = {1, 1};
1326 o.
m_pts = {{0, 0, 0}, {2, 0, 0}, {2, 3, 0}, {4, 3, 0}, {4, 4, 0},
1327 {0, 4, 0}, {4, 2, 0}, {5, 2, 0}, {5, 3, 0}, {4, 3, 0}};
1328 std::vector<size_t> v0 = {0, 1, 2, 3, 4, 5};
1330 std::vector<size_t> v1 = {6, 7, 8, 9};
1332 o.
m_loopTypes.assign(2, MePolyOffsetter::INSIDE_POLY);
1334 std::vector<MePolyOffsetterOutput> vO(1, o);
1336 TS_ASSERT_EQUALS(2, o1.
m_loops.size());
1341 std::vector<size_t> baseLoop = {6, 7, 8, 3};
1343 std::vector<int> baseLoopType = {1, 1};
1366 o.
m_pts = {{0, 0, 0}, {2, 0, 0}, {2, 3, 0}, {4, 3, 0}, {4, 4, 0}, {0, 4, 0}};
1367 std::vector<size_t> v0 = {0, 1, 2, 3, 4, 5};
1369 o.
m_loopTypes.assign(1, MePolyOffsetter::INSIDE_POLY);
1370 std::vector<MePolyOffsetterOutput> vO(1, o);
1371 o.
m_pts = {{3.5, 1, 0}, {4.5, 1, 0}, {4, 3, 0}, {2, 3, 0}};
1372 std::vector<size_t> v1 = {0, 1, 2, 3};
1377 TS_ASSERT_EQUALS(1, o1.
m_loops.size());
1380 std::vector<Pt3d> basePts = {{0, 0, 0}, {2, 0, 0}, {2, 3, 0}, {4, 3, 0}, {4, 4, 0},
1381 {0, 4, 0}, {3.5, 1, 0}, {4.5, 1, 0}, {4, 3, 0}, {2, 3, 0}};
1383 std::vector<size_t> baseLoop = {0, 1, 2, 6, 7, 3, 4, 5};
1385 std::vector<int> baseLoopType = {1};
1408 o.
m_pts = {{0, 1, 0}, {5, 1, 0}, {5, 4, 0}, {0, 4, 0}};
1409 std::vector<size_t> v0 = {0, 1, 2, 3};
1411 o.
m_loopTypes.assign(1, MePolyOffsetter::INSIDE_POLY);
1412 std::vector<MePolyOffsetterOutput> vO(1, o);
1413 o.
m_pts = {{3, 0, 0}, {8, 0, 0}, {8, 3, 0}, {3, 3, 0}};
1417 TS_ASSERT_EQUALS(1, o1.
m_loops.size());
1420 std::vector<Pt3d> basePts = {{0, 1, 0}, {5, 1, 0}, {5, 4, 0}, {0, 4, 0}, {3, 0, 0},
1421 {8, 0, 0}, {8, 3, 0}, {3, 3, 0}, {5, 3, 0}, {3, 1, 0}};
1423 std::vector<size_t> baseLoop = {9, 4, 5, 6, 8, 2, 3, 0};
1425 std::vector<int> baseLoopType = {1};
1448 o.
m_pts = {{3, 3, 0}, {3, 0, 0}, {8, 0, 0}, {8, 3, 0}};
1449 std::vector<size_t> v0 = {0, 1, 2, 3};
1451 o.
m_loopTypes.assign(1, MePolyOffsetter::INSIDE_POLY);
1452 std::vector<MePolyOffsetterOutput> vO(1, o);
1453 o.
m_pts = {{0, 4, 0}, {0, 1, 0}, {5, 1, 0}, {5, 4, 0}};
1457 TS_ASSERT_EQUALS(1, o1.
m_loops.size());
1460 std::vector<Pt3d> basePts = {{3, 3, 0}, {3, 0, 0}, {8, 0, 0}, {8, 3, 0}, {0, 4, 0},
1461 {0, 1, 0}, {5, 1, 0}, {5, 4, 0}, {3, 1, 0}, {5, 3, 0}};
1463 std::vector<size_t> baseLoop = {9, 7, 4, 5, 8, 1, 2, 3};
1465 std::vector<int> baseLoopType = {1};
1488 o.
m_pts = {{3, 3, 0}, {3, 1, 0}, {8, 1, 0}, {8, 3, 0}};
1489 std::vector<size_t> v0 = {0, 1, 2, 3};
1491 o.
m_loopTypes.assign(1, MePolyOffsetter::INSIDE_POLY);
1492 std::vector<MePolyOffsetterOutput> vO(1, o);
1493 o.
m_pts = {{0, 4, 0}, {0, 0, 0}, {5, 0, 0}, {5, 4, 0}};
1497 TS_ASSERT_EQUALS(1, o1.
m_loops.size());
1500 std::vector<Pt3d> basePts = {{3, 3, 0}, {3, 1, 0}, {8, 1, 0}, {8, 3, 0}, {0, 4, 0},
1501 {0, 0, 0}, {5, 0, 0}, {5, 4, 0}, {5, 1, 0}, {5, 3, 0}};
1503 std::vector<size_t> baseLoop = {9, 7, 4, 5, 6, 8, 2, 3};
1505 std::vector<int> baseLoopType = {1};
1528 o.
m_pts = {{3, 3, 0}, {3, 0, 0}, {8, 0, 0}, {8, 3, 0}};
1529 std::vector<size_t> v0 = {0, 1, 2, 3};
1531 o.
m_loopTypes.assign(1, MePolyOffsetter::INSIDE_POLY);
1532 std::vector<MePolyOffsetterOutput> vO(1, o);
1533 o.
m_pts = {{0, 4, 0}, {0, 0, 0}, {5, 0, 0}, {5, 4, 0}};
1537 TS_ASSERT_EQUALS(1, o1.
m_loops.size());
1540 std::vector<Pt3d> basePts = {{3, 3, 0}, {3, 0, 0}, {8, 0, 0}, {8, 3, 0}, {0, 4, 0},
1541 {0, 0, 0}, {5, 0, 0}, {5, 4, 0}, {5, 3, 0}};
1543 std::vector<size_t> baseLoop = {8, 7, 4, 5, 1, 6, 2, 3};
1545 std::vector<int> baseLoopType = {1};
1568 o.
m_pts = {{3, 4, 0}, {3, 0, 0}, {8, 0, 0}, {8, 4, 0}};
1569 std::vector<size_t> v0 = {0, 1, 2, 3};
1571 o.
m_loopTypes.assign(1, MePolyOffsetter::INSIDE_POLY);
1572 std::vector<MePolyOffsetterOutput> vO(1, o);
1573 o.
m_pts = {{0, 4, 0}, {0, 0, 0}, {5, 0, 0}, {5, 4, 0}};
1577 TS_ASSERT_EQUALS(1, o1.
m_loops.size());
1580 std::vector<Pt3d> basePts = {{3, 4, 0}, {3, 0, 0}, {8, 0, 0}, {8, 4, 0},
1581 {0, 4, 0}, {0, 0, 0}, {5, 0, 0}, {5, 4, 0}};
1583 std::vector<size_t> baseLoop = {7, 0, 4, 5, 1, 6, 2, 3};
1585 std::vector<int> baseLoopType = {1};
1608 o.
m_pts = {{0, 3, 0}, {0, 1, 0}, {8, 1, 0}, {8, 3, 0}};
1609 std::vector<size_t> v0 = {0, 1, 2, 3};
1611 o.
m_loopTypes.assign(1, MePolyOffsetter::INSIDE_POLY);
1612 std::vector<MePolyOffsetterOutput> vO(1, o);
1613 o.
m_pts = {{0, 4, 0}, {0, 0, 0}, {5, 0, 0}, {5, 4, 0}};
1617 TS_ASSERT_EQUALS(1, o1.
m_loops.size());
1620 std::vector<Pt3d> basePts = {{0, 3, 0}, {0, 1, 0}, {8, 1, 0}, {8, 3, 0}, {0, 4, 0},
1621 {0, 0, 0}, {5, 0, 0}, {5, 4, 0}, {5, 1, 0}, {5, 3, 0}};
1623 std::vector<size_t> baseLoop = {9, 7, 4, 0, 1, 5, 6, 8, 2, 3};
1625 std::vector<int> baseLoopType = {1};
1649 o.
m_pts = {{0, 2, 0}, {0, 0, 0}, {4, 0, 0}, {4, 2, 0}};
1650 std::vector<size_t> v0 = {0, 1, 2, 3};
1652 o.
m_loopTypes.assign(1, MePolyOffsetter::INSIDE_POLY);
1653 std::vector<MePolyOffsetterOutput> vO(1, o);
1654 o.
m_pts = {{4, 0, 0}, {4, 4, 0}, {0, 0, 0}};
1659 TS_ASSERT_EQUALS(1, o1.
m_loops.size());
1662 std::vector<Pt3d> basePts = {{0, 2, 0}, {0, 0, 0}, {4, 0, 0}, {4, 2, 0},
1663 {4, 0, 0}, {4, 4, 0}, {0, 0, 0}, {2, 2, 0}};
1665 std::vector<size_t> baseLoop = {1, 2, 3, 5, 7, 0};
1667 std::vector<int> baseLoopType = {1};
1690 o.
m_pts = {{3, 4, 0}, {3, 1, 0}, {8, 1, 0}, {8, 4, 0}};
1691 std::vector<size_t> v0 = {0, 1, 2, 3};
1693 o.
m_loopTypes.assign(1, MePolyOffsetter::INSIDE_POLY);
1694 std::vector<MePolyOffsetterOutput> vO(1, o);
1695 o.
m_pts = {{2, 3, 0}, {2, 0, 0}, {5, 0, 0}};
1700 TS_ASSERT_EQUALS(1, o1.
m_loops.size());
1703 std::vector<Pt3d> basePts = {{3, 4, 0}, {3, 1, 0}, {8, 1, 0}, {8, 4, 0}, {2, 3, 0},
1704 {2, 0, 0}, {5, 0, 0}, {3, 2, 0}, {4, 1, 0}};
1706 std::vector<size_t> baseLoop = {8, 2, 3, 0, 7, 4, 5, 6};
1708 std::vector<int> baseLoopType = {1};
1738 o.
m_pts = {{3, 5, 0}, {3, 1, 0}, {8, 1, 0}, {8, 5, 0}};
1739 std::vector<size_t> v0 = {0, 1, 2, 3};
1741 o.
m_loopTypes.assign(1, MePolyOffsetter::INSIDE_POLY);
1742 std::vector<MePolyOffsetterOutput> vO(1, o);
1743 o.
m_pts = {{0, 6, 0}, {0, 0, 0}, {5, 0, 0}, {2, 3, 0}, {5, 6, 0}};
1744 o.
m_loops[0] = {0, 1, 2, 3, 4};
1748 TS_ASSERT_EQUALS(2, o1.
m_loops.size());
1751 std::vector<Pt3d> basePts = {{3, 5, 0}, {3, 1, 0}, {8, 1, 0}, {8, 5, 0}, {0, 6, 0},
1752 {0, 0, 0}, {5, 0, 0}, {2, 3, 0}, {5, 6, 0}, {4, 1, 0},
1753 {4, 5, 0}, {3, 4, 0}, {3, 2, 0}};
1755 std::vector<size_t> baseLoop = {12, 7, 11};
1757 baseLoop = {10, 8, 4, 5, 6, 9, 2, 3};
1759 std::vector<int> baseLoopType = {2, 1};
1788 o.
m_pts = {{1, 5, 0}, {1, 1, 0}, {5, 1, 0}, {5, 5, 0}};
1789 std::vector<size_t> v0 = {0, 1, 2, 3};
1791 o.
m_loopTypes.assign(1, MePolyOffsetter::INSIDE_POLY);
1792 std::vector<MePolyOffsetterOutput> vO(1, o);
1793 o.
m_pts = {{0, 3, 0}, {3, 0, 0}, {6, 3, 0}, {3, 6, 0}};
1797 TS_ASSERT_EQUALS(1, o1.
m_loops.size());
1800 std::vector<Pt3d> basePts = {{1, 5, 0}, {1, 1, 0}, {5, 1, 0}, {5, 5, 0}, {0, 3, 0}, {3, 0, 0},
1801 {6, 3, 0}, {3, 6, 0}, {4, 5, 0}, {5, 4, 0}, {5, 2, 0}, {4, 1, 0},
1802 {2, 1, 0}, {1, 2, 0}, {1, 4, 0}, {2, 5, 0}};
1804 std::vector<size_t> baseLoop = {15, 0, 14, 4, 13, 1, 12, 5, 11, 2, 10, 6, 9, 3, 8, 7};
1806 std::vector<int> baseLoopType = {1};
1829 o.
m_pts = {{2, 4, 0}, {2, 0, 0}, {5, 0, 0}, {5, 4, 0}};
1830 std::vector<size_t> v0{0, 1, 2, 3};
1832 o.
m_loopTypes.assign(1, MePolyOffsetter::INSIDE_POLY);
1833 std::vector<MePolyOffsetterOutput> vO(1, o);
1834 o.
m_pts = {{8, 3, 0}, {4, 3, 0}, {4, 1, 0}, {8, 1, 0}};
1836 o.
m_pts = {{3, 1, 0}, {3, 3, 0}, {0, 3, 0}, {0, 1, 0}};
1840 TS_ASSERT_EQUALS(1, o1.
m_loops.size());
1843 std::vector<Pt3d> basePts = {{2, 4, 0}, {2, 0, 0}, {5, 0, 0}, {5, 4, 0}, {8, 3, 0}, {4, 3, 0},
1844 {4, 1, 0}, {8, 1, 0}, {3, 1, 0}, {3, 3, 0}, {0, 3, 0}, {0, 1, 0},
1845 {2, 3, 0}, {5, 3, 0}, {5, 1, 0}, {2, 1, 0}};
1847 std::vector<size_t> baseLoop = {15, 1, 2, 14, 7, 4, 13, 3, 0, 12, 10, 11};
1849 std::vector<int> baseLoopType = {1};
1880 o.
m_pts = {{6, 2, 0}, {6, 4, 0}, {0, 4, 0}, {0, 2, 0}};
1881 std::vector<size_t> v0 = {0, 1, 2, 3};
1883 o.
m_loopTypes.assign(1, MePolyOffsetter::INSIDE_POLY);
1884 std::vector<MePolyOffsetterOutput> vO(1, o);
1885 o.
m_pts = {{7, 5, 0}, {3, 5, 0}, {3, 0, 0}, {7, 0, 0}};
1887 o.
m_pts = {{1, 1, 0}, {3, 1, 0}, {1, 3, 0}};
1890 o.
m_pts = {{5, 3, 0}, {2, 0, 0}, {5, 0, 0}};
1895 #if BOOST_VERSION > 106100 1896 TS_ASSERT_EQUALS(2, o1.
m_loops.size());
1903 std::vector<Pt3d> basePts = {{6, 2, 0}, {6, 4, 0}, {0, 4, 0}, {0, 2, 0}, {7, 5, 0}, {3, 5, 0},
1904 {3, 0, 0}, {7, 0, 0}, {1, 1, 0}, {3, 1, 0}, {1, 3, 0}, {5, 3, 0},
1905 {2, 0, 0}, {5, 0, 0}, {3, 4, 0}, {1, 2, 0}, {3, 2, 0}, {2, 2, 0}};
1907 std::vector<size_t> loop0 = {17, 16, 9};
1909 std::vector<size_t> loop1 = {15, 8, 9, 12, 6, 13, 7, 4, 5, 14, 2, 3};
1911 std::vector<int> baseLoopTypes = {2, 1};
1914 TS_ASSERT_EQUALS(1, o1.
m_loops.size());
1917 std::vector<Pt3d> basePts = {{6, 2, 0}, {6, 4, 0}, {0, 4, 0}, {0, 2, 0}, {7, 5, 0}, {3, 5, 0},
1918 {3, 0, 0}, {7, 0, 0}, {1, 1, 0}, {3, 1, 0}, {1, 3, 0}, {5, 3, 0},
1919 {2, 0, 0}, {5, 0, 0}, {3, 4, 0}, {3, 2, 0}, {2, 2, 0}, {1, 2, 0}};
1921 std::vector<size_t> baseLoop = {17, 8, 9, 16, 15, 9, 12, 6, 13, 7, 4, 5, 14, 2, 3};
1923 std::vector<int> baseLoopType = {1};
1954 o.
m_pts = {{7, 7, 0}, {0, 7, 0}, {0, 2, 0}, {3, 2, 0}, {3, 0, 0}, {7, 0, 0}};
1955 std::vector<size_t> v0 = {0, 1, 2, 3, 4, 5};
1957 o.
m_loopTypes.assign(1, MePolyOffsetter::INSIDE_POLY);
1958 std::vector<MePolyOffsetterOutput> vO(1, o);
1959 o.
m_pts = {{1, 1, 0}, {3, 1, 0}, {1, 3, 0}};
1965 #if BOOST_VERSION > 106100 1966 TS_ASSERT_EQUALS(2, o1.
m_loops.size());
1972 std::vector<Pt3d> basePts = {{7, 7, 0}, {0, 7, 0}, {0, 2, 0}, {3, 2, 0}, {3, 0, 0}, {7, 0, 0},
1973 {1, 1, 0}, {3, 1, 0}, {1, 3, 0}, {1, 2, 0}, {2, 2, 0}};
1975 std::vector<size_t> loop0 = {10, 3, 7};
1977 std::vector<size_t> loop1 = {7, 4, 5, 0, 1, 2, 9, 6};
1979 std::vector<int> baseLoopType = {2, 1};
1982 TS_ASSERT_EQUALS(1, o1.
m_loops.size());
1985 std::vector<Pt3d> basePts = {{7, 7, 0}, {0, 7, 0}, {0, 2, 0}, {3, 2, 0}, {3, 0, 0}, {7, 0, 0},
1986 {1, 1, 0}, {3, 1, 0}, {1, 3, 0}, {2, 2, 0}, {1, 2, 0}};
1988 std::vector<size_t> baseLoop = {10, 6, 7, 9, 3, 4, 5, 0, 1, 2};
1990 std::vector<int> baseLoopType = {1};
2017 o.
m_pts = {{1, 1, 0}, {1, 3, 0}, {4, 3, 0}, {4, 1, 0}, {0, 0, 0},
2018 {8, 0, 0}, {8, 4, 0}, {0, 4, 0}, {5, 1, 0}, {7, 1, 0},
2019 {7, 2, 0}, {5, 2, 0}, {5, 3, 0}, {7, 3, 0}, {7, 3.5, 0},
2020 {5, 3.5, 0}, {1.5, 1.5, 0}, {3.5, 1.5, 0}, {3.5, 2.5, 0}, {1.5, 2.5, 0}};
2021 std::vector<size_t> v0{0, 1, 2, 3};
2023 std::vector<size_t> v1{4, 5, 6, 7};
2025 std::vector<size_t> v2{8, 9, 10, 11};
2027 std::vector<size_t> v3{12, 13, 14, 15};
2029 std::vector<size_t> v4{16, 17, 18, 19};
2031 o.
m_loopTypes.assign(5, MePolyOffsetter::INSIDE_POLY);
2034 std::vector<MePolyOffsetterOutput> vO(1, o);
2036 TS_ASSERT_EQUALS(3, o1.
m_loops.size());
2043 std::vector<int> baseLoopType = {2, 1, 1};
2067 o.
m_pts = {{0, 0, 0}, {0, 2, 0}, {4, 2, 0}, {4, 0, 0},
2068 {0, 3, 0}, {0, 4, 0}, {4, 4, 0}, {4, 3, 0}};
2069 std::vector<size_t> v0 = {0, 1, 2, 3};
2071 std::vector<size_t> v1 = {4, 5, 6, 7};
2073 o.
m_loopTypes = {MePolyOffsetter::OUTSIDE_POLY, MePolyOffsetter::INSIDE_POLY};
2076 TS_ASSERT_EQUALS(2, o1.
m_loops.size());
2082 std::vector<int> baseLoops = {MePolyOffsetter::INSIDE_POLY, MePolyOffsetter::OUTSIDE_POLY};
2106 o.
m_pts = {{0, 0, 0}, {0, 4, 0}, {8, 4, 0}, {8, 3, 0}, {2, 3, 0},
2107 {2, 0, 0}, {4, 2, 0}, {4, 0, 0}, {6, 0, 0}, {6, 2, 0}};
2108 std::vector<size_t> v0{0, 1, 2, 3, 4, 5};
2110 std::vector<size_t> v1{6, 7, 8, 9};
2112 o.
m_loopTypes = {MePolyOffsetter::OUTSIDE_POLY, MePolyOffsetter::INSIDE_POLY};
2115 TS_ASSERT_EQUALS(2, o1.
m_loops.size());
2121 std::vector<int> baseLoops = {MePolyOffsetter::INSIDE_POLY, MePolyOffsetter::OUTSIDE_POLY};
2145 o.
m_pts = {{0, 0, 0}, {0, 4, 0}, {8, 4, 0}, {8, 0, 0},
2146 {2, 1, 0}, {4, 1, 0}, {4, 2, 0}, {2, 2, 0}};
2147 std::vector<size_t> v0{0, 1, 2, 3};
2149 std::vector<size_t> v1{4, 5, 6, 7};
2151 o.
m_loopTypes = {MePolyOffsetter::OUTSIDE_POLY, MePolyOffsetter::INSIDE_POLY};
2154 TS_ASSERT_EQUALS(2, o1.
m_loops.size());
2160 std::vector<int> baseLoops = {MePolyOffsetter::INSIDE_POLY, MePolyOffsetter::OUTSIDE_POLY};
2183 o.
m_pts = {{2, 4, 0}, {5, 4, 0}, {5, 0, 0}, {2, 0, 0}, {8, 3, 0}, {4, 3, 0},
2184 {4, 1, 0}, {8, 1, 0}, {3, 1, 0}, {3, 3, 0}, {0, 3, 0}, {0, 1, 0}};
2185 std::vector<size_t> v0 = {0, 1, 2, 3};
2187 std::vector<size_t> v1 = {4, 5, 6, 7};
2189 std::vector<size_t> v2 = {8, 9, 10, 11};
2192 o.
m_loopTypes.assign(3, MePolyOffsetter::INSIDE_POLY);
2196 TS_ASSERT_EQUALS(1, o1.
m_loops.size());
2199 std::vector<Pt3d> basePts = {{2, 4, 0}, {5, 4, 0}, {5, 0, 0}, {2, 0, 0}, {8, 3, 0}, {4, 3, 0},
2200 {4, 1, 0}, {8, 1, 0}, {3, 1, 0}, {3, 3, 0}, {0, 3, 0}, {0, 1, 0},
2201 {2, 3, 0}, {5, 3, 0}, {5, 1, 0}, {2, 1, 0}};
2203 std::vector<size_t> baseLoop{12, 0, 1, 13, 5, 6, 14, 2, 3, 15, 8, 9};
2205 std::vector<int> baseLoopType = {MePolyOffsetter::OUTSIDE_POLY};
2228 o.
m_pts = {{2, 4, 0}, {2, 0, 0}, {5, 0, 0}, {5, 4, 0}, {8, 3, 0}, {8, 1, 0},
2229 {4, 1, 0}, {4, 3, 0}, {3, 1, 0}, {0, 1, 0}, {0, 3, 0}, {3, 3, 0}};
2230 std::vector<size_t> v0 = {0, 1, 2, 3};
2232 std::vector<size_t> v1 = {4, 5, 6, 7};
2234 std::vector<size_t> v2 = {8, 9, 10, 11};
2237 o.
m_loopTypes.assign(3, MePolyOffsetter::OUTSIDE_POLY);
2241 TS_ASSERT_EQUALS(2, o1.
m_loops.size());
2244 std::vector<Pt3d> basePts = {{2, 4, 0}, {2, 0, 0}, {5, 0, 0}, {5, 4, 0}, {8, 3, 0}, {8, 1, 0},
2245 {4, 1, 0}, {4, 3, 0}, {3, 1, 0}, {0, 1, 0}, {0, 3, 0}, {3, 3, 0},
2246 {5, 1, 0}, {5, 3, 0}, {2, 1, 0}, {2, 3, 0}};
2248 std::vector<size_t> baseLoop{12, 13, 4, 5};
2250 baseLoop = {14, 9, 10, 15};
2252 std::vector<int> baseLoopType(2, MePolyOffsetter::OUTSIDE_POLY);
2275 o.
m_pts = {{2, 4, 0}, {2, 0, 0}, {5, 0, 0}, {5, 4, 0},
2276 {8, 3, 0}, {8, 1, 0}, {0, 1, 0}, {0, 3, 0}};
2277 std::vector<size_t> v0 = {0, 1, 2, 3};
2279 std::vector<size_t> v1 = {4, 5, 6, 7};
2282 o.
m_loopTypes.assign(2, MePolyOffsetter::OUTSIDE_POLY);
2286 TS_ASSERT_EQUALS(2, o1.
m_loops.size());
2289 std::vector<Pt3d> basePts = {{2, 4, 0}, {2, 0, 0}, {5, 0, 0}, {5, 4, 0}, {8, 3, 0}, {8, 1, 0},
2290 {0, 1, 0}, {0, 3, 0}, {2, 1, 0}, {2, 3, 0}, {5, 1, 0}, {5, 3, 0}};
2292 std::vector<size_t> baseLoop{8, 6, 7, 9};
2294 baseLoop = {10, 11, 4, 5};
2296 std::vector<int> baseLoopType(2, MePolyOffsetter::OUTSIDE_POLY);
virtual void CleanPolyOffset(const VecPt3d &a_input, int a_pType, double a_tol, MePolyOffsetterOutput &a_out) override
Takes an input polyline (forming a closed loop) and intersects it with itself and fills the output wi...
void testCase5a()
tests the figure below
void ClassifyLoopsFromInPolyAndRemoveInvalid(std::list< std::vector< size_t >> &a_loops, std::vector< int > &a_loopType)
Classifies loops extracted from a pave on an INSIDE_POLY and removes invalid loops. There are more rules when dealing with paving outward from polygons. Sometimes paving outward will create a new "outside" polygon that we then pave inward on the next step in the algorithm. See testCase8. You can also generate "inside" polygons that are inside of other "inside" polygons. These are deleted. Again see testCase8.
void FillOutput(MePolyOffsetterOutput &a_out)
calls implementation
void testCase1()
simple square SANITY CHECK
void SetupInOut(const MePolyOffsetterOutput &a_offsets, double a_xyTol)
calls implementation
void InInTrivialPolyCases()
calls implementation
void testCase7c()
tests the figure below
void InOutDoIntersection()
calls implementation
void testCleanIn7()
tests the figure below
void testCleanIn4a()
tests the figure below
void testCleanIn2b()
tests the figure below
void CalcLoopsForCleanPolyOffset(std::list< size_t > &a_sequence, std::list< std::vector< size_t >> &a_loops)
Calculates new loops from a sequence that has intersections included.
void testCleanInOut1a()
tests the figure below
VecPt3d m_origOutsidePoly
the original outside polygon for this step of the paving process
void testCase6b()
tests the figure below
void testCleanInOut1b()
tests the figure below
void testCase5()
tests the figure below
std::list< size_t > SequenceWithIntersects(std::vector< size_t > &a_segs)
Returns a new sequence that includes intersection indexes.
void testCleanIn4b()
tests the figure below
void testCleanIn1b()
tests the figure below
void SetupInIn(const std::vector< MePolyOffsetterOutput > &a_offsets, double a_xyTol)
calls implementation
void testCase2a()
tests the figure below
void testCleanIn4d()
tests the figure below
virtual void SetOriginalOutsidePolygon(const VecPt3d &a_origOutsidePoly) override
Sets the original outside polygon for this pave operation.
convenience class for holding output data from the MePolyOffsetter
void testCase8a()
tests the figure below
void testCase8c()
tests the figure below
Intersect polygons that are a result of the paving process.
std::vector< Pt3d > m_pts
locations used by polygons
void testCase6a()
tests the figure below
void FillOutputForCleanPolyOffset(MePolyOffsetterOutput &a_out, int a_pType, std::list< std::vector< size_t >> &a_loops, std::vector< int > &a_loopType, const VecPt3d &a_pts)
Fills the output variable for CleanPolyOffset method.
void testCase8()
tests the figure below
void testCase8b()
tests the figure below
void IntersectSegs(const std::vector< size_t > &a_segs)
Intersects the segments.
void testCase7()
tests the figure below
void testCleanIn9()
tests the figure below
virtual void IntersectCleanInOutPolys(const MePolyOffsetterOutput &a_offsets, MePolyOffsetterOutput &a_out, double a_xyTol) override
Takes a PolyOffsetOutput and intersects and cleans all INSIDE_POLY polygons with OUTSIDE_POLY polygon...
void testCleanIn4c()
tests the figure below
void testCleanIn6()
tests the figure below
void testCase2()
tests the figure below
void DeleteBad_NEWOUT_POLY(MePolyOffsetterOutput &a_out, const VecPt3d &a_origOutsidePoly)
calls implementation
void testCleanIn2a()
tests the figure below
Intersects and cleans polygons generated from MePolyOffsetter.
void testCleanIn11()
tests the figure below
void testCleanIn4()
tests the figure below
void testCleanIn1a()
tests the figure below
void testCleanIn0()
tests the figure below
void testCase6c()
tests the figure below
void CalcEnvelopes()
Calculates the envelope of all of the polygons.
static BSHP< MePolyCleaner > New()
Creates a new instance of this class.
void testCleanInOut1()
tests the figure below
void testCase0()
simple triangle SANITY CHECK
void testCase4()
triangle with duplicate point
void testCleanIn3a()
tests the figure below
void testCase3a()
tests the figure below
void testCase9()
tests the figure below
cleans the output produced by MePolyOffsetter
void testCase3()
tests the figure below
void testCleanInOut0a()
tests the figure below
std::vector< int > m_loopTypes
type of loop
void testCleanInOut0b()
tests the figure below
virtual void IntersectCleanInPolys(const std::vector< MePolyOffsetterOutput > &a_offsets, MePolyOffsetterOutput &a_out, double a_xyTol) override
Takes a vector of PolyOffsetOutput and intersects and cleans all INSIDE_POLY polygons ...
void testCleanIn8()
tests the figure below
void testCleanIn5()
tests the figure below
void testCase7a()
tests the figure below
std::vector< std::vector< size_t > > m_loops
indexes of points that define loops
void testCleanIn3()
tests the figure below
std::vector< Pt3d > & Pts()
Returns the vector of points.
std::vector< size_t > SegmentsForCleanPolyOffset()
Returns the segments that will be used in CleanPolyOffset.
void InInDoIntersection()
calls implementation
void testCreateClass()
tests creating the class
void testCleanIn10()
tests the figure below
void testCleanIn1()
tests the figure below
void RemoveBackwardLoopsForCleanPolyOffset(std::list< std::vector< size_t >> &a_loops, int a_pType)
Removes loops that are "backwards" for CleanPolyOffset. "backwards" depends on the type of input (OUT...
void testCleanInOut0()
tests the figure below
double & XyTol()
Returns the tolerance.
void testCase6()
tests the figure below
void testCase7b()
tests the figure below
Utility class to work with polygon paving.
void testCleanIn2()
tests the figure below
std::vector< Pt3d > VecPt3d