@@ -60,34 +60,16 @@ tape('intersections', (test) => {
6060 test . equal ( r2 . length , 1 ) ;
6161
6262 // Minimally overlapping triangles
63+ // If useRound is false this produces a zero segment error!
6364 const t1 = new Polygon ( new Point ( 630.64 , 783.64 ) , new Point ( 655.64 , 826.941270189222 ) , new Point ( 680.64 , 783.64 ) ) ;
6465 const t2 = new Polygon ( new Point ( 630.64 , 783.6412701892219 ) , new Point ( 655.64 , 740.34 ) , new Point ( 680.64 , 783.6412701892219 ) ) ;
6566 const i1 = Polygon . intersection ( [ t1 , t2 ] , undefined , true ) ;
6667 test . equal ( i1 . length , 0 ) ;
6768
68- // Minimally overlapping rhombus
69- const rhom1 = new Polygon ( new Point ( 364.20573225037634 , 762.5778998441511 ) , new Point ( 393.594994865 , 803.0287495628985 ) , new Point ( 347.91772198287 , 782.6919174091084 ) , new Point ( 318.52845936824633 , 742.2410676903611 ) ) ;
70- const rhom2 = new Polygon ( new Point ( 350.29712442218573 , 828.024401212054 ) , new Point ( 300.29712442218573 , 828.024401212054 ) , new Point ( 343.5983946114076 , 803.024401212054 ) , new Point ( 393.5983946114076 , 803.024401212054 ) ) ;
71- const i2 = Polygon . intersection ( [ rhom1 , rhom2 ] , undefined , true ) ;
72- test . equal ( i2 [ 0 ] . area < .1 , true ) ;
73-
74- // Mostly overlapping rhombus
75- const rhom3 = new Polygon ( new Point ( 391.08895330967306 , 854.8726448020227 ) , new Point ( 393.7057511218203 , 804.941168064294 ) , new Point ( 416.40527610879764 , 849.4914942737123 ) , new Point ( 413.7884782966504 , 899.4229710114411 ) ) ;
76- const rhom4 = new Polygon ( new Point ( 390.9815967992604 , 852.9558779497828 ) , new Point ( 393.5983946114076 , 803.024401212054 ) , new Point ( 416.29791959838496 , 847.5747274214724 ) , new Point ( 413.6811217862377 , 897.5062041592012 ) ) ;
77- const i3 = Polygon . intersection ( [ rhom3 , rhom4 ] , undefined , true ) ;
78- test . equal ( i3 . length , 1 ) ;
79-
8069 test . end ( ) ;
8170} ) ;
8271
8372tape ( 'unions' , ( test ) => {
84- // In some configurations this throws a zero segment error.
85- const u1 = new Polygon ( new Point ( 1622.9 , 534.7 ) , new Point ( 1522.9 , 534.7 ) , new Point ( 1547.9 , 578 ) , new Point ( 1597.9 , 578 ) ) ;
86- const u2 = new Polygon ( new Point ( 1398.71 , 552.1512701892219 ) , new Point ( 1448.71 , 552.1512701892219 ) , new Point ( 1423.71 , 508.85 ) ) ;
87- const u3 = new Polygon ( new Point ( 1448.71 , 552.1487298107781 ) , new Point ( 1398.71 , 552.1487298107781 ) , new Point ( 1423.71 , 595.45 ) ) ;
88- const union = Polygon . union ( [ u1 , u2 , u3 ] , undefined , true ) ;
89- test . equal ( Math . abs ( total ( union . map ( u => u . area ) ) - ( u1 . area + u2 . area + u3 . area ) ) < 1 , true ) ;
90-
9173 // if you change useRound to true on this union it will produce a zero segment error.
9274 const polyList = [
9375 new Polygon ( new Point ( 1167.2641162274222 , 3633.834721294776 ) , new Point ( 1342.2641162274222 , 3330.7258299702225 ) , new Point ( 1167.2641162274222 , 3330.7258299702225 ) , new Point ( 1079.7641162274222 , 3482.2802756324995 ) ) ,
0 commit comments