zoom wrote:Nice I'll give this a spin. As for the self-intersecting I was thinking about these test cases, so I could verify that it was valid polygons I chucked at the triangulator.For my particular use case I can probably throw a few close-to-zero-area triangles at OpenGL, it most probably wont affect the performance or the rendering much.

Yeah, no reason to really remove them unless you find a reason to.

zoom wrote:Edit: My test cases failed in earclipping this time, might be a valid exception, I'll check it out in a day or so

All the test cases you've posted here have been valid (the one with 900 or so vertices does not work however)

zoom wrote:are you sure about the double negatives in the text? "A polygon cannot not have coincident vertices."

Ok, that one actually made me laugh... Yeah that's a typo. I'll clean that up as well.

zoom wrote:Edit: My test cases failed in earclipping this time, might be a valid exception, I'll check it out in a day or so

All the test cases you've posted here have been valid (the one with 900 or so vertices does not work however)

zoom wrote:are you sure about the double negatives in the text? "A polygon cannot not have coincident vertices."

Ok, that one actually made me laugh... Yeah that's a typo. I'll clean that up as well.

William

It was the weird one with hundreds of vertices that caused earclipping and sweepline to fail in my tests and we'll ignore that one, I probably messed up extracting the data. I'm putting sweepline through its paces now, so far so good

I haven't done extensive testing yet but so far I have been running sweepline for at least a factor longer than I ever could before. The feeling I get is that you probably nailed this bug now. Thanks a lot!

The only thing I've noticed is for badly constructed polygons Earclipping gives an error message that correctly states that the polygon has the wrong winding but Sweepline ends up in a NullPointer. But I wouldn't call that a bug.