How to combine vertices of two polygons into one polygon.

Mar 6, 2011 at 1:05 AM


So I have written a function that loads in tiles and gets the vertices based on the texture data. This works fine if I create a polygon for each separate tile. What I want to do though is create one polygon from the two sets of vertices. For example, if I load in two square tiles I want the outcome to be one rectangular tile.

I've tried adding all of the vertices into a Vertices object and trying each of the convexpartition algorithms and the convex hull algorithms but nothing seems to work.

Any ideas?

Mar 6, 2011 at 10:08 AM

Maybe u need Union ?

Mar 6, 2011 at 3:04 PM

Would that actually work? I thought its more complex than that.

Mar 6, 2011 at 7:44 PM

This doesn't work.

I've been trying to figure this out for a while now. I must have tried everything to combine the vertices of both polygons but I can never get a single polygon as the end result. My other idea was to combine all the 2d texture data into one large texture and then use the texture converter to break it into polygons. I don't even know where to start though. Would have thought this would be a common problem.

Mar 6, 2011 at 9:06 PM

You need to use the YuPengClipper union method from the latest source. This should combine tiles easily.