|
| 1 | +@testset "Polygon" begin |
| 2 | + @testset "from points" begin |
| 3 | + points = connect([1, 2, 3, 4, 5, 6], PointPoint2f(2)) |
| 4 | + polygon = Polygon(points) |
| 5 | + @test polygon == Polygon(points) |
| 6 | + end |
| 7 | + |
| 8 | +end |
| 9 | + |
| 10 | +rect = Rect2f(0, 0, 1, 1) |
| 11 | +hole = Circle(Point2f(0.5), 0.2) |
| 12 | +poly2 = Polygon(decompose(Point2f, rect), [decompose(Point2f, hole)]) |
| 13 | +poly1 = Polygon(rect, [hole]) |
| 14 | +@test poly1 == poly2 |
| 15 | +@test poly.exterior == decompose(Point2f, rect) |
| 16 | +@test poly.interiors == [decompose(Point2f, hole)] |
| 17 | + |
| 18 | +faces(poly1) |
| 19 | + |
| 20 | +GeometryBasics.earcut_triangulate([poly.exterior[[1, 2, 3, 4, 1]]]) |
| 21 | + |
| 22 | +poly = [ |
| 23 | + [Point2f(100, 0), Point2f(100, 100), Point2f(0, 100), Point2f(0, 0)], |
| 24 | + # Following polylines define holes. |
| 25 | + [Point2f(75, 25), Point2f(75, 75), Point2f(25, 75), Point2f(25, 25)] |
| 26 | +] |
| 27 | + |
| 28 | +GeometryBasics.earcut_triangulate(poly) |
0 commit comments