Jump to content
  • Advertisement
Sign in to follow this  
sgdimitris

Intersection of two 3D Polyhedrons

This topic is 2435 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello to all users,
I'm making a project for my university and I need to calculate the intersection of two given 3D polyhedrons. How can I do that?
I know the x,y,z, coordinates of each vertex and also the triangles list that I use to draw each polyhedron.
Any help would be very very appreciated.
With regard,
Dimitris

Share this post


Link to post
Share on other sites
Advertisement
Do you want the polyhedron of the intersecting volume of the two original polyhedrons, or just check if they do or do not intersect?

Share this post


Link to post
Share on other sites

I want the polyhedron, not only check


General polyhedron intersection is a very broad and complex problem, made even more complex when accounting for floating point inaccuracy. There's various libraries around with different characteristics. It gets even more complex if allowing degenerate and self-intersecting inputs.

Such operations are typically performed using CSG and polyhedra are only generated as final step. One disadvantage of such approach is that polyhedra aren't perfect fit, so there might be intersections left as result.


One way is to work on triangle soup. Intersect triangles, then run a post-processing pass to reconstruct final result. Quite a few simplifications can be made if limiting the solution to a well-defined problem, perhaps merely generating non-intersecting objects or similar.

Share this post


Link to post
Share on other sites

On large scale multiple intersactions, won't that make the code very slow?


Of course, but you are going for general intersection. Usually you do some filtering using convex hulls or bounding boxes/convex polyhedrons, and then you use the detailed mechanism only for the intersecting bodies

Share this post


Link to post
Share on other sites
A popular way to do this is to generate a bsp tree of of your polyhedrons and then merge the trees in the appropriate way - google for BSP and CSG together to find details on how the two are used together.

If I was going to do this in a quick and dirty way, I would simply take the triangles of one of the polyhedra (the one with the fewest triangles), extend them to planes and split (look for "polyhedral splitting" - it is a well studied problem) the other polyhedron. Then all you have to do is classify the resulting small polyhedra as in or out of the polyhedron used to generate the splitting planes. This can be done with a simple point inside mesh query. Finally you take the "inside" polyhedra and work out the union of them, which isn't to hard since they share sides and don't overlap.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!