|
9 | 9 |
|
10 | 10 | import clipper2.core.Path64; |
11 | 11 | import clipper2.core.Paths64; |
| 12 | +import clipper2.core.PathsD; |
12 | 13 | import clipper2.core.Point64; |
13 | 14 | import clipper2.core.PointD; |
14 | 15 | import clipper2.offset.ClipperOffset; |
@@ -237,6 +238,39 @@ void TestOffsets9() { // (#733) |
237 | 238 | assertEquals(0, solution.size()); |
238 | 239 | } |
239 | 240 |
|
| 241 | + @Test |
| 242 | + void TestOffsets10() { // see #715 |
| 243 | + Paths64 subjects = new Paths64(List.of(Clipper.MakePath(new long[] { 508685336, -435806096, 509492982, -434729201, 509615525, -434003092, 509615525, |
| 244 | + 493372891, 509206033, 494655198, 508129138, 495462844, 507403029, 495585387, -545800889, 495585387, -547083196, 495175895, -547890842, |
| 245 | + 494099000, -548013385, 493372891, -548013385, -434003092, -547603893, -435285399, -546526998, -436093045, -545800889, -436215588, 507403029, |
| 246 | + -436215588 }), Clipper.MakePath(new long[] { 106954765, -62914568, 106795129, -63717113, 106340524, -64397478, 105660159, -64852084, 104857613, |
| 247 | + -65011720, 104055068, -64852084, 103374703, -64397478, 102920097, -63717113, 102760461, -62914568, 102920097, -62112022, 103374703, |
| 248 | + -61431657, 104055068, -60977052, 104857613, -60817416, 105660159, -60977052, 106340524, -61431657, 106795129, -62112022 }))); |
| 249 | + |
| 250 | + ClipperOffset offseter = new ClipperOffset(2, 104857.61318750000); |
| 251 | + Paths64 solution = new Paths64(); |
| 252 | + offseter.AddPaths(subjects, JoinType.Round, EndType.Polygon); |
| 253 | + offseter.Execute(-2212495.6382562499, solution); |
| 254 | + assertEquals(2, solution.size()); |
| 255 | + } |
| 256 | + |
| 257 | + @Test |
| 258 | + void TestOffsets11() { // see #405 |
| 259 | + PathsD subject = new PathsD(); |
| 260 | + subject.add(Clipper.MakePath(new double[] { -1.0, -1.0, -1.0, 11.0, 11.0, 11.0, 11.0, -1.0 })); |
| 261 | + // offset polygon |
| 262 | + PathsD solution = Clipper.InflatePaths(subject, -50, JoinType.Miter, EndType.Polygon); |
| 263 | + assertTrue(solution.isEmpty()); |
| 264 | + } |
| 265 | + |
| 266 | + @Test |
| 267 | + void TestOffsets12() { // see #873 |
| 268 | + Paths64 subject = new Paths64(); |
| 269 | + subject.add(Clipper.MakePath(new long[] { 667680768, -36382704, 737202688, -87034880, 742581888, -86055680, 747603968, -84684800 })); |
| 270 | + Paths64 solution = Clipper.InflatePaths(subject, -249561088, JoinType.Miter, EndType.Polygon); |
| 271 | + assertTrue(solution.isEmpty()); |
| 272 | + } |
| 273 | + |
240 | 274 | private static Point64 midPoint(Point64 p1, Point64 p2) { |
241 | 275 | Point64 result = new Point64(); |
242 | 276 | result.setX((p1.x + p2.x) / 2); |
|
0 commit comments