Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weiler atherton clipping method #999

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
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))
juliohm marked this conversation as resolved.
Show resolved Hide resolved
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