iShapeTriangulation icon indicating copy to clipboard operation
iShapeTriangulation copied to clipboard

Ignore unused points?

Open max-christian opened this issue 2 years ago • 1 comments

I'm getting this exception thrown from PlainShape.split(). Seems to happen when a polygon has two very nearby vertices.

                throw SplitError.unusedPoint

Is it safe to ignore the unused point by replacing the throw with the following code?

                i += 1
                continue nextNode

Any advice much appreciated!

max-christian avatar Apr 07 '23 16:04 max-christian

any exceptions are possible if you have a “bad” polygon (self intersection or hole intersection or some of the external point can be outside). Algorithm is only working with clean polygons. It’s your responsibility to prepere a good polygon, check self intersection and remove zero edges. For debug purpose you can try to check your polygon with PlainShape.validate from iGeometry. But keep in mind that this method is very slow and I do not recommend it for runtime. It’s not a trivial algorithm to clean polygon that why I still do not implement it.

NailxSharipov avatar Apr 08 '23 19:04 NailxSharipov