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

Add Sutherland–Hodgman VPolygon intersection algorithm #2345

Merged
merged 9 commits into from
Aug 25, 2020
Merged

Conversation

mforets
Copy link
Member

@mforets mforets commented Aug 24, 2020

src/ConcreteOperations/intersection.jl Outdated Show resolved Hide resolved
src/ConcreteOperations/intersection.jl Show resolved Hide resolved
src/ConcreteOperations/intersection.jl Outdated Show resolved Hide resolved
@mforets
Copy link
Member Author

mforets commented Aug 24, 2020

if the intersection is empty the new function should rather return EmptySet -- for more advanced users, type stability is ensured using _intersection_vrep directly.

if isempty(v12)
return EmptySet{N}(2)
else
return VPolygon(v12, apply_convex_hull=apply_convex_hull)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO VPolygons should always be created using a convex hull unless the algorithm guarantees that result anyway.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes , i agree. i left the option as true by default.

@mforets mforets requested a review from schillic August 25, 2020 17:22
Copy link
Member

@schillic schillic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still think the option apply_convex_hull is misleading because you may want to set it to false to save time, but that will violate our type assumption of VPolygon.

@mforets
Copy link
Member Author

mforets commented Aug 25, 2020

I still think the option apply_convex_hull is misleading because you may want to set it to false to save time, but that will violate our type assumption of VPolygon.

yes, but if an application just requires the vertices of the intersection (without any particular sorting assumption) it's reasonable to pass apply_convex_hull=false, instead of digging & using internal methods to get the vertices directly.

@mforets mforets merged commit 1cd0fed into master Aug 25, 2020
@mforets mforets deleted the mforets/SH branch August 25, 2020 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants