🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Non-triangulated earcutting?

Started by
3 comments, last by sevenfold1 5 years, 3 months ago

Hello,
I'm looking for 2D polygon earcutting routine that creates a non-triangulated output.  All of the earcutting examples I've seen so far output to triangles only.  However, I would like to earcut a concave 2D shape, but keep the convex pieces as large as possible.  Thanks.
 

Advertisement
30 minutes ago, sevenfold1 said:

Hello,
I'm looking for 2D polygon earcutting routine that creates a non-triangulated output.  All of the earcutting examples I've seen so far output to triangles only.  However, I would like to earcut a concave 2D shape, but keep the convex pieces as large as possible.  Thanks.
 

AFAIK, earcutting (aka earclipping) explicitly describes a method of triangulation so, yeah, it's always going to produce triangles. You probably want to try looking for polygon decomposition, or something akin to that? A quick search revealed this algorithm that has some drawbacks but appears to meet your basic requirement, the same page has a second algorithm (Kiel's) that is slower but produces an optimal partition.

What do you need it for?

Yes, 2D polygon decomposition is what I'm looking for.  I was hoping earclipping could be converted to output polygons instead of triangles. It doesn't have to be optimal.

I'm trying to speed up 2D polygon intersection, so I would rather have pieces as large as possible, instead of looping through thousands of triangles.

Thanks for the links.  I will check it out.

I was able to compile both demos, and it seems the keil demo works, for the most part.  But the program hangs on some simple shapes, so I'not sure about its robustness.  The bayazit demo runs too, but it crashes on all shapes.  Couldn't get it to work at all.  Well, it's a good start.

This topic is closed to new replies.

Advertisement