test_voronoi.cpp 97 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284
  1. #include <catch2/catch.hpp>
  2. #include <libslic3r/Polygon.hpp>
  3. #include <libslic3r/Polyline.hpp>
  4. #include <libslic3r/EdgeGrid.hpp>
  5. #include <libslic3r/Geometry/VoronoiOffset.hpp>
  6. #include <numeric>
  7. //#define VORONOI_DEBUG_OUT
  8. #ifdef VORONOI_DEBUG_OUT
  9. #include <libslic3r/Geometry/VoronoiVisualUtils.hpp>
  10. #include <libslic3r/Utils.hpp>
  11. #endif
  12. using boost::polygon::voronoi_builder;
  13. using boost::polygon::voronoi_diagram;
  14. using namespace Slic3r;
  15. using VD = Geometry::VoronoiDiagram;
  16. // https://svn.boost.org/trac10/ticket/12067
  17. // This bug seems to be confirmed.
  18. // Vojtech supposes that there may be no Voronoi edges produced for
  19. // the 1st and last sweep line positions.
  20. TEST_CASE("Voronoi missing edges - points 12067", "[Voronoi]")
  21. {
  22. Points pts {
  23. { -10, -20 },
  24. { 10, -20 },
  25. { 5, 0 },
  26. { 10, 20 },
  27. { -10, 20 },
  28. { -5, 0 }
  29. };
  30. #if 0
  31. for (Point &p : pts) {
  32. Vec2d q = p.cast<double>();
  33. p.x() = scale_(p.x());
  34. p.y() = scale_(p.y());
  35. }
  36. #endif
  37. #if 0
  38. // Try to rotate, maybe the issue is caused by incorrect handling of vertical or horizontal edges?
  39. double a = 0.18764587962597876897475f;
  40. double c = cos(a);
  41. double s = sin(a);
  42. for (Point &p : poly.points) {
  43. Vec2d q = p.cast<double>();
  44. p.x() = coord_t(q.x() * c + q.y() * s + 0.5);
  45. p.y() = coord_t(- q.x() * s + q.y() * c + 0.5);
  46. }
  47. #endif
  48. // Construction of the Voronoi Diagram.
  49. VD vd;
  50. vd.construct_voronoi(pts.begin(), pts.end());
  51. #ifdef VORONOI_DEBUG_OUT
  52. dump_voronoi_to_svg(debug_out_path("voronoi-pts.svg").c_str(),
  53. vd, pts, Lines());
  54. #endif
  55. // REQUIRE(closest_point.z() == Approx(1.));
  56. }
  57. // https://svn.boost.org/trac10/ticket/12707
  58. // This issue is confirmed, there are no self intersections in the polygon.
  59. // A minimal test case is created at the end of this test,
  60. // a new issue opened with the minimal test case:
  61. // https://github.com/boostorg/polygon/issues/43
  62. TEST_CASE("Voronoi missing edges - Alessandro gapfill 12707", "[Voronoi]")
  63. {
  64. Lines lines0 {
  65. { { 42127548, 699996}, { 42127548, 10135750 } },
  66. { { 42127548, 10135750}, { 50487352, 10135750 } },
  67. { { 50487352, 10135750}, { 50487352, 699995 } },
  68. { { 50487352, 699995}, { 51187348, 0 } },
  69. { { 51187348, 0}, { 64325952, 0 } },
  70. { { 64325952, 0}, { 64325952, 699996 } },
  71. { { 64325952, 699996}, { 51187348, 699996 } },
  72. { { 51187348, 699996}, { 51187348, 10835701 } },
  73. { { 51187348, 10835701}, { 41427552, 10835701 } },
  74. { { 41427552, 10835701}, { 41427552, 699996 } },
  75. { { 41427552, 699996}, { 28664848, 699996 } },
  76. { { 28664848, 699996}, { 28664848, 10835701 } },
  77. { { 28664848, 10835701}, { 19280052, 10835701 } },
  78. { { 19280052, 10835701}, { 27964852, 699996 } },
  79. { { 27964852, 699996}, { 28664848, 0 } },
  80. { { 28664848, 0}, { 41427551, 0 } },
  81. { { 41427551, 0}, { 42127548, 699996 } }
  82. };
  83. Lines lines1 {
  84. { { 42127548, 699996}, { 42127548, 10135750 } },
  85. { { 42127548, 10135750}, { 50487352, 10135750 } },
  86. { { 50487352, 10135750}, { 50487352, 699995 } },
  87. { { 50487352, 699995}, { 51187348, 0 } },
  88. { { 51187348, 0}, { 51187348, 10835701 } },
  89. { { 51187348, 10835701}, { 41427552, 10835701 } },
  90. { { 41427552, 10835701}, { 41427552, 699996 } },
  91. { { 41427552, 699996}, { 28664848, 699996 } },
  92. { { 28664848, 699996}, { 28664848, 10835701 } },
  93. { { 28664848, 10835701}, { 19280052, 10835701 } },
  94. { { 19280052, 10835701}, { 27964852, 699996 } },
  95. { { 27964852, 699996}, { 28664848, 0 } },
  96. { { 28664848, 0}, { 41427551, 0 } },
  97. { { 41427551, 0}, { 42127548, 699996 } }
  98. };
  99. Lines lines2 {
  100. { { 42127548, 699996}, { 42127548, 10135750 } },
  101. { { 42127548, 10135750}, { 50487352, 10135750 } },
  102. { { 50487352, 10135750}, { 50487352, 699995 } },
  103. { { 50487352, 699995}, { 51187348, 0 } },
  104. { { 51187348, 0}, { 51187348, 10835701 } },
  105. { { 51187348, 10835701}, { 41427552, 10835701 } },
  106. { { 41427552, 10835701}, { 41427552, 699996 } },
  107. { { 41427552, 699996}, { 28664848, 699996 } },
  108. { { 28664848, 699996}, { 28664848, 10835701 } },
  109. { { 28664848, 10835701}, { 19280052, 10835701 } },
  110. { { 19280052, 10835701}, { 28664848, 0 } },
  111. { { 28664848, 0}, { 41427551, 0 } },
  112. { { 41427551, 0}, { 42127548, 699996 } }
  113. };
  114. Lines lines3 {
  115. { { 42127548, 699996}, { 42127548, 10135750 } },
  116. { { 42127548, 10135750}, { 50487352, 10135750 } },
  117. { { 50487352, 10135750}, { 50487352, 699995 } },
  118. { { 50487352, 699995}, { 51187348, 0 } },
  119. { { 51187348, 0}, { 51187348, 10835701 } },
  120. { { 51187348, 10835701}, { 41427552, 10835701 } },
  121. { { 41427552, 10835701}, { 41427552, 699996 } },
  122. { { 41427552, 699996}, { 41427551, 0 } },
  123. { { 41427551, 0}, { 42127548, 699996 } }
  124. };
  125. Lines lines4 {
  126. { { 42127548, 699996}, { 42127548, 10135750 } },
  127. { { 42127548, 10135750}, { 50487352, 10135750 } },
  128. { { 50487352, 10135750}, { 50487352, 699995 } },
  129. { { 50487352, 699995}, { 51187348, 0 } },
  130. { { 51187348, 0}, { 51187348, 10835701 } },
  131. { { 51187348, 10835701}, { 41427552, 10835701 } },
  132. { { 41427552, 10835701}, { 41427551, 0 } },
  133. { { 41427551, 0}, { 42127548, 699996 } }
  134. };
  135. Polygon poly {
  136. { 0, 10000000},
  137. { 700000, 1}, // it has to be 1, higher number, zero or -1 work.
  138. { 700000, 9000000},
  139. { 9100000, 9000000},
  140. { 9100000, 0},
  141. {10000000, 10000000}
  142. };
  143. #if 1
  144. // Try to rotate, maybe the issue is caused by incorrect handling of vertical or horizontal edges?
  145. double a = 0.18764587962597876897475f;
  146. double c = cos(a);
  147. double s = sin(a);
  148. for (Point &p : poly.points) {
  149. Vec2d q = p.cast<double>();
  150. p.x() = coord_t(q.x() * c + q.y() * s + 0.5);
  151. p.y() = coord_t(- q.x() * s + q.y() * c + 0.5);
  152. }
  153. #endif
  154. std::mt19937 gen;
  155. std::uniform_int_distribution<coord_t> dist(-100, 100);
  156. #if 0
  157. for (Point &p : poly.points) {
  158. // Wiggle the points a bit to find out whether this fixes the voronoi diagram for this particular polygon.
  159. p.x() = (p.x() += dist(gen));
  160. p.y() = (p.y() += dist(gen));
  161. }
  162. #endif
  163. REQUIRE(intersecting_edges({ poly }).empty());
  164. Lines lines = to_lines(poly);
  165. VD vd;
  166. vd.construct_voronoi(lines.begin(), lines.end());
  167. #ifdef VORONOI_DEBUG_OUT
  168. dump_voronoi_to_svg(debug_out_path("voronoi-lines.svg").c_str(),
  169. vd, Points(), lines);
  170. #endif
  171. }
  172. TEST_CASE("Voronoi weirdness", "[Voronoi]")
  173. {
  174. Polygon poly2 {
  175. { 0, 0 },
  176. { 70000000, 0 },
  177. { 70000000, 1300000 },
  178. // { 70000001, 14000000 }
  179. { 70700000, 14000000 }
  180. };
  181. Polygon poly5 {
  182. { 35058884, -25732145 },
  183. { 35058884, -19586070 },
  184. { 32753739, -20246796 },
  185. { 28756244, -21010725 },
  186. { 24657532, -21657939 },
  187. { 20836260, -21960233 },
  188. { 16115145, -22070742 },
  189. { 11850152, -21839761 },
  190. { 7646240, -21470177 },
  191. { 3607605, -20786940 },
  192. { 1280947, -20329742 },
  193. { -292823, -19963790 },
  194. { -3844469, -18809741 },
  195. { -7237277, -17593723 },
  196. { -10225900, -16143761 },
  197. { -13030266, -14643721 },
  198. { -15404294, -12977561 },
  199. { -17601713, -11280712 },
  200. { -19241930, -9435607 },
  201. { -20714420, -7583739 },
  202. { -21726144, -5664355 },
  203. { -22579294, -3741947 },
  204. { -22966684, -1786321 },
  205. { -23200322, 170140 },
  206. { -22966684, 2126602 },
  207. { -22579296, 4082227 },
  208. { -21726148, 6004637 },
  209. { -20714424, 7924020 },
  210. { -19241932, 9775888 },
  211. { -17601717, 11620994 },
  212. { -15404423, 13317749 },
  213. { -13030276, 14984003 },
  214. { -10225910, 16484042 },
  215. { -7237288, 17934005 },
  216. { -3844482, 19150025 },
  217. { -292841, 20304074 },
  218. { 1280949, 20670031 },
  219. { 3607587, 21127226 },
  220. { 7646218, 21810465 },
  221. { 11850128, 22180055 },
  222. { 16115122, 22411036 },
  223. { 20836263, 22300531 },
  224. { 24657513, 21998239 },
  225. { 28756227, 21351025 },
  226. { 32753725, 20587092 },
  227. { 35058893, 19926309 },
  228. { 35058893, 35000000 },
  229. { -31657232, 35000000 },
  230. { -31657202, -35000000 },
  231. { 35058881, -35000000 }
  232. };
  233. Polygon poly7 {
  234. { 35058884, -25732145 },
  235. { 35058884, -19586070 },
  236. { -31657202, -35000000 },
  237. { 35058881, -35000000 }
  238. };
  239. // coord_t shift = 35058881;
  240. // coord_t shift_ok = 17000000;
  241. coord_t shift = 35058881;
  242. Polygon poly {
  243. // <-4, 0>: bug
  244. // -5: ok
  245. // 1 - ok
  246. { 0 + shift, -35000000 },
  247. { 0 + shift, -25732145 },
  248. { 0 + shift, -19586070 },
  249. { -66716086 + shift, -35000000 }
  250. };
  251. REQUIRE(intersecting_edges({ poly }).empty());
  252. REQUIRE(poly.area() > 0.);
  253. #if 0
  254. // Try to rotate, maybe the issue is caused by incorrect handling of vertical or horizontal edges?
  255. double a = 0.18764587962597876897475f;
  256. double c = cos(a);
  257. double s = sin(a);
  258. for (Point &p : poly.points) {
  259. Vec2d q = p.cast<double>();
  260. p.x() = coord_t(q.x() * c + q.y() * s + 0.5);
  261. p.y() = coord_t(- q.x() * s + q.y() * c + 0.5);
  262. }
  263. #endif
  264. VD vd;
  265. Lines lines = to_lines(poly);
  266. vd.construct_voronoi(lines.begin(), lines.end());
  267. #ifdef VORONOI_DEBUG_OUT
  268. dump_voronoi_to_svg(debug_out_path("voronoi-weirdness.svg").c_str(),
  269. vd, Points(), lines);
  270. #endif
  271. }
  272. // https://svn.boost.org/trac10/ticket/12903
  273. // division by zero reported, but this issue is most likely a non-issue, as it produces an infinity for the interval of validity
  274. // of the floating point calculation, therefore forcing a recalculation with extended accuracy.
  275. TEST_CASE("Voronoi division by zero 12903", "[Voronoi]")
  276. {
  277. Points pts { { 1, 1 }, { 3, 1 }, { 1, 3 }, { 3, 3 },
  278. { -1, 1 }, { 1, -1 }, { 5, 1 }, { 3, -1 },
  279. { -1, 3 }, { 1, 5 }, { 5, 3 }, { 3, 5 } };
  280. {
  281. auto pts2 { pts };
  282. std::sort(pts2.begin(), pts2.end(), [](auto &l, auto &r) { return (l.x() == r.x()) ? l.y() < r.y() : l.x() < r.x(); });
  283. // No point removed -> no duplicate.
  284. REQUIRE(std::unique(pts2.begin(), pts2.end()) == pts2.end());
  285. }
  286. VD vd;
  287. vd.construct_voronoi(pts.begin(), pts.end());
  288. #ifdef VORONOI_DEBUG_OUT
  289. // Scale the voronoi vertices and input points, so that the dump_voronoi_to_svg will display them correctly.
  290. for (auto &pt : vd.vertices()) {
  291. const_cast<double&>(pt.x()) = scale_(pt.x());
  292. const_cast<double&>(pt.y()) = scale_(pt.y());
  293. }
  294. for (auto &pt : pts)
  295. pt = Point::new_scale(pt.x(), pt.y());
  296. dump_voronoi_to_svg(debug_out_path("voronoi-div-by-zero.svg").c_str(), vd, pts, Lines());
  297. #endif
  298. }
  299. // https://svn.boost.org/trac10/ticket/12139
  300. // Funny sample from a dental industry?
  301. // Vojtech confirms this test fails and rightly so, because the input data contain self intersections.
  302. // This test is suppressed.
  303. TEST_CASE("Voronoi NaN coordinates 12139", "[Voronoi]")
  304. {
  305. Lines lines = {
  306. { { 260500,1564400 }, { 261040,1562960 } },
  307. { { 261040,1562960 }, { 260840,1561780 } },
  308. { { 260840,1561780 }, { 262620,1561480 } },
  309. { { 262620,1561480 }, { 263160,1561220 } },
  310. { { 263160,1561220 }, { 264100,1563259 } },
  311. { { 264100,1563259 }, { 262380,1566980 } },
  312. { { 262380,1566980 }, { 260500,1564400 } },
  313. { { 137520,1851640 }, { 132160,1851100 } },
  314. { { 132160,1851100 }, { 126460,1848779 } },
  315. { { 126460,1848779 }, { 123960,1847320 } },
  316. { { 123960,1847320 }, { 120960,1844559 } },
  317. { { 120960,1844559 }, { 119640,1843040 } },
  318. { { 119640,1843040 }, { 118320,1840900 } },
  319. { { 118320,1840900 }, { 117920,1838120 } },
  320. { { 117920,1838120 }, { 118219,1833340 } },
  321. { { 118219,1833340 }, { 116180,1835000 } },
  322. { { 116180,1835000 }, { 115999,1834820 } },
  323. { { 115999,1834820 }, { 114240,1836340 } },
  324. { { 114240,1836340 }, { 112719,1837260 } },
  325. { { 112719,1837260 }, { 109460,1838239 } },
  326. { { 109460,1838239 }, { 103639,1837480 } },
  327. { { 103639,1837480 }, { 99819,1835460 } },
  328. { { 99819,1835460 }, { 96320,1834260 } },
  329. { { 96320,1834260 }, { 95339,1834260 } },
  330. { { 95339,1834260 }, { 93660,1833720 } },
  331. { { 93660,1833720 }, { 90719,1833300 } },
  332. { { 90719,1833300 }, { 87860,1831660 } },
  333. { { 87860,1831660 }, { 84580,1830499 } },
  334. { { 84580,1830499 }, { 79780,1827419 } },
  335. { { 79780,1827419 }, { 76020,1824280 } },
  336. { { 76020,1824280 }, { 73680,1821180 } },
  337. { { 73680,1821180 }, { 72560,1818960 } },
  338. { { 72560,1818960 }, { 71699,1817719 } },
  339. { { 71699,1817719 }, { 70280,1814260 } },
  340. { { 70280,1814260 }, { 69460,1811060 } },
  341. { { 69460,1811060 }, { 69659,1807320 } },
  342. { { 69659,1807320 }, { 69640,1803300 } },
  343. { { 69640,1803300 }, { 69360,1799780 } },
  344. { { 69360,1799780 }, { 69320,1796720 } },
  345. { { 69320,1796720 }, { 69640,1793980 } },
  346. { { 69640,1793980 }, { 70160,1791780 } },
  347. { { 70160,1791780 }, { 72460,1784879 } },
  348. { { 72460,1784879 }, { 74420,1780780 } },
  349. { { 74420,1780780 }, { 76500,1772899 } },
  350. { { 76500,1772899 }, { 76760,1769359 } },
  351. { { 76760,1769359 }, { 76480,1766259 } },
  352. { { 76480,1766259 }, { 76839,1760360 } },
  353. { { 76839,1760360 }, { 77539,1756680 } },
  354. { { 77539,1756680 }, { 80540,1748140 } },
  355. { { 80540,1748140 }, { 84200,1742619 } },
  356. { { 84200,1742619 }, { 90900,1735220 } },
  357. { { 90900,1735220 }, { 94159,1732679 } },
  358. { { 94159,1732679 }, { 101259,1729559 } },
  359. { { 101259,1729559 }, { 107299,1727939 } },
  360. { { 107299,1727939 }, { 110979,1727919 } },
  361. { { 110979,1727919 }, { 113499,1727240 } },
  362. { { 113499,1727240 }, { 113619,1727359 } },
  363. { { 113619,1727359 }, { 114280,1727280 } },
  364. { { 114280,1727280 }, { 131440,1732560 } },
  365. { { 131440,1732560 }, { 118140,1727119 } },
  366. { { 118140,1727119 }, { 117120,1723759 } },
  367. { { 117120,1723759 }, { 113840,1720660 } },
  368. { { 113840,1720660 }, { 111399,1716760 } },
  369. { { 111399,1716760 }, { 109700,1712979 } },
  370. { { 109700,1712979 }, { 108879,1708400 } },
  371. { { 108879,1708400 }, { 108060,1696360 } },
  372. { { 108060,1696360 }, { 110040,1687760 } },
  373. { { 110040,1687760 }, { 112140,1682480 } },
  374. { { 112140,1682480 }, { 112540,1681780 } },
  375. { { 112540,1681780 }, { 115260,1678320 } },
  376. { { 115260,1678320 }, { 118720,1675320 } },
  377. { { 118720,1675320 }, { 126100,1670980 } },
  378. { { 126100,1670980 }, { 132400,1668080 } },
  379. { { 132400,1668080 }, { 136700,1667440 } },
  380. { { 136700,1667440 }, { 142440,1667159 } },
  381. { { 142440,1667159 }, { 143340,1666720 } },
  382. { { 143340,1666720 }, { 138679,1661319 } },
  383. { { 138679,1661319 }, { 137240,1657480 } },
  384. { { 137240,1657480 }, { 136760,1650739 } },
  385. { { 136760,1650739 }, { 136780,1647339 } },
  386. { { 136780,1647339 }, { 135940,1644280 } },
  387. { { 135940,1644280 }, { 136000,1640820 } },
  388. { { 136000,1640820 }, { 135480,1638020 } },
  389. { { 135480,1638020 }, { 137060,1634220 } },
  390. { { 137060,1634220 }, { 136320,1631340 } },
  391. { { 136320,1631340 }, { 134620,1629700 } },
  392. { { 134620,1629700 }, { 132460,1628199 } },
  393. { { 132460,1628199 }, { 132299,1627860 } },
  394. { { 132299,1627860 }, { 138360,1618020 } },
  395. { { 138360,1618020 }, { 142440,1611859 } },
  396. { { 142440,1611859 }, { 143180,1611299 } },
  397. { { 143180,1611299 }, { 144000,1611259 } },
  398. { { 144000,1611259 }, { 145960,1612540 } },
  399. { { 145960,1612540 }, { 146720,1613700 } },
  400. { { 146720,1613700 }, { 147700,1613539 } },
  401. { { 147700,1613539 }, { 148520,1614039 } },
  402. { { 148520,1614039 }, { 149840,1613740 } },
  403. { { 149840,1613740 }, { 150620,1614079 } },
  404. { { 150620,1614079 }, { 154760,1612740 } },
  405. { { 154760,1612740 }, { 159000,1608420 } },
  406. { { 159000,1608420 }, { 161120,1606780 } },
  407. { { 161120,1606780 }, { 164060,1605139 } },
  408. { { 164060,1605139 }, { 168079,1603620 } },
  409. { { 168079,1603620 }, { 170240,1603400 } },
  410. { { 170240,1603400 }, { 172400,1603499 } },
  411. { { 172400,1603499 }, { 194440,1613740 } },
  412. { { 194440,1613740 }, { 195880,1616460 } },
  413. { { 195880,1616460 }, { 197060,1618140 } },
  414. { { 197060,1618140 }, { 198039,1617860 } },
  415. { { 198039,1617860 }, { 198739,1618900 } },
  416. { { 198739,1618900 }, { 200259,1619200 } },
  417. { { 200259,1619200 }, { 201940,1618920 } },
  418. { { 201940,1618920 }, { 201700,1617139 } },
  419. { { 201700,1617139 }, { 203860,1618179 } },
  420. { { 203860,1618179 }, { 203500,1617540 } },
  421. { { 203500,1617540 }, { 205000,1616579 } },
  422. { { 205000,1616579 }, { 206780,1615020 } },
  423. { { 206780,1615020 }, { 210159,1614059 } },
  424. { { 210159,1614059 }, { 217080,1611080 } },
  425. { { 217080,1611080 }, { 219200,1611579 } },
  426. { { 219200,1611579 }, { 223219,1610980 } },
  427. { { 223219,1610980 }, { 224580,1610540 } },
  428. { { 224580,1610540 }, { 227460,1611440 } },
  429. { { 227460,1611440 }, { 229359,1611859 } },
  430. { { 229359,1611859 }, { 230620,1612580 } },
  431. { { 230620,1612580 }, { 232340,1614460 } },
  432. { { 232340,1614460 }, { 232419,1617040 } },
  433. { { 232419,1617040 }, { 231740,1619480 } },
  434. { { 231740,1619480 }, { 231880,1624899 } },
  435. { { 231880,1624899 }, { 231540,1625820 } },
  436. { { 231540,1625820 }, { 231700,1627079 } },
  437. { { 231700,1627079 }, { 231320,1628239 } },
  438. { { 231320,1628239 }, { 231420,1636080 } },
  439. { { 231420,1636080 }, { 231099,1637200 } },
  440. { { 231099,1637200 }, { 228660,1643280 } },
  441. { { 228660,1643280 }, { 227699,1644960 } },
  442. { { 227699,1644960 }, { 226080,1651140 } },
  443. { { 226080,1651140 }, { 225259,1653420 } },
  444. { { 225259,1653420 }, { 225159,1655399 } },
  445. { { 225159,1655399 }, { 223760,1659260 } },
  446. { { 223760,1659260 }, { 219860,1666360 } },
  447. { { 219860,1666360 }, { 219180,1667220 } },
  448. { { 219180,1667220 }, { 212580,1673680 } },
  449. { { 212580,1673680 }, { 207880,1676460 } },
  450. { { 207880,1676460 }, { 205560,1677560 } },
  451. { { 205560,1677560 }, { 199700,1678920 } },
  452. { { 199700,1678920 }, { 195280,1679420 } },
  453. { { 195280,1679420 }, { 193939,1679879 } },
  454. { { 193939,1679879 }, { 188780,1679440 } },
  455. { { 188780,1679440 }, { 188100,1679639 } },
  456. { { 188100,1679639 }, { 186680,1679339 } },
  457. { { 186680,1679339 }, { 184760,1679619 } },
  458. { { 184760,1679619 }, { 183520,1681440 } },
  459. { { 183520,1681440 }, { 183860,1682200 } },
  460. { { 183860,1682200 }, { 186620,1686120 } },
  461. { { 186620,1686120 }, { 190380,1688380 } },
  462. { { 190380,1688380 }, { 192780,1690739 } },
  463. { { 192780,1690739 }, { 195860,1694839 } },
  464. { { 195860,1694839 }, { 196620,1696539 } },
  465. { { 196620,1696539 }, { 197540,1701819 } },
  466. { { 197540,1701819 }, { 198939,1705699 } },
  467. { { 198939,1705699 }, { 198979,1711819 } },
  468. { { 198979,1711819 }, { 198240,1716900 } },
  469. { { 198240,1716900 }, { 197440,1720139 } },
  470. { { 197440,1720139 }, { 195340,1724639 } },
  471. { { 195340,1724639 }, { 194040,1726140 } },
  472. { { 194040,1726140 }, { 192559,1728239 } },
  473. { { 192559,1728239 }, { 187780,1732339 } },
  474. { { 187780,1732339 }, { 182519,1735520 } },
  475. { { 182519,1735520 }, { 181239,1736140 } },
  476. { { 181239,1736140 }, { 177340,1737619 } },
  477. { { 177340,1737619 }, { 175439,1738140 } },
  478. { { 175439,1738140 }, { 171380,1738880 } },
  479. { { 171380,1738880 }, { 167860,1739059 } },
  480. { { 167860,1739059 }, { 166040,1738920 } },
  481. { { 166040,1738920 }, { 163680,1738539 } },
  482. { { 163680,1738539 }, { 157660,1736859 } },
  483. { { 157660,1736859 }, { 154900,1735460 } },
  484. { { 154900,1735460 }, { 151420,1735159 } },
  485. { { 151420,1735159 }, { 142100,1736160 } },
  486. { { 142100,1736160 }, { 140880,1735920 } },
  487. { { 140880,1735920 }, { 142820,1736859 } },
  488. { { 142820,1736859 }, { 144080,1737240 } },
  489. { { 144080,1737240 }, { 144280,1737460 } },
  490. { { 144280,1737460 }, { 144239,1738120 } },
  491. { { 144239,1738120 }, { 144980,1739420 } },
  492. { { 144980,1739420 }, { 146340,1741039 } },
  493. { { 146340,1741039 }, { 147160,1741720 } },
  494. { { 147160,1741720 }, { 154260,1745800 } },
  495. { { 154260,1745800 }, { 156560,1746879 } },
  496. { { 156560,1746879 }, { 165180,1752679 } },
  497. { { 165180,1752679 }, { 168240,1755860 } },
  498. { { 168240,1755860 }, { 170940,1759260 } },
  499. { { 170940,1759260 }, { 173440,1762079 } },
  500. { { 173440,1762079 }, { 174540,1764079 } },
  501. { { 174540,1764079 }, { 176479,1766640 } },
  502. { { 176479,1766640 }, { 178900,1768960 } },
  503. { { 178900,1768960 }, { 180819,1772780 } },
  504. { { 180819,1772780 }, { 181479,1776859 } },
  505. { { 181479,1776859 }, { 181660,1788499 } },
  506. { { 181660,1788499 }, { 181460,1791740 } },
  507. { { 181460,1791740 }, { 181160,1792840 } },
  508. { { 181160,1792840 }, { 179580,1797180 } },
  509. { { 179580,1797180 }, { 174620,1808960 } },
  510. { { 174620,1808960 }, { 174100,1809839 } },
  511. { { 174100,1809839 }, { 171660,1812419 } },
  512. { { 171660,1812419 }, { 169639,1813840 } },
  513. { { 169639,1813840 }, { 168880,1814720 } },
  514. { { 168880,1814720 }, { 168960,1815980 } },
  515. { { 168960,1815980 }, { 169979,1819160 } },
  516. { { 169979,1819160 }, { 170080,1820159 } },
  517. { { 170080,1820159 }, { 168280,1830540 } },
  518. { { 168280,1830540 }, { 167580,1832200 } },
  519. { { 167580,1832200 }, { 165679,1835720 } },
  520. { { 165679,1835720 }, { 164720,1836819 } },
  521. { { 164720,1836819 }, { 161840,1841740 } },
  522. { { 161840,1841740 }, { 159880,1843519 } },
  523. { { 159880,1843519 }, { 158959,1844120 } },
  524. { { 158959,1844120 }, { 154960,1847500 } },
  525. { { 154960,1847500 }, { 152140,1848580 } },
  526. { { 152140,1848580 }, { 150440,1849520 } },
  527. { { 150440,1849520 }, { 144940,1850980 } },
  528. { { 144940,1850980 }, { 138340,1851700 } },
  529. { { 138340,1851700 }, { 137520,1851640 } },
  530. { { 606940,1873860 }, { 602860,1872460 } },
  531. { { 602860,1872460 }, { 600680,1871539 } },
  532. { { 600680,1871539 }, { 599300,1870640 } },
  533. { { 599300,1870640 }, { 598120,1869579 } },
  534. { { 598120,1869579 }, { 594680,1867180 } },
  535. { { 594680,1867180 }, { 589680,1861460 } },
  536. { { 589680,1861460 }, { 586300,1855020 } },
  537. { { 586300,1855020 }, { 584700,1848060 } },
  538. { { 584700,1848060 }, { 585199,1843499 } },
  539. { { 585199,1843499 }, { 584000,1842079 } },
  540. { { 584000,1842079 }, { 582900,1841480 } },
  541. { { 582900,1841480 }, { 581020,1839899 } },
  542. { { 581020,1839899 }, { 579440,1838040 } },
  543. { { 579440,1838040 }, { 577840,1834299 } },
  544. { { 577840,1834299 }, { 576160,1831859 } },
  545. { { 576160,1831859 }, { 574540,1828499 } },
  546. { { 574540,1828499 }, { 572140,1822860 } },
  547. { { 572140,1822860 }, { 570180,1815219 } },
  548. { { 570180,1815219 }, { 570080,1812280 } },
  549. { { 570080,1812280 }, { 570340,1808300 } },
  550. { { 570340,1808300 }, { 570160,1807119 } },
  551. { { 570160,1807119 }, { 570140,1804039 } },
  552. { { 570140,1804039 }, { 571640,1796660 } },
  553. { { 571640,1796660 }, { 571740,1794680 } },
  554. { { 571740,1794680 }, { 572279,1794039 } },
  555. { { 572279,1794039 }, { 575480,1788300 } },
  556. { { 575480,1788300 }, { 576379,1787419 } },
  557. { { 576379,1787419 }, { 577020,1786120 } },
  558. { { 577020,1786120 }, { 578000,1785100 } },
  559. { { 578000,1785100 }, { 579960,1783720 } },
  560. { { 579960,1783720 }, { 581420,1782079 } },
  561. { { 581420,1782079 }, { 585480,1778440 } },
  562. { { 585480,1778440 }, { 586680,1777079 } },
  563. { { 586680,1777079 }, { 590520,1774639 } },
  564. { { 590520,1774639 }, { 592440,1773199 } },
  565. { { 592440,1773199 }, { 595160,1772260 } },
  566. { { 595160,1772260 }, { 598079,1770920 } },
  567. { { 598079,1770920 }, { 601420,1769019 } },
  568. { { 601420,1769019 }, { 606400,1767280 } },
  569. { { 606400,1767280 }, { 607320,1766620 } },
  570. { { 607320,1766620 }, { 605760,1766460 } },
  571. { { 605760,1766460 }, { 604420,1766780 } },
  572. { { 604420,1766780 }, { 601660,1766579 } },
  573. { { 601660,1766579 }, { 597160,1766980 } },
  574. { { 597160,1766980 }, { 591420,1766720 } },
  575. { { 591420,1766720 }, { 585360,1765460 } },
  576. { { 585360,1765460 }, { 578540,1763680 } },
  577. { { 578540,1763680 }, { 574020,1761599 } },
  578. { { 574020,1761599 }, { 572520,1760560 } },
  579. { { 572520,1760560 }, { 570959,1759000 } },
  580. { { 570959,1759000 }, { 566580,1755620 } },
  581. { { 566580,1755620 }, { 563820,1752000 } },
  582. { { 563820,1752000 }, { 563140,1751380 } },
  583. { { 563140,1751380 }, { 560800,1747899 } },
  584. { { 560800,1747899 }, { 558640,1742280 } },
  585. { { 558640,1742280 }, { 557860,1741620 } },
  586. { { 557860,1741620 }, { 555820,1739099 } },
  587. { { 555820,1739099 }, { 553920,1737540 } },
  588. { { 553920,1737540 }, { 551900,1735179 } },
  589. { { 551900,1735179 }, { 551180,1733880 } },
  590. { { 551180,1733880 }, { 549540,1729559 } },
  591. { { 549540,1729559 }, { 548860,1720720 } },
  592. { { 548860,1720720 }, { 549080,1719099 } },
  593. { { 549080,1719099 }, { 548200,1714700 } },
  594. { { 548200,1714700 }, { 547560,1713860 } },
  595. { { 547560,1713860 }, { 544500,1711259 } },
  596. { { 544500,1711259 }, { 543939,1709780 } },
  597. { { 543939,1709780 }, { 544520,1705439 } },
  598. { { 544520,1705439 }, { 543520,1701519 } },
  599. { { 543520,1701519 }, { 543920,1699319 } },
  600. { { 543920,1699319 }, { 546360,1697440 } },
  601. { { 546360,1697440 }, { 546680,1695419 } },
  602. { { 546680,1695419 }, { 545600,1694180 } },
  603. { { 545600,1694180 }, { 543220,1692000 } },
  604. { { 543220,1692000 }, { 538260,1685139 } },
  605. { { 538260,1685139 }, { 537540,1683000 } },
  606. { { 537540,1683000 }, { 537020,1682220 } },
  607. { { 537020,1682220 }, { 535560,1675940 } },
  608. { { 535560,1675940 }, { 535940,1671220 } },
  609. { { 535940,1671220 }, { 536320,1669379 } },
  610. { { 536320,1669379 }, { 535420,1666400 } },
  611. { { 535420,1666400 }, { 533540,1664460 } },
  612. { { 533540,1664460 }, { 530720,1662860 } },
  613. { { 530720,1662860 }, { 529240,1662260 } },
  614. { { 529240,1662260 }, { 528780,1659160 } },
  615. { { 528780,1659160 }, { 528820,1653560 } },
  616. { { 528820,1653560 }, { 529779,1650900 } },
  617. { { 529779,1650900 }, { 536760,1640840 } },
  618. { { 536760,1640840 }, { 540360,1636120 } },
  619. { { 540360,1636120 }, { 541160,1635380 } },
  620. { { 541160,1635380 }, { 544719,1629480 } },
  621. { { 544719,1629480 }, { 545319,1626140 } },
  622. { { 545319,1626140 }, { 543560,1623740 } },
  623. { { 543560,1623740 }, { 539880,1620739 } },
  624. { { 539880,1620739 }, { 533400,1617300 } },
  625. { { 533400,1617300 }, { 527840,1613020 } },
  626. { { 527840,1613020 }, { 525200,1611579 } },
  627. { { 525200,1611579 }, { 524360,1610800 } },
  628. { { 524360,1610800 }, { 517320,1605739 } },
  629. { { 517320,1605739 }, { 516240,1604240 } },
  630. { { 516240,1604240 }, { 515220,1602000 } },
  631. { { 515220,1602000 }, { 514079,1594240 } },
  632. { { 514079,1594240 }, { 513740,1581460 } },
  633. { { 513740,1581460 }, { 514660,1577359 } },
  634. { { 514660,1577359 }, { 514660,1576380 } },
  635. { { 514660,1576380 }, { 514199,1575380 } },
  636. { { 514199,1575380 }, { 514680,1572860 } },
  637. { { 514680,1572860 }, { 513440,1573940 } },
  638. { { 513440,1573940 }, { 512399,1575580 } },
  639. { { 512399,1575580 }, { 511620,1576220 } },
  640. { { 511620,1576220 }, { 507840,1581880 } },
  641. { { 507840,1581880 }, { 504600,1584579 } },
  642. { { 504600,1584579 }, { 502440,1584599 } },
  643. { { 502440,1584599 }, { 499060,1584059 } },
  644. { { 499060,1584059 }, { 498019,1581960 } },
  645. { { 498019,1581960 }, { 497819,1581240 } },
  646. { { 497819,1581240 }, { 498019,1576039 } },
  647. { { 498019,1576039 }, { 497539,1574740 } },
  648. { { 497539,1574740 }, { 495459,1574460 } },
  649. { { 495459,1574460 }, { 492320,1575600 } },
  650. { { 492320,1575600 }, { 491040,1576360 } },
  651. { { 491040,1576360 }, { 490080,1575640 } },
  652. { { 490080,1575640 }, { 490020,1575040 } },
  653. { { 490020,1575040 }, { 490220,1574400 } },
  654. { { 490220,1574400 }, { 490819,1573440 } },
  655. { { 490819,1573440 }, { 492680,1568259 } },
  656. { { 492680,1568259 }, { 492920,1566799 } },
  657. { { 492920,1566799 }, { 495760,1563660 } },
  658. { { 495760,1563660 }, { 496100,1562139 } },
  659. { { 496100,1562139 }, { 497879,1560240 } },
  660. { { 497879,1560240 }, { 497059,1558020 } },
  661. { { 497059,1558020 }, { 495620,1557399 } },
  662. { { 495620,1557399 }, { 494800,1556839 } },
  663. { { 494800,1556839 }, { 493500,1555479 } },
  664. { { 493500,1555479 }, { 491860,1554100 } },
  665. { { 491860,1554100 }, { 487840,1552139 } },
  666. { { 487840,1552139 }, { 485900,1551720 } },
  667. { { 485900,1551720 }, { 483639,1555439 } },
  668. { { 483639,1555439 }, { 482080,1556480 } },
  669. { { 482080,1556480 }, { 480200,1556259 } },
  670. { { 480200,1556259 }, { 478519,1556259 } },
  671. { { 478519,1556259 }, { 474020,1554019 } },
  672. { { 474020,1554019 }, { 472660,1551539 } },
  673. { { 472660,1551539 }, { 471260,1549899 } },
  674. { { 471260,1549899 }, { 470459,1548020 } },
  675. { { 470459,1548020 }, { 469920,1545479 } },
  676. { { 469920,1545479 }, { 469079,1542939 } },
  677. { { 469079,1542939 }, { 469120,1541799 } },
  678. { { 469120,1541799 }, { 465840,1537139 } },
  679. { { 465840,1537139 }, { 463360,1539059 } },
  680. { { 463360,1539059 }, { 459680,1546900 } },
  681. { { 459680,1546900 }, { 458439,1547160 } },
  682. { { 458439,1547160 }, { 456480,1549319 } },
  683. { { 456480,1549319 }, { 454160,1551400 } },
  684. { { 454160,1551400 }, { 452819,1550820 } },
  685. { { 452819,1550820 }, { 451699,1549839 } },
  686. { { 451699,1549839 }, { 449620,1548440 } },
  687. { { 449620,1548440 }, { 449419,1548080 } },
  688. { { 449419,1548080 }, { 447879,1547720 } },
  689. { { 447879,1547720 }, { 446540,1546819 } },
  690. { { 446540,1546819 }, { 445720,1545640 } },
  691. { { 445720,1545640 }, { 444800,1545100 } },
  692. { { 444800,1545100 }, { 443500,1542899 } },
  693. { { 443500,1542899 }, { 443320,1541799 } },
  694. { { 443320,1541799 }, { 443519,1540220 } },
  695. { { 443519,1540220 }, { 445060,1537099 } },
  696. { { 445060,1537099 }, { 445840,1533040 } },
  697. { { 445840,1533040 }, { 442720,1529079 } },
  698. { { 442720,1529079 }, { 442479,1528360 } },
  699. { { 442479,1528360 }, { 436820,1529240 } },
  700. { { 436820,1529240 }, { 436279,1529200 } },
  701. { { 436279,1529200 }, { 433280,1529859 } },
  702. { { 433280,1529859 }, { 420220,1529899 } },
  703. { { 420220,1529899 }, { 414740,1528539 } },
  704. { { 414740,1528539 }, { 411340,1527960 } },
  705. { { 411340,1527960 }, { 406860,1524660 } },
  706. { { 406860,1524660 }, { 405379,1523080 } },
  707. { { 405379,1523080 }, { 403639,1520320 } },
  708. { { 403639,1520320 }, { 402040,1517220 } },
  709. { { 402040,1517220 }, { 400519,1517059 } },
  710. { { 400519,1517059 }, { 399180,1516720 } },
  711. { { 399180,1516720 }, { 395300,1515179 } },
  712. { { 395300,1515179 }, { 394780,1515080 } },
  713. { { 394780,1515080 }, { 394759,1515900 } },
  714. { { 394759,1515900 }, { 394339,1516579 } },
  715. { { 394339,1516579 }, { 393200,1516640 } },
  716. { { 393200,1516640 }, { 392599,1521799 } },
  717. { { 392599,1521799 }, { 391699,1525200 } },
  718. { { 391699,1525200 }, { 391040,1525600 } },
  719. { { 391040,1525600 }, { 390540,1526500 } },
  720. { { 390540,1526500 }, { 388999,1527939 } },
  721. { { 388999,1527939 }, { 387059,1531100 } },
  722. { { 387059,1531100 }, { 386540,1531440 } },
  723. { { 386540,1531440 }, { 382140,1531839 } },
  724. { { 382140,1531839 }, { 377360,1532619 } },
  725. { { 377360,1532619 }, { 375640,1532220 } },
  726. { { 375640,1532220 }, { 372580,1531019 } },
  727. { { 372580,1531019 }, { 371079,1529019 } },
  728. { { 371079,1529019 }, { 367280,1526039 } },
  729. { { 367280,1526039 }, { 366460,1521900 } },
  730. { { 366460,1521900 }, { 364320,1516400 } },
  731. { { 364320,1516400 }, { 363779,1515780 } },
  732. { { 363779,1515780 }, { 362220,1515320 } },
  733. { { 362220,1515320 }, { 361979,1515060 } },
  734. { { 361979,1515060 }, { 360820,1515739 } },
  735. { { 360820,1515739 }, { 353360,1518620 } },
  736. { { 353360,1518620 }, { 347840,1520080 } },
  737. { { 347840,1520080 }, { 342399,1521140 } },
  738. { { 342399,1521140 }, { 334899,1523380 } },
  739. { { 334899,1523380 }, { 333220,1523400 } },
  740. { { 333220,1523400 }, { 332599,1522919 } },
  741. { { 332599,1522919 }, { 329780,1521640 } },
  742. { { 329780,1521640 }, { 325360,1521220 } },
  743. { { 325360,1521220 }, { 319000,1520999 } },
  744. { { 319000,1520999 }, { 316180,1520240 } },
  745. { { 316180,1520240 }, { 312700,1518960 } },
  746. { { 312700,1518960 }, { 310520,1517679 } },
  747. { { 310520,1517679 }, { 309280,1517260 } },
  748. { { 309280,1517260 }, { 306440,1515040 } },
  749. { { 306440,1515040 }, { 304140,1512780 } },
  750. { { 304140,1512780 }, { 301640,1509720 } },
  751. { { 301640,1509720 }, { 301500,1509879 } },
  752. { { 301500,1509879 }, { 300320,1509059 } },
  753. { { 300320,1509059 }, { 299140,1507339 } },
  754. { { 299140,1507339 }, { 297340,1502659 } },
  755. { { 297340,1502659 }, { 298960,1508280 } },
  756. { { 298960,1508280 }, { 299120,1509299 } },
  757. { { 299120,1509299 }, { 298720,1510100 } },
  758. { { 298720,1510100 }, { 298420,1512240 } },
  759. { { 298420,1512240 }, { 297420,1514540 } },
  760. { { 297420,1514540 }, { 296900,1515340 } },
  761. { { 296900,1515340 }, { 294780,1517500 } },
  762. { { 294780,1517500 }, { 293040,1518380 } },
  763. { { 293040,1518380 }, { 289140,1521360 } },
  764. { { 289140,1521360 }, { 283600,1523300 } },
  765. { { 283600,1523300 }, { 280140,1525220 } },
  766. { { 280140,1525220 }, { 279620,1525679 } },
  767. { { 279620,1525679 }, { 274960,1527379 } },
  768. { { 274960,1527379 }, { 273440,1528819 } },
  769. { { 273440,1528819 }, { 269840,1532840 } },
  770. { { 269840,1532840 }, { 264800,1536240 } },
  771. { { 264800,1536240 }, { 261199,1540419 } },
  772. { { 261199,1540419 }, { 257359,1541400 } },
  773. { { 257359,1541400 }, { 250460,1539299 } },
  774. { { 250460,1539299 }, { 250240,1539400 } },
  775. { { 250240,1539400 }, { 249840,1540460 } },
  776. { { 249840,1540460 }, { 249779,1541140 } },
  777. { { 249779,1541140 }, { 248482,1539783 } },
  778. { { 248482,1539783 }, { 251320,1544120 } },
  779. { { 251320,1544120 }, { 252500,1548320 } },
  780. { { 252500,1548320 }, { 252519,1549740 } },
  781. { { 252519,1549740 }, { 253000,1553140 } },
  782. { { 253000,1553140 }, { 252920,1556539 } },
  783. { { 252920,1556539 }, { 253160,1556700 } },
  784. { { 253160,1556700 }, { 254019,1558220 } },
  785. { { 254019,1558220 }, { 253039,1559339 } },
  786. { { 253039,1559339 }, { 252300,1561920 } },
  787. { { 252300,1561920 }, { 251080,1565260 } },
  788. { { 251080,1565260 }, { 251120,1566160 } },
  789. { { 251120,1566160 }, { 249979,1570240 } },
  790. { { 249979,1570240 }, { 248799,1575380 } },
  791. { { 248799,1575380 }, { 247180,1579520 } },
  792. { { 247180,1579520 }, { 243380,1588440 } },
  793. { { 243380,1588440 }, { 241700,1591780 } },
  794. { { 241700,1591780 }, { 240280,1593080 } },
  795. { { 240280,1593080 }, { 231859,1598380 } },
  796. { { 231859,1598380 }, { 228840,1600060 } },
  797. { { 228840,1600060 }, { 226420,1601080 } },
  798. { { 226420,1601080 }, { 223620,1601940 } },
  799. { { 223620,1601940 }, { 220919,1603819 } },
  800. { { 220919,1603819 }, { 219599,1604420 } },
  801. { { 219599,1604420 }, { 218380,1605200 } },
  802. { { 218380,1605200 }, { 213219,1607260 } },
  803. { { 213219,1607260 }, { 210040,1607740 } },
  804. { { 210040,1607740 }, { 186439,1596440 } },
  805. { { 186439,1596440 }, { 185159,1594559 } },
  806. { { 185159,1594559 }, { 182239,1588300 } },
  807. { { 182239,1588300 }, { 181040,1585380 } },
  808. { { 181040,1585380 }, { 180380,1578580 } },
  809. { { 180380,1578580 }, { 180679,1573220 } },
  810. { { 180679,1573220 }, { 181220,1568539 } },
  811. { { 181220,1568539 }, { 181859,1565020 } },
  812. { { 181859,1565020 }, { 184499,1555500 } },
  813. { { 184499,1555500 }, { 183480,1558160 } },
  814. { { 183480,1558160 }, { 182600,1561700 } },
  815. { { 182600,1561700 }, { 171700,1554359 } },
  816. { { 171700,1554359 }, { 176880,1545920 } },
  817. { { 176880,1545920 }, { 189940,1529000 } },
  818. { { 189940,1529000 }, { 200040,1535759 } },
  819. { { 200040,1535759 }, { 207559,1531660 } },
  820. { { 207559,1531660 }, { 218039,1527520 } },
  821. { { 218039,1527520 }, { 222360,1526640 } },
  822. { { 222360,1526640 }, { 225439,1526440 } },
  823. { { 225439,1526440 }, { 231160,1527079 } },
  824. { { 231160,1527079 }, { 232300,1527399 } },
  825. { { 232300,1527399 }, { 236579,1529140 } },
  826. { { 236579,1529140 }, { 238139,1529120 } },
  827. { { 238139,1529120 }, { 238799,1529319 } },
  828. { { 238799,1529319 }, { 240999,1531780 } },
  829. { { 240999,1531780 }, { 238280,1528799 } },
  830. { { 238280,1528799 }, { 236900,1523840 } },
  831. { { 236900,1523840 }, { 236800,1522700 } },
  832. { { 236800,1522700 }, { 235919,1518880 } },
  833. { { 235919,1518880 }, { 236080,1514299 } },
  834. { { 236080,1514299 }, { 238260,1508380 } },
  835. { { 238260,1508380 }, { 240119,1505159 } },
  836. { { 240119,1505159 }, { 233319,1496360 } },
  837. { { 233319,1496360 }, { 239140,1490759 } },
  838. { { 239140,1490759 }, { 258760,1478080 } },
  839. { { 258760,1478080 }, { 263940,1484760 } },
  840. { { 263940,1484760 }, { 263460,1485159 } },
  841. { { 263460,1485159 }, { 265960,1483519 } },
  842. { { 265960,1483519 }, { 270380,1482020 } },
  843. { { 270380,1482020 }, { 272880,1481420 } },
  844. { { 272880,1481420 }, { 275700,1481400 } },
  845. { { 275700,1481400 }, { 278380,1481740 } },
  846. { { 278380,1481740 }, { 281220,1482979 } },
  847. { { 281220,1482979 }, { 284680,1484859 } },
  848. { { 284680,1484859 }, { 285979,1486140 } },
  849. { { 285979,1486140 }, { 290220,1489100 } },
  850. { { 290220,1489100 }, { 292680,1489520 } },
  851. { { 292680,1489520 }, { 293280,1490240 } },
  852. { { 293280,1490240 }, { 293140,1489160 } },
  853. { { 293140,1489160 }, { 293280,1488580 } },
  854. { { 293280,1488580 }, { 294100,1486980 } },
  855. { { 294100,1486980 }, { 294580,1484960 } },
  856. { { 294580,1484960 }, { 295680,1481660 } },
  857. { { 295680,1481660 }, { 297840,1477339 } },
  858. { { 297840,1477339 }, { 302240,1472280 } },
  859. { { 302240,1472280 }, { 307120,1469000 } },
  860. { { 307120,1469000 }, { 314500,1466340 } },
  861. { { 314500,1466340 }, { 324979,1464740 } },
  862. { { 324979,1464740 }, { 338999,1462059 } },
  863. { { 338999,1462059 }, { 345599,1461579 } },
  864. { { 345599,1461579 }, { 349020,1461620 } },
  865. { { 349020,1461620 }, { 353420,1461160 } },
  866. { { 353420,1461160 }, { 357000,1461500 } },
  867. { { 357000,1461500 }, { 359860,1461579 } },
  868. { { 359860,1461579 }, { 364520,1462740 } },
  869. { { 364520,1462740 }, { 367280,1464000 } },
  870. { { 367280,1464000 }, { 372020,1467560 } },
  871. { { 372020,1467560 }, { 373999,1469980 } },
  872. { { 373999,1469980 }, { 375580,1472240 } },
  873. { { 375580,1472240 }, { 376680,1474460 } },
  874. { { 376680,1474460 }, { 377259,1478620 } },
  875. { { 377259,1478620 }, { 379279,1480880 } },
  876. { { 379279,1480880 }, { 379260,1481600 } },
  877. { { 379260,1481600 }, { 378760,1482000 } },
  878. { { 378760,1482000 }, { 379300,1482040 } },
  879. { { 379300,1482040 }, { 380220,1482460 } },
  880. { { 380220,1482460 }, { 380840,1483020 } },
  881. { { 380840,1483020 }, { 385519,1482600 } },
  882. { { 385519,1482600 }, { 386019,1482320 } },
  883. { { 386019,1482320 }, { 386499,1481600 } },
  884. { { 386499,1481600 }, { 386540,1480139 } },
  885. { { 386540,1480139 }, { 387500,1478220 } },
  886. { { 387500,1478220 }, { 388280,1476100 } },
  887. { { 388280,1476100 }, { 390060,1473000 } },
  888. { { 390060,1473000 }, { 393659,1469460 } },
  889. { { 393659,1469460 }, { 396540,1467860 } },
  890. { { 396540,1467860 }, { 401260,1466040 } },
  891. { { 401260,1466040 }, { 406200,1465100 } },
  892. { { 406200,1465100 }, { 410920,1465439 } },
  893. { { 410920,1465439 }, { 420659,1467399 } },
  894. { { 420659,1467399 }, { 433500,1471480 } },
  895. { { 433500,1471480 }, { 441340,1473540 } },
  896. { { 441340,1473540 }, { 448620,1475139 } },
  897. { { 448620,1475139 }, { 450720,1475880 } },
  898. { { 450720,1475880 }, { 453299,1477059 } },
  899. { { 453299,1477059 }, { 456620,1478940 } },
  900. { { 456620,1478940 }, { 458480,1480399 } },
  901. { { 458480,1480399 }, { 461100,1482780 } },
  902. { { 461100,1482780 }, { 463820,1486519 } },
  903. { { 463820,1486519 }, { 464780,1488199 } },
  904. { { 464780,1488199 }, { 466579,1493960 } },
  905. { { 466579,1493960 }, { 467120,1497700 } },
  906. { { 467120,1497700 }, { 466999,1500280 } },
  907. { { 466999,1500280 }, { 467300,1502580 } },
  908. { { 467300,1502580 }, { 467399,1505280 } },
  909. { { 467399,1505280 }, { 466979,1506920 } },
  910. { { 466979,1506920 }, { 467920,1504780 } },
  911. { { 467920,1504780 }, { 468159,1505040 } },
  912. { { 468159,1505040 }, { 469400,1504859 } },
  913. { { 469400,1504859 }, { 470300,1505540 } },
  914. { { 470300,1505540 }, { 471240,1505200 } },
  915. { { 471240,1505200 }, { 471579,1504280 } },
  916. { { 471579,1504280 }, { 473939,1502379 } },
  917. { { 473939,1502379 }, { 476860,1500200 } },
  918. { { 476860,1500200 }, { 479800,1498620 } },
  919. { { 479800,1498620 }, { 480840,1498120 } },
  920. { { 480840,1498120 }, { 485220,1497480 } },
  921. { { 485220,1497480 }, { 489979,1497460 } },
  922. { { 489979,1497460 }, { 494899,1498700 } },
  923. { { 494899,1498700 }, { 500099,1501320 } },
  924. { { 500099,1501320 }, { 501439,1501839 } },
  925. { { 501439,1501839 }, { 503400,1502939 } },
  926. { { 503400,1502939 }, { 510760,1508340 } },
  927. { { 510760,1508340 }, { 513640,1510920 } },
  928. { { 513640,1510920 }, { 518579,1514599 } },
  929. { { 518579,1514599 }, { 519020,1515260 } },
  930. { { 519020,1515260 }, { 520700,1516480 } },
  931. { { 520700,1516480 }, { 524960,1521480 } },
  932. { { 524960,1521480 }, { 526820,1524820 } },
  933. { { 526820,1524820 }, { 528280,1527820 } },
  934. { { 528280,1527820 }, { 529120,1533120 } },
  935. { { 529120,1533120 }, { 528820,1537139 } },
  936. { { 528820,1537139 }, { 527020,1543920 } },
  937. { { 527020,1543920 }, { 526959,1546780 } },
  938. { { 526959,1546780 }, { 526420,1548060 } },
  939. { { 526420,1548060 }, { 527020,1547919 } },
  940. { { 527020,1547919 }, { 527620,1548160 } },
  941. { { 527620,1548160 }, { 528980,1548020 } },
  942. { { 528980,1548020 }, { 535180,1544980 } },
  943. { { 535180,1544980 }, { 540860,1542979 } },
  944. { { 540860,1542979 }, { 546480,1542720 } },
  945. { { 546480,1542720 }, { 547420,1542860 } },
  946. { { 547420,1542860 }, { 551800,1544140 } },
  947. { { 551800,1544140 }, { 558740,1547939 } },
  948. { { 558740,1547939 }, { 569920,1556259 } },
  949. { { 569920,1556259 }, { 573660,1560220 } },
  950. { { 573660,1560220 }, { 573040,1559500 } },
  951. { { 573040,1559500 }, { 574740,1559220 } },
  952. { { 574740,1559220 }, { 588480,1562899 } },
  953. { { 588480,1562899 }, { 585180,1576019 } },
  954. { { 585180,1576019 }, { 583440,1577979 } },
  955. { { 583440,1577979 }, { 584280,1582399 } },
  956. { { 584280,1582399 }, { 584520,1588960 } },
  957. { { 584520,1588960 }, { 583420,1601620 } },
  958. { { 583420,1601620 }, { 582840,1603880 } },
  959. { { 582840,1603880 }, { 579860,1611400 } },
  960. { { 579860,1611400 }, { 577980,1614579 } },
  961. { { 577980,1614579 }, { 577380,1616080 } },
  962. { { 577380,1616080 }, { 563800,1621579 } },
  963. { { 563800,1621579 }, { 561320,1622320 } },
  964. { { 561320,1622320 }, { 565080,1621960 } },
  965. { { 565080,1621960 }, { 571680,1620780 } },
  966. { { 571680,1620780 }, { 583260,1628340 } },
  967. { { 583260,1628340 }, { 583100,1630399 } },
  968. { { 583100,1630399 }, { 582200,1632160 } },
  969. { { 582200,1632160 }, { 595380,1627020 } },
  970. { { 595380,1627020 }, { 597400,1627320 } },
  971. { { 597400,1627320 }, { 602240,1628459 } },
  972. { { 602240,1628459 }, { 605660,1630260 } },
  973. { { 605660,1630260 }, { 610319,1634140 } },
  974. { { 610319,1634140 }, { 612340,1636319 } },
  975. { { 612340,1636319 }, { 614820,1638020 } },
  976. { { 614820,1638020 }, { 616460,1638740 } },
  977. { { 616460,1638740 }, { 620420,1639500 } },
  978. { { 620420,1639500 }, { 623000,1639280 } },
  979. { { 623000,1639280 }, { 624459,1639359 } },
  980. { { 624459,1639359 }, { 626180,1640159 } },
  981. { { 626180,1640159 }, { 627279,1640940 } },
  982. { { 627279,1640940 }, { 629980,1643759 } },
  983. { { 629980,1643759 }, { 632380,1648000 } },
  984. { { 632380,1648000 }, { 635020,1654800 } },
  985. { { 635020,1654800 }, { 636320,1659140 } },
  986. { { 636320,1659140 }, { 636680,1663620 } },
  987. { { 636680,1663620 }, { 636180,1665780 } },
  988. { { 636180,1665780 }, { 630620,1669720 } },
  989. { { 630620,1669720 }, { 628760,1672979 } },
  990. { { 628760,1672979 }, { 627540,1676859 } },
  991. { { 627540,1676859 }, { 627040,1680699 } },
  992. { { 627040,1680699 }, { 624700,1686500 } },
  993. { { 624700,1686500 }, { 623260,1688799 } },
  994. { { 623260,1688799 }, { 619620,1693799 } },
  995. { { 619620,1693799 }, { 621720,1694859 } },
  996. { { 621720,1694859 }, { 624940,1694379 } },
  997. { { 624940,1694379 }, { 627120,1695600 } },
  998. { { 627120,1695600 }, { 627740,1696120 } },
  999. { { 627740,1696120 }, { 631120,1697460 } },
  1000. { { 631120,1697460 }, { 633980,1698340 } },
  1001. { { 633980,1698340 }, { 638380,1700460 } },
  1002. { { 638380,1700460 }, { 642660,1703300 } },
  1003. { { 642660,1703300 }, { 643620,1704140 } },
  1004. { { 643620,1704140 }, { 646300,1707000 } },
  1005. { { 646300,1707000 }, { 649060,1710880 } },
  1006. { { 649060,1710880 }, { 651160,1714879 } },
  1007. { { 651160,1714879 }, { 651740,1716559 } },
  1008. { { 651740,1716559 }, { 653139,1722619 } },
  1009. { { 653139,1722619 }, { 653020,1728320 } },
  1010. { { 653020,1728320 }, { 652719,1731420 } },
  1011. { { 652719,1731420 }, { 651619,1736360 } },
  1012. { { 651619,1736360 }, { 649819,1743160 } },
  1013. { { 649819,1743160 }, { 646440,1749059 } },
  1014. { { 646440,1749059 }, { 645219,1750399 } },
  1015. { { 645219,1750399 }, { 643959,1752679 } },
  1016. { { 643959,1752679 }, { 643959,1753740 } },
  1017. { { 643959,1753740 }, { 642140,1754240 } },
  1018. { { 642140,1754240 }, { 643760,1754099 } },
  1019. { { 643760,1754099 }, { 644320,1754280 } },
  1020. { { 644320,1754280 }, { 645000,1754879 } },
  1021. { { 645000,1754879 }, { 646940,1755620 } },
  1022. { { 646940,1755620 }, { 654779,1757820 } },
  1023. { { 654779,1757820 }, { 661100,1761559 } },
  1024. { { 661100,1761559 }, { 664099,1763980 } },
  1025. { { 664099,1763980 }, { 668220,1768480 } },
  1026. { { 668220,1768480 }, { 671920,1773640 } },
  1027. { { 671920,1773640 }, { 674939,1779540 } },
  1028. { { 674939,1779540 }, { 677760,1782440 } },
  1029. { { 677760,1782440 }, { 679080,1785739 } },
  1030. { { 679080,1785739 }, { 678780,1788100 } },
  1031. { { 678780,1788100 }, { 678020,1791500 } },
  1032. { { 678020,1791500 }, { 677120,1793600 } },
  1033. { { 677120,1793600 }, { 676860,1795800 } },
  1034. { { 676860,1795800 }, { 676440,1797320 } },
  1035. { { 676440,1797320 }, { 676459,1798519 } },
  1036. { { 676459,1798519 }, { 675620,1800159 } },
  1037. { { 675620,1800159 }, { 675520,1801019 } },
  1038. { { 675520,1801019 }, { 673360,1804899 } },
  1039. { { 673360,1804899 }, { 672740,1807079 } },
  1040. { { 672740,1807079 }, { 673300,1809260 } },
  1041. { { 673300,1809260 }, { 674539,1811019 } },
  1042. { { 674539,1811019 }, { 675499,1812020 } },
  1043. { { 675499,1812020 }, { 677660,1817240 } },
  1044. { { 677660,1817240 }, { 679659,1824280 } },
  1045. { { 679659,1824280 }, { 680380,1828779 } },
  1046. { { 680380,1828779 }, { 679519,1837999 } },
  1047. { { 679519,1837999 }, { 677940,1844379 } },
  1048. { { 677940,1844379 }, { 676940,1846900 } },
  1049. { { 676940,1846900 }, { 675479,1849379 } },
  1050. { { 675479,1849379 }, { 674000,1851200 } },
  1051. { { 674000,1851200 }, { 671380,1853480 } },
  1052. { { 671380,1853480 }, { 667019,1855240 } },
  1053. { { 667019,1855240 }, { 662540,1856060 } },
  1054. { { 662540,1856060 }, { 660960,1856599 } },
  1055. { { 660960,1856599 }, { 656240,1857020 } },
  1056. { { 656240,1857020 }, { 655600,1856960 } },
  1057. { { 655600,1856960 }, { 652839,1855880 } },
  1058. { { 652839,1855880 }, { 652019,1855840 } },
  1059. { { 652019,1855840 }, { 651459,1855060 } },
  1060. { { 651459,1855060 }, { 652179,1854359 } },
  1061. { { 652179,1854359 }, { 652019,1849919 } },
  1062. { { 652019,1849919 }, { 650620,1846920 } },
  1063. { { 650620,1846920 }, { 647299,1844540 } },
  1064. { { 647299,1844540 }, { 644500,1843819 } },
  1065. { { 644500,1843819 }, { 641860,1844859 } },
  1066. { { 641860,1844859 }, { 641059,1845340 } },
  1067. { { 641059,1845340 }, { 638860,1845820 } },
  1068. { { 638860,1845820 }, { 638000,1845820 } },
  1069. { { 638000,1845820 }, { 636340,1845479 } },
  1070. { { 636340,1845479 }, { 634980,1844800 } },
  1071. { { 634980,1844800 }, { 632660,1842979 } },
  1072. { { 632660,1842979 }, { 631140,1841120 } },
  1073. { { 631140,1841120 }, { 629140,1839520 } },
  1074. { { 629140,1839520 }, { 626640,1839540 } },
  1075. { { 626640,1839540 }, { 624159,1840739 } },
  1076. { { 624159,1840739 }, { 623820,1841380 } },
  1077. { { 623820,1841380 }, { 622440,1842719 } },
  1078. { { 622440,1842719 }, { 622100,1843680 } },
  1079. { { 622100,1843680 }, { 623780,1846100 } },
  1080. { { 623780,1846100 }, { 624580,1846920 } },
  1081. { { 624580,1846920 }, { 626120,1856720 } },
  1082. { { 626120,1856720 }, { 627440,1860000 } },
  1083. { { 627440,1860000 }, { 628000,1864299 } },
  1084. { { 628000,1864299 }, { 627380,1865999 } },
  1085. { { 627380,1865999 }, { 626260,1867580 } },
  1086. { { 626260,1867580 }, { 623660,1869520 } },
  1087. { { 623660,1869520 }, { 618680,1872780 } },
  1088. { { 618680,1872780 }, { 617699,1873140 } },
  1089. { { 617699,1873140 }, { 612000,1874160 } },
  1090. { { 612000,1874160 }, { 609840,1874220 } },
  1091. { { 609840,1874220 }, { 606940,1873860 } },
  1092. { { 136680,1926960 }, { 135500,1926360 } },
  1093. { { 135500,1926360 }, { 137360,1923060 } },
  1094. { { 137360,1923060 }, { 139500,1918559 } },
  1095. { { 139500,1918559 }, { 140780,1913239 } },
  1096. { { 140780,1913239 }, { 139600,1913020 } },
  1097. { { 139600,1913020 }, { 127380,1923600 } },
  1098. { { 127380,1923600 }, { 122800,1926059 } },
  1099. { { 122800,1926059 }, { 118879,1927719 } },
  1100. { { 118879,1927719 }, { 114420,1928300 } },
  1101. { { 114420,1928300 }, { 111480,1927020 } },
  1102. { { 111480,1927020 }, { 110619,1925399 } },
  1103. { { 110619,1925399 }, { 109620,1924200 } },
  1104. { { 109620,1924200 }, { 108860,1922780 } },
  1105. { { 108860,1922780 }, { 108479,1920999 } },
  1106. { { 108479,1920999 }, { 106600,1918080 } },
  1107. { { 106600,1918080 }, { 106220,1917740 } },
  1108. { { 106220,1917740 }, { 105199,1916960 } },
  1109. { { 105199,1916960 }, { 101460,1914859 } },
  1110. { { 101460,1914859 }, { 99480,1914379 } },
  1111. { { 99480,1914379 }, { 97179,1913499 } },
  1112. { { 97179,1913499 }, { 94900,1911100 } },
  1113. { { 94900,1911100 }, { 94100,1909639 } },
  1114. { { 94100,1909639 }, { 93379,1907740 } },
  1115. { { 93379,1907740 }, { 93960,1898259 } },
  1116. { { 93960,1898259 }, { 93739,1896460 } },
  1117. { { 93739,1896460 }, { 94299,1893080 } },
  1118. { { 94299,1893080 }, { 97240,1883440 } },
  1119. { { 97240,1883440 }, { 99799,1879780 } },
  1120. { { 99799,1879780 }, { 100400,1878120 } },
  1121. { { 100400,1878120 }, { 100199,1877200 } },
  1122. { { 100199,1877200 }, { 98940,1877460 } },
  1123. { { 98940,1877460 }, { 96320,1878480 } },
  1124. { { 96320,1878480 }, { 86020,1881039 } },
  1125. { { 86020,1881039 }, { 84340,1881080 } },
  1126. { { 84340,1881080 }, { 76780,1882600 } },
  1127. { { 76780,1882600 }, { 74380,1883580 } },
  1128. { { 74380,1883580 }, { 72679,1884019 } },
  1129. { { 72679,1884019 }, { 70900,1885940 } },
  1130. { { 70900,1885940 }, { 71240,1888340 } },
  1131. { { 71240,1888340 }, { 72720,1889940 } },
  1132. { { 72720,1889940 }, { 74640,1891360 } },
  1133. { { 74640,1891360 }, { 75620,1893179 } },
  1134. { { 75620,1893179 }, { 77140,1895340 } },
  1135. { { 77140,1895340 }, { 81040,1899500 } },
  1136. { { 81040,1899500 }, { 82760,1900380 } },
  1137. { { 82760,1900380 }, { 83720,1902300 } },
  1138. { { 83720,1902300 }, { 85459,1903700 } },
  1139. { { 85459,1903700 }, { 86960,1905940 } },
  1140. { { 86960,1905940 }, { 88280,1913020 } },
  1141. { { 88280,1913020 }, { 88160,1913539 } },
  1142. { { 88160,1913539 }, { 88020,1913860 } },
  1143. { { 88020,1913860 }, { 86080,1915200 } },
  1144. { { 86080,1915200 }, { 85660,1916740 } },
  1145. { { 85660,1916740 }, { 83899,1918799 } },
  1146. { { 83899,1918799 }, { 79360,1921160 } },
  1147. { { 79360,1921160 }, { 76400,1923140 } },
  1148. { { 76400,1923140 }, { 70800,1926180 } },
  1149. { { 70800,1926180 }, { 64460,1927659 } },
  1150. { { 64460,1927659 }, { 60880,1927820 } },
  1151. { { 60880,1927820 }, { 55780,1925580 } },
  1152. { { 55780,1925580 }, { 54940,1925040 } },
  1153. { { 54940,1925040 }, { 52199,1921700 } },
  1154. { { 52199,1921700 }, { 49680,1916579 } },
  1155. { { 49680,1916579 }, { 48719,1914180 } },
  1156. { { 48719,1914180 }, { 48620,1913080 } },
  1157. { { 48620,1913080 }, { 47640,1909120 } },
  1158. { { 47640,1909120 }, { 48280,1899319 } },
  1159. { { 48280,1899319 }, { 49140,1895600 } },
  1160. { { 49140,1895600 }, { 50320,1892899 } },
  1161. { { 50320,1892899 }, { 51559,1890640 } },
  1162. { { 51559,1890640 }, { 52140,1889960 } },
  1163. { { 52140,1889960 }, { 54640,1887999 } },
  1164. { { 54640,1887999 }, { 55639,1886500 } },
  1165. { { 55639,1886500 }, { 55720,1885080 } },
  1166. { { 55720,1885080 }, { 55439,1883220 } },
  1167. { { 55439,1883220 }, { 54640,1882159 } },
  1168. { { 54640,1882159 }, { 54100,1880300 } },
  1169. { { 54100,1880300 }, { 52479,1874079 } },
  1170. { { 52479,1874079 }, { 51700,1869000 } },
  1171. { { 51700,1869000 }, { 51600,1865419 } },
  1172. { { 51600,1865419 }, { 51720,1859820 } },
  1173. { { 51720,1859820 }, { 52160,1857260 } },
  1174. { { 52160,1857260 }, { 52539,1856120 } },
  1175. { { 52539,1856120 }, { 57240,1845720 } },
  1176. { { 57240,1845720 }, { 58280,1844400 } },
  1177. { { 58280,1844400 }, { 60639,1840820 } },
  1178. { { 60639,1840820 }, { 65580,1835540 } },
  1179. { { 65580,1835540 }, { 68340,1833340 } },
  1180. { { 68340,1833340 }, { 71660,1831480 } },
  1181. { { 71660,1831480 }, { 73460,1829960 } },
  1182. { { 73460,1829960 }, { 75200,1829319 } },
  1183. { { 75200,1829319 }, { 77200,1828960 } },
  1184. { { 77200,1828960 }, { 78640,1828920 } },
  1185. { { 78640,1828920 }, { 111780,1842700 } },
  1186. { { 111780,1842700 }, { 112800,1843480 } },
  1187. { { 112800,1843480 }, { 113879,1844879 } },
  1188. { { 113879,1844879 }, { 116379,1847379 } },
  1189. { { 116379,1847379 }, { 116360,1847580 } },
  1190. { { 116360,1847580 }, { 117100,1848799 } },
  1191. { { 117100,1848799 }, { 120160,1851799 } },
  1192. { { 120160,1851799 }, { 121860,1852320 } },
  1193. { { 121860,1852320 }, { 124280,1852679 } },
  1194. { { 124280,1852679 }, { 128920,1854659 } },
  1195. { { 128920,1854659 }, { 130840,1856360 } },
  1196. { { 130840,1856360 }, { 133520,1859460 } },
  1197. { { 133520,1859460 }, { 135079,1860860 } },
  1198. { { 135079,1860860 }, { 137280,1864440 } },
  1199. { { 137280,1864440 }, { 142980,1872899 } },
  1200. { { 142980,1872899 }, { 144600,1875840 } },
  1201. { { 144600,1875840 }, { 147240,1883480 } },
  1202. { { 147240,1883480 }, { 147460,1886539 } },
  1203. { { 147460,1886539 }, { 147660,1886920 } },
  1204. { { 147660,1886920 }, { 148399,1891720 } },
  1205. { { 148399,1891720 }, { 148820,1896799 } },
  1206. { { 148820,1896799 }, { 148399,1898880 } },
  1207. { { 148399,1898880 }, { 148799,1899420 } },
  1208. { { 148799,1899420 }, { 150520,1898539 } },
  1209. { { 150520,1898539 }, { 154760,1892760 } },
  1210. { { 154760,1892760 }, { 156580,1889240 } },
  1211. { { 156580,1889240 }, { 156940,1888900 } },
  1212. { { 156940,1888900 }, { 157540,1889540 } },
  1213. { { 157540,1889540 }, { 156860,1896819 } },
  1214. { { 156860,1896819 }, { 155639,1903940 } },
  1215. { { 155639,1903940 }, { 153679,1908100 } },
  1216. { { 153679,1908100 }, { 152859,1909039 } },
  1217. { { 152859,1909039 }, { 149660,1915580 } },
  1218. { { 149660,1915580 }, { 148000,1918600 } },
  1219. { { 148000,1918600 }, { 141640,1926980 } },
  1220. { { 141640,1926980 }, { 140060,1927899 } },
  1221. { { 140060,1927899 }, { 136960,1929019 } },
  1222. { { 136960,1929019 }, { 136680,1926960 } },
  1223. { { 627100,1941519 }, { 625120,1940060 } },
  1224. { { 625120,1940060 }, { 614580,1934680 } },
  1225. { { 614580,1934680 }, { 608780,1929319 } },
  1226. { { 608780,1929319 }, { 607400,1927679 } },
  1227. { { 607400,1927679 }, { 606160,1925920 } },
  1228. { { 606160,1925920 }, { 604480,1922240 } },
  1229. { { 604480,1922240 }, { 602420,1916819 } },
  1230. { { 602420,1916819 }, { 602279,1915260 } },
  1231. { { 602279,1915260 }, { 602880,1907960 } },
  1232. { { 602880,1907960 }, { 604140,1902719 } },
  1233. { { 604140,1902719 }, { 605880,1898539 } },
  1234. { { 605880,1898539 }, { 606640,1897399 } },
  1235. { { 606640,1897399 }, { 609680,1894420 } },
  1236. { { 609680,1894420 }, { 611099,1893640 } },
  1237. { { 611099,1893640 }, { 616099,1890340 } },
  1238. { { 616099,1890340 }, { 617520,1889160 } },
  1239. { { 617520,1889160 }, { 620220,1885540 } },
  1240. { { 620220,1885540 }, { 624480,1882260 } },
  1241. { { 624480,1882260 }, { 628660,1880280 } },
  1242. { { 628660,1880280 }, { 632520,1879659 } },
  1243. { { 632520,1879659 }, { 637760,1879859 } },
  1244. { { 637760,1879859 }, { 640899,1881500 } },
  1245. { { 640899,1881500 }, { 644220,1883980 } },
  1246. { { 644220,1883980 }, { 643900,1890860 } },
  1247. { { 643900,1890860 }, { 643060,1894160 } },
  1248. { { 643060,1894160 }, { 642459,1900320 } },
  1249. { { 642459,1900320 }, { 642400,1903120 } },
  1250. { { 642400,1903120 }, { 643819,1908519 } },
  1251. { { 643819,1908519 }, { 644700,1912560 } },
  1252. { { 644700,1912560 }, { 644640,1916380 } },
  1253. { { 644640,1916380 }, { 644959,1918600 } },
  1254. { { 644959,1918600 }, { 642540,1925620 } },
  1255. { { 642540,1925620 }, { 642439,1926640 } },
  1256. { { 642439,1926640 }, { 641860,1928300 } },
  1257. { { 641860,1928300 }, { 638700,1932939 } },
  1258. { { 638700,1932939 }, { 634820,1934200 } },
  1259. { { 634820,1934200 }, { 631980,1936539 } },
  1260. { { 631980,1936539 }, { 630160,1940600 } },
  1261. { { 630160,1940600 }, { 627740,1941640 } },
  1262. { { 627740,1941640 }, { 627400,1941660 } },
  1263. { { 627400,1941660 }, { 627100,1941519 } }
  1264. };
  1265. #if 0
  1266. // Verify whether two any two non-neighbor line segments intersect. They should not, otherwise the Voronoi builder
  1267. // is not guaranteed to succeed.
  1268. for (size_t i = 0; i < lines.size(); ++ i)
  1269. for (size_t j = i + 1; j < lines.size(); ++ j) {
  1270. Point &ip1 = lines[i].a;
  1271. Point &ip2 = lines[i].b;
  1272. Point &jp1 = lines[j].a;
  1273. Point &jp2 = lines[j].b;
  1274. if (&ip1 != &jp2 && &jp1 != &ip2) {
  1275. REQUIRE(! Slic3r::Geometry::segments_intersect(ip1, ip2, jp1, jp2));
  1276. }
  1277. }
  1278. #endif
  1279. VD vd;
  1280. vd.construct_voronoi(lines.begin(), lines.end());
  1281. for (const auto& edge : vd.edges())
  1282. if (edge.is_finite()) {
  1283. auto v0 = edge.vertex0();
  1284. auto v1 = edge.vertex1();
  1285. REQUIRE((v0->x() == 0 || std::isnormal(v0->x())));
  1286. REQUIRE((v0->y() == 0 || std::isnormal(v0->y())));
  1287. REQUIRE((v1->x() == 0 || std::isnormal(v1->x())));
  1288. REQUIRE((v1->y() == 0 || std::isnormal(v1->y())));
  1289. }
  1290. #ifdef VORONOI_DEBUG_OUT
  1291. dump_voronoi_to_svg(debug_out_path("voronoi-NaNs.svg").c_str(),
  1292. vd, Points(), lines, Polygons(), Lines(), 0.015);
  1293. #endif
  1294. }
  1295. struct OffsetTest {
  1296. double distance;
  1297. size_t num_outer;
  1298. size_t num_inner;
  1299. };
  1300. TEST_CASE("Voronoi offset", "[VoronoiOffset]")
  1301. {
  1302. Polygons poly_with_hole = { Polygon {
  1303. { 0, 10000000},
  1304. { 700000, 0},
  1305. { 700000, 9000000},
  1306. { 9100000, 9000000},
  1307. { 9100000, 0},
  1308. {10000000, 10000000}
  1309. }
  1310. };
  1311. double area = std::accumulate(poly_with_hole.begin(), poly_with_hole.end(), 0., [](double a, auto &poly){ return a + poly.area(); });
  1312. REQUIRE(area > 0.);
  1313. VD vd;
  1314. Lines lines = to_lines(poly_with_hole);
  1315. vd.construct_voronoi(lines.begin(), lines.end());
  1316. for (const OffsetTest &ot : {
  1317. OffsetTest { scale_(0.2), 1, 1 },
  1318. OffsetTest { scale_(0.4), 1, 1 },
  1319. OffsetTest { scale_(0.5), 1, 2 },
  1320. OffsetTest { scale_(0.505), 1, 2 },
  1321. OffsetTest { scale_(0.51), 1, 2 },
  1322. OffsetTest { scale_(0.52), 1, 1 },
  1323. OffsetTest { scale_(0.53), 1, 1 },
  1324. OffsetTest { scale_(0.54), 1, 1 },
  1325. OffsetTest { scale_(0.55), 1, 0 }
  1326. }) {
  1327. #if 0
  1328. Polygons offsetted_polygons_out = Slic3r::Voronoi::offset(vd, lines, ot.distance, scale_(0.005));
  1329. #ifdef VORONOI_DEBUG_OUT
  1330. dump_voronoi_to_svg(debug_out_path("voronoi-offset-out-%lf.svg", ot.distance).c_str(),
  1331. vd, Points(), lines, offsetted_polygons_out);
  1332. #endif
  1333. REQUIRE(offsetted_polygons_out.size() == ot.num_outer);
  1334. #endif
  1335. Polygons offsetted_polygons_in = Slic3r::Voronoi::offset(vd, lines, - ot.distance, scale_(0.005));
  1336. #ifdef VORONOI_DEBUG_OUT
  1337. dump_voronoi_to_svg(debug_out_path("voronoi-offset-in-%lf.svg", ot.distance).c_str(),
  1338. vd, Points(), lines, offsetted_polygons_in);
  1339. #endif
  1340. REQUIRE(offsetted_polygons_in.size() == ot.num_inner);
  1341. }
  1342. }
  1343. TEST_CASE("Voronoi offset 2", "[VoronoiOffset]")
  1344. {
  1345. coord_t mm = coord_t(scale_(1.));
  1346. Polygons poly = {
  1347. Polygon {
  1348. { 0, 0 },
  1349. { 1, 0 },
  1350. { 1, 1 },
  1351. { 2, 1 },
  1352. { 2, 0 },
  1353. { 3, 0 },
  1354. { 3, 2 },
  1355. { 0, 2 }
  1356. },
  1357. Polygon {
  1358. { 0, - 1 - 2 },
  1359. { 3, - 1 - 2 },
  1360. { 3, - 1 - 0 },
  1361. { 2, - 1 - 0 },
  1362. { 2, - 1 - 1 },
  1363. { 1, - 1 - 1 },
  1364. { 1, - 1 - 0 },
  1365. { 0, - 1 - 0 }
  1366. },
  1367. };
  1368. for (Polygon &p : poly)
  1369. for (Point &pt : p.points)
  1370. pt *= mm;
  1371. double area = std::accumulate(poly.begin(), poly.end(), 0., [](double a, auto &poly){ return a + poly.area(); });
  1372. REQUIRE(area > 0.);
  1373. VD vd;
  1374. Lines lines = to_lines(poly);
  1375. vd.construct_voronoi(lines.begin(), lines.end());
  1376. for (const OffsetTest &ot : {
  1377. OffsetTest { scale_(0.2), 2, 2 },
  1378. OffsetTest { scale_(0.4), 2, 2 },
  1379. OffsetTest { scale_(0.45), 2, 2 },
  1380. OffsetTest { scale_(0.48), 2, 2 },
  1381. OffsetTest { scale_(0.5), 2, 4 },
  1382. OffsetTest { scale_(0.505), 2, 4 },
  1383. OffsetTest { scale_(0.7), 2, 0 },
  1384. OffsetTest { scale_(0.8), 1, 0 }
  1385. }) {
  1386. Polygons offsetted_polygons_out = Slic3r::Voronoi::offset(vd, lines, ot.distance, scale_(0.005));
  1387. #ifdef VORONOI_DEBUG_OUT
  1388. dump_voronoi_to_svg(debug_out_path("voronoi-offset2-out-%lf.svg", ot.distance).c_str(),
  1389. vd, Points(), lines, offsetted_polygons_out);
  1390. #endif
  1391. REQUIRE(offsetted_polygons_out.size() == ot.num_outer);
  1392. Polygons offsetted_polygons_in = Slic3r::Voronoi::offset(vd, lines, - ot.distance, scale_(0.005));
  1393. #ifdef VORONOI_DEBUG_OUT
  1394. dump_voronoi_to_svg(debug_out_path("voronoi-offset2-in-%lf.svg", ot.distance).c_str(),
  1395. vd, Points(), lines, offsetted_polygons_in);
  1396. #endif
  1397. REQUIRE(offsetted_polygons_in.size() == ot.num_inner);
  1398. }
  1399. }
  1400. TEST_CASE("Voronoi offset 3", "[VoronoiOffset]")
  1401. {
  1402. coord_t mm = coord_t(scale_(1.));
  1403. Polygons poly = {
  1404. Polygon {
  1405. { 0, 0 },
  1406. { 2, 0 },
  1407. { 2, 1 },
  1408. { 3, 1 },
  1409. { 3, 0 },
  1410. { 5, 0 },
  1411. { 5, 2 },
  1412. { 4, 2 },
  1413. { 4, 3 },
  1414. { 1, 3 },
  1415. { 1, 2 },
  1416. { 0, 2 }
  1417. },
  1418. Polygon {
  1419. { 0, -1 - 2 },
  1420. { 1, -1 - 2 },
  1421. { 1, -1 - 3 },
  1422. { 4, -1 - 3 },
  1423. { 4, -1 - 2 },
  1424. { 5, -1 - 2 },
  1425. { 5, -1 - 0 },
  1426. { 3, -1 - 0 },
  1427. { 3, -1 - 1 },
  1428. { 2, -1 - 1 },
  1429. { 2, -1 - 0 },
  1430. { 0, -1 - 0 }
  1431. },
  1432. };
  1433. for (Polygon &p : poly) {
  1434. REQUIRE(p.area() > 0.);
  1435. for (Point &pt : p.points)
  1436. pt *= mm;
  1437. }
  1438. VD vd;
  1439. Lines lines = to_lines(poly);
  1440. vd.construct_voronoi(lines.begin(), lines.end());
  1441. for (const OffsetTest &ot : {
  1442. OffsetTest { scale_(0.2), 2, 2 },
  1443. OffsetTest { scale_(0.4), 2, 2 },
  1444. OffsetTest { scale_(0.49), 2, 2 },
  1445. OffsetTest { scale_(0.5), 2, 2 },
  1446. OffsetTest { scale_(0.51), 2, 2 },
  1447. OffsetTest { scale_(0.56), 2, 2 },
  1448. OffsetTest { scale_(0.6), 2, 2 },
  1449. OffsetTest { scale_(0.7), 2, 2 },
  1450. OffsetTest { scale_(0.8), 1, 6 },
  1451. OffsetTest { scale_(0.9), 1, 6 },
  1452. OffsetTest { scale_(0.99), 1, 6 },
  1453. OffsetTest { scale_(1.0), 1, 0 },
  1454. OffsetTest { scale_(1.01), 1, 0 },
  1455. }) {
  1456. Polygons offsetted_polygons_out = Slic3r::Voronoi::offset(vd, lines, ot.distance, scale_(0.005));
  1457. #ifdef VORONOI_DEBUG_OUT
  1458. dump_voronoi_to_svg(debug_out_path("voronoi-offset3-out-%lf.svg", ot.distance).c_str(),
  1459. vd, Points(), lines, offsetted_polygons_out);
  1460. #endif
  1461. REQUIRE(offsetted_polygons_out.size() == ot.num_outer);
  1462. Polygons offsetted_polygons_in = Slic3r::Voronoi::offset(vd, lines, - ot.distance, scale_(0.005));
  1463. #ifdef VORONOI_DEBUG_OUT
  1464. dump_voronoi_to_svg(debug_out_path("voronoi-offset3-in-%lf.svg", ot.distance).c_str(),
  1465. vd, Points(), lines, offsetted_polygons_in);
  1466. #endif
  1467. REQUIRE(offsetted_polygons_in.size() == ot.num_inner);
  1468. }
  1469. }
  1470. TEST_CASE("Voronoi offset with edge collapse", "[VoronoiOffset4]")
  1471. {
  1472. Polygons poly
  1473. {
  1474. // Outer contour
  1475. {
  1476. { 434890, -64754575 },
  1477. { 541060, -64669076 },
  1478. { 585647, -64583538 },
  1479. { 576999, -64484233 },
  1480. { 485666, -64191173 },
  1481. { 1029323, -63646261 },
  1482. { 1416925, -63666243 },
  1483. { 1541532, -63643075 },
  1484. { 1541535, -63643075 },
  1485. { 1541535, -63643074 },
  1486. { 1552612, -63641015 },
  1487. { 1631609, -63568270 },
  1488. { 1678393, -63443639 },
  1489. { 1725519, -63219942 },
  1490. { 1770552, -62903321 },
  1491. { 1742544, -62755934 },
  1492. { 1758152, -62588378 },
  1493. { 1702289, -62474826 },
  1494. { 1638627, -62242058 },
  1495. { 1671281, -61938568 },
  1496. { 1792676, -61478332 },
  1497. { 1934894, -60760597 },
  1498. { 2160333, -60064089 },
  1499. { 2638183, -58972890 },
  1500. { 2933095, -58478536 },
  1501. { 3173586, -58159527 },
  1502. { 3557779, -57556727 },
  1503. { 3707088, -57158174 },
  1504. { 3758053, -56907139 },
  1505. { 3935932, -56278649 },
  1506. { 4077331, -56033426 },
  1507. { 4151386, -55768739 },
  1508. { 4293796, -55561683 },
  1509. { 4383089, -55387391 },
  1510. { 4614128, -55201443 },
  1511. { 5268755, -54333831 },
  1512. { 5547634, -53797296 },
  1513. { 5573864, -53639250 },
  1514. { 5736812, -53304157 },
  1515. { 6090973, -52066302 },
  1516. { 6148630, -51666664 },
  1517. { 6189511, -50974991 },
  1518. { 6244112, -50774489 },
  1519. { 6302489, -50761556 },
  1520. { 6511179, -50579861 },
  1521. { 6778128, -50398667 },
  1522. { 6896879, -50350264 },
  1523. { 7388259, -49913262 },
  1524. { 7630584, -49602449 },
  1525. { 7886846, -48987881 },
  1526. { 7871333, -48318666 },
  1527. { 7770349, -47841179 },
  1528. { 7570223, -47234733 },
  1529. { 7283115, -46705503 },
  1530. { 6842948, -46056539 },
  1531. { 6612732, -45760004 },
  1532. { 6150430, -44991494 },
  1533. { 5564326, -44168114 },
  1534. { 5193032, -43807544 },
  1535. { 4932097, -43489047 },
  1536. { 3857385, -42548846 },
  1537. { 3764745, -42081468 },
  1538. { 3539887, -41422273 },
  1539. { 3283048, -40803856 },
  1540. { 3005925, -40367981 },
  1541. { 3136185, -39834533 },
  1542. { 3333757, -38499972 },
  1543. { 3360660, -38183895 },
  1544. { 3353375, -38036005 },
  1545. { 3398808, -37582504 },
  1546. { 3604229, -37221781 },
  1547. { 3698079, -36962934 },
  1548. { 4000449, -36007804 },
  1549. { 4256811, -35016707 },
  1550. { 4405951, -34581428 },
  1551. { 4364534, -34178439 },
  1552. { 4124603, -33432250 },
  1553. { 3806159, -32765167 },
  1554. { 3359088, -32109020 },
  1555. { 2880790, -31317192 },
  1556. { 1548334, -30402139 },
  1557. { -7, -30131023 },
  1558. { -1548347, -30402139 },
  1559. { -2880803, -31317189 },
  1560. { -3359100, -32109018 },
  1561. { -3806173, -32765166 },
  1562. { -4124617, -33432248 },
  1563. { -4364548, -34178436 },
  1564. { -4405966, -34581423 },
  1565. { -4256825, -35016707 },
  1566. { -4000461, -36007800 },
  1567. { -3698093, -36962933 },
  1568. { -3604243, -37221781 },
  1569. { -3398823, -37582501 },
  1570. { -3353390, -38036003 },
  1571. { -3360675, -38183892 },
  1572. { -3333772, -38499972 },
  1573. { -3136200, -39834530 },
  1574. { -3005940, -40367980 },
  1575. { -3283062, -40803852 },
  1576. { -3539902, -41422273 },
  1577. { -3764761, -42081468 },
  1578. { -3857402, -42548846 },
  1579. { -4932112, -43489047 },
  1580. { -5193047, -43807544 },
  1581. { -5564341, -44168114 },
  1582. { -6150446, -44991494 },
  1583. { -6612748, -45760000 },
  1584. { -6842965, -46056536 },
  1585. { -7283130, -46705503 },
  1586. { -7570238, -47234733 },
  1587. { -7770365, -47841179 },
  1588. { -7871349, -48318666 },
  1589. { -7886860, -48987873 },
  1590. { -7630599, -49602451 },
  1591. { -7388277, -49913260 },
  1592. { -6896896, -50350264 },
  1593. { -6778145, -50398667 },
  1594. { -6511196, -50579862 },
  1595. { -6302504, -50761557 },
  1596. { -6244127, -50774488 },
  1597. { -6189527, -50974989 },
  1598. { -6148648, -51666664 },
  1599. { -6090990, -52066302 },
  1600. { -5736829, -53304157 },
  1601. { -5573882, -53639250 },
  1602. { -5547651, -53797296 },
  1603. { -5268772, -54333831 },
  1604. { -4614145, -55201443 },
  1605. { -4383106, -55387389 },
  1606. { -4293814, -55561683 },
  1607. { -4151404, -55768739 },
  1608. { -4077350, -56033423 },
  1609. { -3935952, -56278647 },
  1610. { -3758072, -56907137 },
  1611. { -3707107, -57158170 },
  1612. { -3557796, -57556727 },
  1613. { -3173605, -58159527 },
  1614. { -2933113, -58478536 },
  1615. { -2638201, -58972890 },
  1616. { -2295003, -59738435 },
  1617. { -2160353, -60064089 },
  1618. { -1978487, -60596626 },
  1619. { -1792695, -61478332 },
  1620. { -1671298, -61938574 },
  1621. { -1638646, -62242058 },
  1622. { -1702306, -62474826 },
  1623. { -1758168, -62588380 },
  1624. { -1742563, -62755934 },
  1625. { -1770570, -62903317 },
  1626. { -1725537, -63219946 },
  1627. { -1678412, -63443639 },
  1628. { -1631627, -63568270 },
  1629. { -1553479, -63640201 },
  1630. { -1416944, -63666243 },
  1631. { -998854, -63645714 },
  1632. { -485685, -64191173 },
  1633. { -577019, -64484225 },
  1634. { -585667, -64583538 },
  1635. { -541079, -64669076 },
  1636. { -434910, -64754575 },
  1637. { -294192, -64810609 },
  1638. { 294172, -64810609 },
  1639. },
  1640. // Hole 1
  1641. {
  1642. { -842246, -45167428 },
  1643. { -1473641, -45154392 },
  1644. { -2181728, -45100161 },
  1645. { -2804308, -44985842 },
  1646. { -3100514, -44879269 },
  1647. { -3836807, -44802155 },
  1648. { -4035816, -44718913 },
  1649. { -4167175, -44583299 },
  1650. { -4496705, -44467674 },
  1651. { -4486674, -44382045 },
  1652. { -4343949, -44070577 },
  1653. { -3740991, -43494686 },
  1654. { -2701372, -43313358 },
  1655. { -1493599, -43312838 },
  1656. { -8, -43352868 },
  1657. { 1414575, -43313336 },
  1658. { 2701358, -43313358 },
  1659. { 3095462, -43374735 },
  1660. { 3740975, -43494686 },
  1661. { 4343934, -44070583 },
  1662. { 4486657, -44382044 },
  1663. { 4496688, -44467670 },
  1664. { 4167159, -44583300 },
  1665. { 4035800, -44718913 },
  1666. { 3836792, -44802155 },
  1667. { 3100498, -44879269 },
  1668. { 2804292, -44985842 },
  1669. { 2181712, -45100161 },
  1670. { 1473625, -45154389 },
  1671. { 842231, -45167428 },
  1672. { -8, -45232686 },
  1673. },
  1674. // Hole 2
  1675. {
  1676. { 1657455, -63016679 },
  1677. { 1723196, -63056286 },
  1678. { 1541535, -63643074 },
  1679. { 1541532, -63643075 },
  1680. { 1030020, -63645562 },
  1681. }
  1682. };
  1683. VD vd;
  1684. Lines lines = to_lines(poly);
  1685. vd.construct_voronoi(lines.begin(), lines.end());
  1686. for (const OffsetTest &ot : {
  1687. OffsetTest { scale_(0.2), 2, 2 },
  1688. OffsetTest { scale_(0.4), 2, 2 },
  1689. OffsetTest { scale_(0.49), 2, 3 },
  1690. OffsetTest { scale_(0.51), 2, 2 },
  1691. OffsetTest { scale_(0.56), 2, 2 },
  1692. OffsetTest { scale_(0.6), 2, 2 },
  1693. OffsetTest { scale_(0.7), 2, 2 },
  1694. OffsetTest { scale_(0.8), 2, 2 },
  1695. OffsetTest { scale_(0.9), 2, 2 },
  1696. OffsetTest { scale_(0.99), 1, 2 },
  1697. OffsetTest { scale_(1.0), 1, 2 },
  1698. OffsetTest { scale_(1.01), 1, 2 },
  1699. }) {
  1700. Polygons offsetted_polygons_out = Slic3r::Voronoi::offset(vd, lines, ot.distance, scale_(0.005));
  1701. #ifdef VORONOI_DEBUG_OUT
  1702. dump_voronoi_to_svg(debug_out_path("voronoi-offset3-out-%lf.svg", ot.distance).c_str(),
  1703. vd, Points(), lines, offsetted_polygons_out);
  1704. #endif
  1705. REQUIRE(offsetted_polygons_out.size() == ot.num_outer);
  1706. Polygons offsetted_polygons_in = Slic3r::Voronoi::offset(vd, lines, - ot.distance, scale_(0.005));
  1707. #ifdef VORONOI_DEBUG_OUT
  1708. dump_voronoi_to_svg(debug_out_path("voronoi-offset3-in-%lf.svg", ot.distance).c_str(),
  1709. vd, Points(), lines, offsetted_polygons_in);
  1710. #endif
  1711. REQUIRE(offsetted_polygons_in.size() == ot.num_inner);
  1712. }
  1713. }
  1714. // A sample extracted from file medallion_printable_fixed-teeth.stl from https://www.thingiverse.com/thing:1347129
  1715. // This test for offset scale_(2.9) and bigger
  1716. // triggers assert(r < std::max(d0, d1) + EPSILON) in function first_circle_segment_intersection_parameter.
  1717. TEST_CASE("Voronoi offset 5", "[VoronoiOffset5]")
  1718. {
  1719. Polygons poly = {
  1720. Polygon {
  1721. { 0 , -16077501 },
  1722. { 3015222 , -16142836 },
  1723. { 3072642 , -16138163 },
  1724. { 3094279 , -16105662 },
  1725. { 3110660 , -15140728 },
  1726. { 3157438 , -14105326 },
  1727. { 3338367 , -11081394 },
  1728. { 3443412 , -8381621 },
  1729. { 3472489 , -6084497 },
  1730. { 3445790 , -5962924 },
  1731. { 3061725 , -6003484 },
  1732. { 3030326 , -6030622 },
  1733. { 2989343 , -6270378 },
  1734. { 2903752 , -7368176 },
  1735. { 2856704 , -7740619 },
  1736. { 2795743 , -7978809 },
  1737. { 2729231 , -8098866 },
  1738. { 2666509 , -8131138 },
  1739. { 2614169 , -8112308 },
  1740. { 2561157 , -8032014 },
  1741. { 2488290 , -7479351 },
  1742. { 2453360 , -6911556 },
  1743. { 2456148 , -6463146 },
  1744. { 2546029 , -4580396 },
  1745. { 2688181 , -2593262 },
  1746. { 2717617 , -1700519 },
  1747. { 2682232 , -1128411 },
  1748. { 2631029 , -832886 },
  1749. { 2535941 , -504483 },
  1750. { 2399115 , -199303 },
  1751. { 2290997 , -171213 },
  1752. { 611824 , -132865 },
  1753. { 6419 , -375849 },
  1754. { -611825 , -132865 },
  1755. { -2377355 , -185241 },
  1756. { -2420740 , -231171 },
  1757. { -2535942 , -504484 },
  1758. { -2631030 , -832887 },
  1759. { -2684831 , -1150821 },
  1760. { -2714840 , -1586454 },
  1761. { -2688181 , -2593262 },
  1762. { -2546030 , -4580396 },
  1763. { -2456149 , -6463145 },
  1764. { -2453361 , -6911557 },
  1765. { -2488291 , -7479352 },
  1766. { -2561159 , -8032018 },
  1767. { -2614171 , -8112309 },
  1768. { -2666509 , -8131138 },
  1769. { -2729233 , -8098868 },
  1770. { -2795744 , -7978809 },
  1771. { -2856706 , -7740619 },
  1772. { -2903752 , -7368176 },
  1773. { -2989345 , -6270378 },
  1774. { -3030327 , -6030622 },
  1775. { -3061726 , -6003484 },
  1776. { -3445790 , -5962924 },
  1777. { -3472490 , -6084498 },
  1778. { -3468804 , -7244095 },
  1779. { -3399287 , -9714025 },
  1780. { -3338368 , -11081395 },
  1781. { -3141015 , -14446051 },
  1782. { -3094280 , -16105662 },
  1783. { -3072643 , -16138163 },
  1784. { -3008836 , -16143225 }
  1785. }
  1786. };
  1787. double area = std::accumulate(poly.begin(), poly.end(), 0., [](double a, auto &poly){ return a + poly.area(); });
  1788. REQUIRE(area > 0.);
  1789. VD vd;
  1790. Lines lines = to_lines(poly);
  1791. vd.construct_voronoi(lines.begin(), lines.end());
  1792. for (const OffsetTest &ot : {
  1793. OffsetTest { scale_(2.8), 1, 1 },
  1794. OffsetTest { scale_(2.9), 1, 1 },
  1795. OffsetTest { scale_(3.0), 1, 1 },
  1796. }) {
  1797. Polygons offsetted_polygons_out = Slic3r::Voronoi::offset(vd, lines, ot.distance, scale_(0.005));
  1798. #ifdef VORONOI_DEBUG_OUT
  1799. dump_voronoi_to_svg(debug_out_path("voronoi-offset5-out-%lf.svg", ot.distance).c_str(),
  1800. vd, Points(), lines, offsetted_polygons_out);
  1801. #endif
  1802. REQUIRE(offsetted_polygons_out.size() == ot.num_outer);
  1803. Polygons offsetted_polygons_in = Slic3r::Voronoi::offset(vd, lines, - ot.distance, scale_(0.005));
  1804. #ifdef VORONOI_DEBUG_OUT
  1805. dump_voronoi_to_svg(debug_out_path("voronoi-offset5-in-%lf.svg", ot.distance).c_str(),
  1806. vd, Points(), lines, offsetted_polygons_in);
  1807. #endif
  1808. REQUIRE(offsetted_polygons_in.size() == ot.num_inner);
  1809. }
  1810. }
  1811. TEST_CASE("Voronoi skeleton", "[VoronoiSkeleton]")
  1812. {
  1813. coord_t mm = coord_t(scale_(1.));
  1814. Polygons poly = {
  1815. Polygon {
  1816. { 0, 0 },
  1817. { 1, 0 },
  1818. { 1, 1 },
  1819. { 2, 1 },
  1820. { 2, 0 },
  1821. { 3, 0 },
  1822. { 3, 2 },
  1823. { 0, 2 }
  1824. },
  1825. Polygon {
  1826. { 0, - 1 - 2 },
  1827. { 3, - 1 - 2 },
  1828. { 3, - 1 - 0 },
  1829. { 2, - 1 - 0 },
  1830. { 2, - 1 - 1 },
  1831. { 1, - 1 - 1 },
  1832. { 1, - 1 - 0 },
  1833. { 0, - 1 - 0 }
  1834. },
  1835. };
  1836. for (Polygon &p : poly)
  1837. for (Point &pt : p.points)
  1838. pt *= mm;
  1839. double area = std::accumulate(poly.begin(), poly.end(), 0., [](double a, auto &poly){ return a + poly.area(); });
  1840. REQUIRE(area > 0.);
  1841. VD vd;
  1842. Lines lines = to_lines(poly);
  1843. vd.construct_voronoi(lines.begin(), lines.end());
  1844. Slic3r::Voronoi::annotate_inside_outside(vd, lines);
  1845. static constexpr double threshold_alpha = M_PI / 12.; // 30 degrees
  1846. std::vector<Vec2d> skeleton_edges = Slic3r::Voronoi::skeleton_edges_rough(vd, lines, threshold_alpha);
  1847. REQUIRE(! skeleton_edges.empty());
  1848. }
  1849. // This case is composed of one square polygon, and one of the edges is divided into two parts by a point that lies on this edge.
  1850. // In some applications, this point is unnecessary and can be removed (merge two parts to one edge). But for the case of
  1851. // multi-material segmentation, these points are necessary. In this case, Voronoi vertex for the point, which divides the edge
  1852. // into two parts. Even we add more points to the edge, and then for these points, the Voronoin vertex is also missing. An
  1853. // infinity-edge passes through the missing Voronoi vertex. Therefore, this missing Voronoi vertex and edge can be reconstructed
  1854. // using the intersection between the infinity-edge with the input polygon.
  1855. // Rotation of the polygon solves this problem.
  1856. TEST_CASE("Voronoi missing vertex 1", "[VoronoiMissingVertex1]")
  1857. {
  1858. Polygon poly = {
  1859. { 25000000, 25000000},
  1860. {-25000000, 25000000},
  1861. {-25000000, -25000000},
  1862. {-12412500, -25000000},
  1863. { 25000000, -25000000}
  1864. };
  1865. REQUIRE(poly.area() > 0.);
  1866. REQUIRE(intersecting_edges({poly}).empty());
  1867. VD vd;
  1868. Lines lines = to_lines(poly);
  1869. vd.construct_voronoi(lines.begin(), lines.end());
  1870. #ifdef VORONOI_DEBUG_OUT
  1871. dump_voronoi_to_svg(debug_out_path("voronoi-missing-vertex1-out.svg").c_str(), vd, Points(), lines);
  1872. #endif
  1873. REQUIRE(vd.is_valid());
  1874. }
  1875. // This case is composed of two square polygons (contour and hole), and again one of the edges is divided into two parts by a
  1876. // point that lies on this edge, and for this point is Voronoi vertex missing. A difference between the previous and this case is
  1877. // that for this case, through the missing Voronoi vertex is passing a finite edge between two internal Voronoin vertices.
  1878. // Therefore, this missing Voronoi vertex and edge can be reconstructed using the intersection between the finite edge with the
  1879. // input polygon.
  1880. // Rotation of the polygons solves this problem.
  1881. TEST_CASE("Voronoi missing vertex 2", "[VoronoiMissingVertex2]")
  1882. {
  1883. Polygons poly = {
  1884. Polygon {
  1885. { 50000000, 50000000},
  1886. {-50000000, 50000000},
  1887. {-50000000, -50000000},
  1888. { 50000000, -50000000},
  1889. },
  1890. Polygon {
  1891. {-45000000, -45000000},
  1892. {-45000000, 45000000},
  1893. { 45000000, 45000000},
  1894. { 45000000, 8280000},
  1895. { 45000000, -45000000},
  1896. }
  1897. };
  1898. double area = std::accumulate(poly.begin(), poly.end(), 0., [](double a, auto &poly) { return a + poly.area(); });
  1899. REQUIRE(area > 0.);
  1900. REQUIRE(intersecting_edges(poly).empty());
  1901. VD vd;
  1902. Lines lines = to_lines(poly);
  1903. vd.construct_voronoi(lines.begin(), lines.end());
  1904. #ifdef VORONOI_DEBUG_OUT
  1905. dump_voronoi_to_svg(debug_out_path("voronoi-missing-vertex2-out.svg").c_str(), vd, Points(), lines);
  1906. #endif
  1907. REQUIRE(vd.is_valid());
  1908. }
  1909. // This case is composed of two polygons, and again one of the edges is divided into two parts by a point that lies on this edge,
  1910. // and for this point is Voronoi vertex missing. A difference between the previous cases and this case through the missing
  1911. // Voronoi vertex is passing finite edge between one inner Voronoi vertex and one outer Voronoi vertex.
  1912. // Rotating the polygon also help solve this problem.
  1913. TEST_CASE("Voronoi missing vertex 3", "[VoronoiMissingVertex3]")
  1914. {
  1915. Polygons poly = {
  1916. Polygon {
  1917. {-29715088, -29310899},
  1918. {-29022573, -28618384},
  1919. {-27771147, -27366958},
  1920. {-28539221, -26519393},
  1921. {-30619013, -28586348},
  1922. {-29812018, -29407830},
  1923. },
  1924. Polygon {
  1925. {-27035112, -28071875},
  1926. {-27367482, -27770679},
  1927. {-28387008, -28790205},
  1928. {-29309438, -29712635},
  1929. {-29406319, -29809515},
  1930. {-29032985, -30179156},
  1931. }
  1932. };
  1933. double area = std::accumulate(poly.begin(), poly.end(), 0., [](double a, auto &poly){ return a + poly.area(); });
  1934. REQUIRE(area > 0.);
  1935. REQUIRE(intersecting_edges(poly).empty());
  1936. VD vd;
  1937. Lines lines = to_lines(poly);
  1938. vd.construct_voronoi(lines.begin(), lines.end());
  1939. #ifdef VORONOI_DEBUG_OUT
  1940. dump_voronoi_to_svg(debug_out_path("voronoi-missing-vertex3-out.svg").c_str(), vd, Points(), lines);
  1941. #endif
  1942. REQUIRE(vd.is_valid());
  1943. }
  1944. TEST_CASE("Voronoi missing vertex 4", "[VoronoiMissingVertex4]")
  1945. {
  1946. // Probably the reason why Voronoi vertex is missing is that 19299999 and 19300000 are very close.
  1947. Polygon polygon_1 = {
  1948. Point(27000000, -18900000),
  1949. Point(27000000, 20000000),
  1950. Point(19000000, 20000000),
  1951. Point(19000000, 19299999),
  1952. Point(26000000, -18000000),
  1953. Point(-19000000, -18000000),
  1954. Point(-27000000, 19300000),
  1955. Point(-19000000, 19300000),
  1956. Point(-19000000, 20000000),
  1957. Point(-28000000, 20000000),
  1958. Point(-20000000, -18900000),
  1959. };
  1960. // Maybe this is the same case as the previous, but the missing Voronoi vertex is different.
  1961. Polygon polygon_2 = {
  1962. Point(27000000, -18900000),
  1963. Point(27000000, 20000000),
  1964. Point(19000000, 20000000),
  1965. Point(19000000, 19299999),
  1966. Point(19000000, -18000000), // Just this point is different other points are the same as previous.
  1967. Point(-19000000, -18000000),
  1968. Point(-27000000, 19300000),
  1969. Point(-19000000, 19300000),
  1970. Point(-19000000, 20000000),
  1971. Point(-28000000, 20000000),
  1972. Point(-20000000, -18900000),
  1973. };
  1974. Geometry::VoronoiDiagram vd_1;
  1975. Geometry::VoronoiDiagram vd_2;
  1976. Lines lines_1 = to_lines(polygon_1);
  1977. Lines lines_2 = to_lines(polygon_2);
  1978. vd_1.construct_voronoi(lines_1.begin(), lines_1.end());
  1979. vd_2.construct_voronoi(lines_2.begin(), lines_2.end());
  1980. #ifdef VORONOI_DEBUG_OUT
  1981. dump_voronoi_to_svg(debug_out_path("voronoi-missing-vertex4-1-out.svg").c_str(), vd_1, Points(), lines_1);
  1982. dump_voronoi_to_svg(debug_out_path("voronoi-missing-vertex4-2-out.svg").c_str(), vd_2, Points(), lines_2);
  1983. #endif
  1984. REQUIRE(vd_1.is_valid());
  1985. REQUIRE(vd_2.is_valid());
  1986. }
  1987. // In this case, the Voronoi vertex (146873, -146873) is included twice.
  1988. // Also, near to those duplicate Voronoi vertices is another Voronoi vertex (146872, -146872).
  1989. // Rotating the polygon will help solve this problem, but then there arise three very close Voronoi vertices.
  1990. // Rotating of the input polygon will help solve this problem.
  1991. TEST_CASE("Duplicate Voronoi vertices", "[Voronoi]")
  1992. {
  1993. Polygon poly = {
  1994. { 25000000, 25000000},
  1995. {-25000000, 25000000},
  1996. {-25000000, -25000000},
  1997. { 146872, -25000000},
  1998. { 9912498, -25000000},
  1999. { 25000000, -25000000},
  2000. { 25000000, - 8056252},
  2001. { 25000000, - 146873},
  2002. { 25000000, 10790627},
  2003. };
  2004. REQUIRE(poly.area() > 0.);
  2005. REQUIRE(intersecting_edges({poly}).empty());
  2006. VD vd;
  2007. Lines lines = to_lines(poly);
  2008. vd.construct_voronoi(lines.begin(), lines.end());
  2009. #ifdef VORONOI_DEBUG_OUT
  2010. dump_voronoi_to_svg(debug_out_path("voronoi-duplicate-vertices-out.svg").c_str(), vd, Points(), lines);
  2011. #endif
  2012. REQUIRE(vd.is_valid());
  2013. }
  2014. // In this case, there are three very close Voronoi vertices like in the previous test case after rotation. There is also one
  2015. // missing Voronoi vertex. One infinity-edge (after clip [(146872, -70146871), (146872, -146871)]) passes through this missing
  2016. // Voronoi vertex. This infinite edge [(146872, -70146871), (146872, -146871)] and edge [(146873, -146873), (0, 0)] are intersecting.
  2017. // They intersect probably because the three points are very close to each other, with a combination of the missing Voronoi vertex.
  2018. // Rotating of the input polygon will help solve this problem.
  2019. TEST_CASE("Intersecting Voronoi edges", "[Voronoi]")
  2020. {
  2021. Polygon poly = {
  2022. { 25000000, 25000000},
  2023. {-25000000, 25000000},
  2024. {-25000000, -25000000},
  2025. { 146872, -25000000},
  2026. { 25000000, -25000000},
  2027. { 25000000, - 146873},
  2028. };
  2029. REQUIRE(poly.area() > 0.);
  2030. REQUIRE(intersecting_edges({poly}).empty());
  2031. VD vd;
  2032. Lines lines = to_lines(poly);
  2033. vd.construct_voronoi(lines.begin(), lines.end());
  2034. #ifdef VORONOI_DEBUG_OUT
  2035. dump_voronoi_to_svg(debug_out_path("voronoi-intersecting-edges-out.svg").c_str(), vd, Points(), lines);
  2036. #endif
  2037. REQUIRE(vd.is_valid());
  2038. }
  2039. // In this case resulting Voronoi diagram is not planar. This case was distilled from GH issue #8474.
  2040. // Also, in GH issue #8514, a non-planar Voronoi diagram is generated for several polygons.
  2041. // Rotating the input polygon will solve this issue.
  2042. TEST_CASE("Non-planar voronoi diagram", "[VoronoiNonPlanar]")
  2043. {
  2044. Polygon poly {
  2045. { 5500000, -42000000},
  2046. { 8000000, -17000000},
  2047. { 8000000, 40000000},
  2048. { 7500000, 40000000},
  2049. { 7500000, -18000000},
  2050. { 6000001, -18000000},
  2051. { 6000000, 40000000},
  2052. { 5500000, 40000000},
  2053. };
  2054. REQUIRE(poly.area() > 0.);
  2055. REQUIRE(intersecting_edges({poly}).empty());
  2056. VD vd;
  2057. Lines lines = to_lines(poly);
  2058. vd.construct_voronoi(lines.begin(), lines.end());
  2059. #ifdef VORONOI_DEBUG_OUT
  2060. dump_voronoi_to_svg(debug_out_path("voronoi-non-planar-out.svg").c_str(), vd, Points(), lines);
  2061. #endif
  2062. REQUIRE(vd.is_valid());
  2063. }
  2064. // This case is extracted from SPE-1729, where several ExPolygon with very thin lines
  2065. // and holes formed by very close (1-5nm) vertices that are on the edge of our resolution.
  2066. // Those thin lines and holes are both unprintable and cause the Voronoi diagram to be invalid.
  2067. TEST_CASE("Invalid Voronoi diagram - Thin lines - SPE-1729", "[InvalidVoronoiDiagramThinLinesSPE1729]")
  2068. {
  2069. Polygon contour = {
  2070. {32247689, -2405501},
  2071. {32247733, -2308514},
  2072. {32247692, -2405496},
  2073. {50484384, 332941},
  2074. {50374839, 1052546},
  2075. {32938040, -1637993},
  2076. {32938024, -1673788},
  2077. {32942107, 7220481},
  2078. {32252205, 7447599},
  2079. {32252476, 8037808},
  2080. {32555965, 8277599},
  2081. {17729260, 8904718},
  2082. {17729236, 8853233},
  2083. {17729259, 8904722},
  2084. {17039259, 8935481},
  2085. {17033440, -3880421},
  2086. {17204385, -3852156},
  2087. {17723645, -3441873},
  2088. {17723762, -3187210},
  2089. {17728957, 8240730},
  2090. {17728945, 8213866},
  2091. {31716233, 7614090},
  2092. {20801623, -1009882},
  2093. {21253963, -1580792},
  2094. {32252082, 7157187},
  2095. {32248022, -1673787},
  2096. {24245653, -2925506},
  2097. {18449246, -3809095},
  2098. {18728385, -4449246}
  2099. };
  2100. Polygon hole = {
  2101. {32247789, -2181284},
  2102. {32247870, -2003865},
  2103. {32247872, -2003866},
  2104. {32247752, -2267007}
  2105. };
  2106. Polygons polygons = {contour, hole};
  2107. VD vd;
  2108. Lines lines = to_lines(polygons);
  2109. vd.construct_voronoi(lines.begin(), lines.end());
  2110. #ifdef VORONOI_DEBUG_OUT
  2111. dump_voronoi_to_svg(debug_out_path("invalid-voronoi-diagram-thin-lines.svg").c_str(), vd, Points(), lines);
  2112. #endif
  2113. // REQUIRE(vd.is_valid());
  2114. }
  2115. TEST_CASE("Voronoi cell doesn't contain a source point - SPE-2298", "[VoronoiCellSourcePointSPE2298]")
  2116. {
  2117. Polygon polygon = {
  2118. { 9854534, -39739718}, {- 4154002, -34864557}, {-13073118, -31802214},
  2119. {-21265508, -29026626}, {-31388055, -25645073}, {-32409943, -25279942},
  2120. {-33418087, -24864987}, {-34400568, -24404312}, {-35354754, -23899358},
  2121. {-36278795, -23351325}, {-37170015, -22762146}, {-38025776, -22134628},
  2122. {-38845825, -21468175}, {-39627905, -20764801}, {-40370549, -20026061},
  2123. {-41072075, -19253859}, {-41731000, -18450032}, {-42345940, -17616466},
  2124. {-42915530, -16755283}, {-43438684, -15868338}, {-43914245, -14957822},
  2125. {-44341235, -14025879}, {-44718686, -13074712}, {-45045890, -12106566},
  2126. {-45322386, -11123499}, {-45547674, -10127656}, {-45721021, - 9121581},
  2127. {-45842174, - 8107658}, {-45910990, - 7088089}, {-45927405, - 6065217},
  2128. {-45891432, - 5041288}, {-45803222, - 4018728}, {-45663042, - 2999801},
  2129. {-45471245, - 1986784}, {-45230690, - 991761}, {-38655400, 23513180},
  2130. {-38366034, 24494742}, {-38025334, 25467666}, {-37636844, 26420074},
  2131. {-37200678, 27349843}, {-36718169, 28254419}, {-36191104, 29131704},
  2132. {-35620587, 29979748}, {-35007621, 30796895}, {-34353751, 31580950},
  2133. {-33660293, 32330182}, {-32928806, 33042775}, {-32160862, 33717057},
  2134. {-31358104, 34351432}, {-30522331, 34944323}, {-29655434, 35494277},
  2135. {-28759338, 35999922}, {-27835963, 36460011}, {-26921721, 36858494},
  2136. {-25914008, 37239556}, {-24919466, 37557049}, {-24204878, 37746930},
  2137. {-22880526, 38041931}, {-21833362, 38209050}, {-21449204, 38252031},
  2138. {-20775657, 38324377}, {-19711119, 38387480}, {-18638667, 38398812},
  2139. {-17762260, 38366962}, {-16480321, 38266321}, {-15396213, 38120856},
  2140. {-14327987, 37925343}, {- 5801522, 36175494}, { 7791637, 33457589},
  2141. { 15887399, 31878986}, { 28428609, 29478881}, { 28438392, 29512722},
  2142. { 27850323, 29743358}, { 27058729, 29970066}, { 14135560, 32452875},
  2143. { 6101685, 34019760}, {- 5352362, 36305237}, {-14423391, 38160442},
  2144. {-15528705, 38361745}, {-16625379, 38507834}, {-17721787, 38600631},
  2145. {-18812787, 38641330}, {-19563804, 38633844}, {-20975692, 38563412},
  2146. {-22036069, 38446419}, {-23087710, 38277136}, {-24123993, 38056689},
  2147. {-25141240, 37786307}, {-26138324, 37466465}, {-26851801, 37197652},
  2148. {-28067514, 36680229}, {-28988984, 36219404}, {-29886302, 35711371},
  2149. {-30754551, 35158840}, {-31124518, 34896643}, {-31589528, 34564743},
  2150. {-32392776, 33928220}, {-33161225, 33251721}, {-33454722, 32966117},
  2151. {-33891684, 32538320}, {-34585318, 31787066}, {-35239508, 31000793},
  2152. {-35527715, 30616853}, {-35851756, 30182731}, {-36422833, 29331982},
  2153. {-36950377, 28452000}, {-37265788, 27860633}, {-37432874, 27545549},
  2154. {-37870512, 26612217}, {-38261423, 25655915}, {-38581885, 24744387},
  2155. {-38902507, 23671594}, {-45523689, - 1006672}, {-45770290, - 2026713},
  2156. {-45963584, - 3043930}, {-46104330, - 4066310}, {-46192377, - 5092635},
  2157. {-46228310, - 6120019}, {-46211987, - 7145807}, {-46143426, - 8167812},
  2158. {-46022719, - 9183674}, {-45850055, -10191399}, {-45625772, -11188531},
  2159. {-45350245, -12172975}, {-45023965, -13142600}, {-44647538, -14095222},
  2160. {-44221691, -15028602}, {-43747176, -15940794}, {-43224933, -16829570},
  2161. {-42655872, -17693052}, {-42041183, -18529065}, {-41381752, -19335983},
  2162. {-40677899, -20112975}, {-39932077, -20856972}, {-39145730, -21566171},
  2163. {-38320552, -22238686}, {-37458030, -22872953}, {-36560036, -23467217},
  2164. {-35627745, -24020614}, {-34662272, -24532977}, {-33667551, -25000722},
  2165. {-32645434, -25422669}, {-31588226, -25801077}, {-24380013, -28208306},
  2166. {-24380013, -28208306}, {-13354262, -31942517}, {-13354261, -31942515},
  2167. {-2032305, -35842454}, { 8025116, -39348505}, { 8820397, -39587703},
  2168. { 9636283, -39751794}, { 9847092, -39773278}};
  2169. VD vd;
  2170. Lines lines = to_lines(polygon);
  2171. vd.construct_voronoi(lines.begin(), lines.end());
  2172. #ifdef VORONOI_DEBUG_OUT
  2173. // dump_voronoi_to_svg(debug_out_path("voronoi-cell-source-point-spe2298.svg").c_str(), vd, Points(), lines);
  2174. #endif
  2175. REQUIRE(vd.is_valid());
  2176. }