Skip to main content
GameDev.net gamedev.net
🔒 Locked

Merge multiple 2D polygons algorithm

Started by Aldoric Nov 10, 2009 at 4:01 AM 1 replies 7.6k views
Original Post
Aldoric
Aldoric
Hello! I need an algorithm to merge multiple 2-dimensional polygons together to one. The source polygons can even overlap themself. Its also possible that a second polygon is completly inside another polygon. The target polygon should be clear and have no overlapping edges anymore. This illustration shows what I mean where the red lines are the polygon edges. http://img196.imageshack.us/i/polygonz.png/ Any tipps or links? I didn't find anything, yet. Maybe I just don't know what to search for. Thanks in advance.
OrangyTang
OrangyTang
Quote:
Original post by Aldoric
Any tipps or links? I didn't find anything, yet. Maybe I just don't know what to search for.

It sounds like you're after 'constructive solid geometry' or CSG. What language are you working in? I know a couple of libraries which do this for java but off the top of my head none C++ right now.
Aldoric
Aldoric
Thank you! Due to your tipp I found out how to search for the algorithm. A search for "boolean union polygon" was the correct solution :)

I found this algorithm PDF file - It's german - but maybe someone is interested:
http://es.cs.uni-kl.de/publications/datarsg/Bran03.pdf

Also there is a GPC libary that offeres the solution in C code.

Thank you :)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.