|
2 | 2 | # triangle |
3 | 3 | poly = Triangle(cart(6, 2), cart(3, 5), cart(0, 2)) |
4 | 4 | other = Quadrangle(cart(5, 0), cart(5, 4), cart(0, 4), cart(0, 0)) |
5 | | - clipped = clip(poly, other, SutherlandHodgman()) |
| 5 | + clipped = clip(poly, other, SutherlandHodgmanClipping()) |
6 | 6 | @test issimple(clipped) |
7 | 7 | @test all(vertices(clipped) .≈ [cart(5, 3), cart(4, 4), cart(2, 4), cart(0, 2), cart(5, 2)]) |
8 | 8 |
|
9 | 9 | # octagon |
10 | 10 | poly = Octagon(cart(8, -2), cart(8, 5), cart(2, 5), cart(4, 3), cart(6, 3), cart(4, 1), cart(2, 1), cart(2, -2)) |
11 | 11 | other = Quadrangle(cart(5, 0), cart(5, 4), cart(0, 4), cart(0, 0)) |
12 | | - clipped = clip(poly, other, SutherlandHodgman()) |
| 12 | + clipped = clip(poly, other, SutherlandHodgmanClipping()) |
13 | 13 | @test !issimple(clipped) |
14 | 14 | @test all( |
15 | 15 | vertices(clipped) .≈ |
|
19 | 19 | # inside |
20 | 20 | poly = Quadrangle(cart(1, 0), cart(1, 1), cart(0, 1), cart(0, 0)) |
21 | 21 | other = Quadrangle(cart(5, 0), cart(5, 4), cart(0, 4), cart(0, 0)) |
22 | | - clipped = clip(poly, other, SutherlandHodgman()) |
| 22 | + clipped = clip(poly, other, SutherlandHodgmanClipping()) |
23 | 23 | @test issimple(clipped) |
24 | 24 | @test all(vertices(clipped) .≈ vertices(poly)) |
25 | 25 |
|
26 | 26 | # outside |
27 | 27 | poly = Quadrangle(cart(7, 6), cart(7, 7), cart(6, 7), cart(6, 6)) |
28 | 28 | other = Quadrangle(cart(5, 0), cart(5, 4), cart(0, 4), cart(0, 0)) |
29 | | - clipped = clip(poly, other, SutherlandHodgman()) |
| 29 | + clipped = clip(poly, other, SutherlandHodgmanClipping()) |
30 | 30 | @test isnothing(clipped) |
31 | 31 |
|
32 | 32 | # surrounded |
33 | 33 | poly = Hexagon(cart(0, 2), cart(-2, 2), cart(-2, 0), cart(0, -2), cart(2, -2), cart(2, 0)) |
34 | 34 | other = Hexagon(cart(1, 0), cart(0, 1), cart(-1, 1), cart(-1, 0), cart(0, -1), cart(1, -1)) |
35 | | - clipped = clip(poly, other, SutherlandHodgman()) |
| 35 | + clipped = clip(poly, other, SutherlandHodgmanClipping()) |
36 | 36 | @test issimple(clipped) |
37 | 37 | @test all(vertices(clipped) .≈ vertices(other)) |
38 | 38 |
|
|
41 | 41 | inner = Ring(cart(4, 4), cart(2, 4), cart(3, 6)) |
42 | 42 | poly = PolyArea([outer, inner]) |
43 | 43 | other = Box(cart(0, 1), cart(3, 7)) |
44 | | - clipped = clip(poly, other, SutherlandHodgman()) |
| 44 | + clipped = clip(poly, other, SutherlandHodgmanClipping()) |
45 | 45 | crings = rings(clipped) |
46 | 46 | @test !issimple(clipped) |
47 | 47 | @test all( |
|
55 | 55 | inner = Ring(cart(1, 3), cart(3, 3), cart(3, 1), cart(1, 1)) |
56 | 56 | poly = PolyArea([outer, inner]) |
57 | 57 | other = Quadrangle(cart(4, 4), cart(0, 4), cart(0, 0), cart(4, 0)) |
58 | | - clipped = clip(poly, other, SutherlandHodgman()) |
| 58 | + clipped = clip(poly, other, SutherlandHodgmanClipping()) |
59 | 59 | @test !issimple(clipped) |
60 | 60 | crings = rings(clipped) |
61 | 61 | @test all(vertices(crings[1]) .≈ vertices(other)) |
|
67 | 67 | inner₂ = Ring(cart(2, 5), cart(2, 6), cart(3, 5)) |
68 | 68 | poly = PolyArea([outer, inner₁, inner₂]) |
69 | 69 | other = PolyArea(Ring(cart(6, 1), cart(7, 2), cart(6, 5), cart(0, 2), cart(1, 1))) |
70 | | - clipped = clip(poly, other, SutherlandHodgman()) |
| 70 | + clipped = clip(poly, other, SutherlandHodgmanClipping()) |
71 | 71 | crings = rings(clipped) |
72 | 72 | @test !issimple(clipped) |
73 | 73 | @test length(crings) == 2 |
|
0 commit comments