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

Inward/Outward Polygon Offsetting #1013

Open
mcontim opened this issue Aug 20, 2024 · 4 comments
Open

Inward/Outward Polygon Offsetting #1013

mcontim opened this issue Aug 20, 2024 · 4 comments
Labels
feature help wanted Extra attention is needed

Comments

@mcontim
Copy link

mcontim commented Aug 20, 2024

Hi!

I'm investigating on how to produce an offsetted version of a polygon, both inward or outward, like in these StackOverflow threads:

I was wondering if there is anything already avalable in Meshes.jl to solve this problem. Thank you for the help!

@juliohm
Copy link
Member

juliohm commented Aug 20, 2024

Hi @mcontim , we have something similar in the Repair(10) transform. You can try to poly |> Repair(10) to see if it works for now. What we really need is a better clipping algorithm (see #999) to create buffers, intersections, unions, etc.

@juliohm juliohm added help wanted Extra attention is needed feature labels Aug 20, 2024
@mcontim
Copy link
Author

mcontim commented Aug 20, 2024

Hi @juliohm, thank you for the quick reply!

I had a look at Repair(10) I think it uses Stretch so the transformation is applied for each point of the polygon instead of offsetting each edge of the polygon (please correct me if I'm wrong).

In order to preserve the shape of the polygon, I'm looking for a solution to offset each edge of the polygon (like in the links above). I will try an implementation, then, if of interest, I can share the code and see if it is useful for Meshes.jl.

EDIT: I just realized there is a wrapper of the C library Clipper in JuliaGeometry, I will also have a look at that. You're probably already working to a full Julia implementation of i for Meshes.jl :D

@juliohm
Copy link
Member

juliohm commented Aug 20, 2024

It is definitely useful. Did you have a chance to take a look into #979 ?

@mcontim
Copy link
Author

mcontim commented Aug 20, 2024

Yes, I started working on it but unfortunately I had to put it in stand-by becuse of incoming deadlines with work.

I'm taking inspiration from HomogeneousSampling, I defined an ad-hoc struct for Fibonacci sampling (for the moment it will be just one, but I think we could define an abstract type then different sub-types of Fibonacci sampling for different sampling approaches).

Then the sample method should be only defined for Disk, Ball, and probably Plane (CylinderSurface would also make sense too, we can discuss it).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants