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.
🎉 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?
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.