# Boolean add of two polygons in 2D?

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

## 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 on other sites
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 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.

1. 1
2. 2
3. 3
Rutin
20
4. 4
5. 5
khawk
14

• 9
• 11
• 11
• 23
• 12
• ### Forum Statistics

• Total Topics
633655
• Total Posts
3013175
×