Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions docs/src/algorithms/clipping.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,30 @@ other = Box((0,1), (3,7))
# clipped polygon
clipped = clip(poly, other, SutherlandHodgmanClipping())

viz(poly)
viz!(other, color = :black, alpha = 0.2)
viz!(boundary(clipped), color = :red, segmentsize = 3)
Mke.current_figure()
```

## Weiler-Atherton

```@docs
WeilerAthertonClipping
```

```@example clipping
# polygon to clip
outer = Ring((8, 0), (4, 8), (2, 8), (-2, 0), (0, 0), (1, 2), (5, 2), (6, 0))
inner = Ring((4, 4), (2, 4), (3, 6))
poly = PolyArea([outer, inner])

# clipping geometry
other = outer |> Rotate(π) |> Translate(8, 8)

# clipped polygon
clipped = clip(poly, other, WeilerAthertonClipping())

viz(poly)
viz!(other, color = :black, alpha = 0.2)
viz!(boundary(clipped), color = :red, segmentsize = 3)
Expand Down
1 change: 1 addition & 0 deletions src/Meshes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@ export
# clipping
ClippingMethod,
SutherlandHodgmanClipping,
WeilerAthertonClipping,
clip,

# intersections
Expand Down
1 change: 1 addition & 0 deletions src/clipping.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ function clip end
# ----------------

include("clipping/sutherlandhodgman.jl")
include("clipping/weileratherton.jl")
Loading