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

execute polytree for offsetting #48

Open
Wikunia opened this issue Jan 11, 2022 · 2 comments
Open

execute polytree for offsetting #48

Wikunia opened this issue Jan 11, 2022 · 2 comments

Comments

@Wikunia
Copy link
Contributor

Wikunia commented Jan 11, 2022

It seems like offsetting in this wrapper can only return a list of polygons and not a polytree.
This is harder to work with when one wants to offset polygons that include holes as matching holes to the correct outer polygon isn't straightforward.

From the Clipper documentation:
http://www.angusj.com/delphi/clipper/documentation/Docs/Units/ClipperLib/Classes/ClipperOffset/Methods/Execute.htm
it looks like Clipper itself supports this. Would there be interest in having this functionality in this wrapper?
Would love to help with implementation but probably need some advice as I've never worked with a C++ wrapper in Julia before.

A bit more information:
The CPP code:
https://github.com/Geri-Borbas/Clipper/blob/master/cpp/clipper.cpp#L3917-L3955

The current Julia part:
https://github.com/JuliaGeometry/Clipper.jl/blob/master/src/Clipper.jl#L278-L285

I don't know what the arguments in ccall are.

@sjkelly
Copy link
Member

sjkelly commented Jan 11, 2022

In the past, I found this easier to accomplish on the Julia side of things.

Also I am not sure such hierarchies are strictly required, since E.g. slicing any mesh should have interior polygons with the opposite winding order from the ones that contain them, and so forth all the way down. Offsetting IIRC takes into account winding order.

@Wikunia
Copy link
Contributor Author

Wikunia commented Jan 11, 2022

Yeah the problem might appear when a single polygon with a hole gets split up into two polygons due to a narrow bridge inside the initial polygon which gets disconnected when deflating the polygon. Then one needs to check in which of the two the hole is. Which would be saved directly in the polytree.

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

No branches or pull requests

2 participants