Jump to content
  • Advertisement
Sign in to follow this  
eq

Boolean add of two polygons in 2D?

This topic is 4904 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

Where do I find some information or sample code that robust and quite fast. I.e a function like: int polyAdd(Vertex* dest, const Vertex* sourceA, const int countA, const Vertex* sourceB, const int countB); I'm trying to calculate the total area of a bunch of triangles, without adding the overlapped area twice. I guess I could create a bsp, for the edges of the first triangle, then adding the other triangles by clipping them against the bsp tree!? How do you robustly clip triangles against a bsp tree without getting to many fragments? [Edited by - eq on January 17, 2005 1:38:30 PM]

Share this post


Link to post
Share on other sites
Advertisement
Are your source polygons convex? If so, it's pretty easy to find the intersection. You could then get the area as A(poly1) + A(poly2) - A(poly1 ^ poly2).

If they aren't necessarily convex, then it's going to be a fair bit trickier. I couldn't say offhand how to do it.

Share this post


Link to post
Share on other sites
I start with once triangle, then I add another once, after that step it could take any shape, even as two separate pieces. After adding a third triangle two pieces might be joined together.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!