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

Polyhedra integration #4

Open
harveydevereux opened this issue Jan 17, 2022 · 3 comments
Open

Polyhedra integration #4

harveydevereux opened this issue Jan 17, 2022 · 3 comments

Comments

@harveydevereux
Copy link
Owner

Great thanks, I'll take a look in a second.

Just had a look at Polyhedra.jl, looks like workflow would be Vertices::Array{Float64,3} -> "convex hull points" -> Polyhedra::vrep for both shapes then it should just be a call to intersect(P1,P2) like this example from their docs. Have not used Polyhedra myself so could be wrong.

# two hard coded polygons
P1 = polyhedron(vrep([
    -1.9 -1.7
    -1.8  0.5
     1.7  0.7
     1.9 -0.3
     0.9 -1.1
]), lib)

P2 = polyhedron(vrep([
    -2.5 -1.1
    -0.8  0.8
     0.1  0.9
     1.8 -1.2
     1.3  0.1
]), lib)

Pint = intersect(P1, P2) # the intersection shape


If this is the case it should be simple..

Originally posted by @harveydevereux in #2 (comment)

@itsdfish
Copy link
Contributor

Integrating with Polyhedra seems like a good idea because it does not have alpha shapes to deal with shapes that might be concave.

As a disclaimer, I must admit that I am far from an expert in geometry. Nonetheless, I was wondering if there is a more general approach to identifying an intersection between shapes that can be some combination of convex and concave? If I understand correctly, the proposal above would only apply to the special case in which the shapes are convex. The restriction that the shapes must be convex is one of the biggest limitations in Polyhedra.

@harveydevereux
Copy link
Owner Author

I think you may be right, I'm far from an expert in this area myself.

I'll have to familiarise myself with Polyhedra.jl and maybe open an issue asking about non-convex shapes.

I did find some articles on arbitrary polytope intersections so it might be doable but beyond me without more careful reading
https://link.springer.com/article/10.1007/s00454-008-9097-3
https://www.sciencedirect.com/science/article/abs/pii/0378475490900032 - downloaded this one, and it does have pseudo-code

@itsdfish
Copy link
Contributor

I am willing to help in cases where I can, but I suspect someone at Polyhedra would be better suited to assist in terms of the math and the software design.

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