soywiz-archive / korge-samples

Korge Samples
55 stars 23 forks source link

KotlinNullPointerException during triangulation #29

Open RezMike opened 4 years ago

RezMike commented 4 years ago

I have this error when running triangulation sample:

kotlin.KotlinNullPointerException
    at com.soywiz.korma.triangle.internal.Sweep.finalizationPolygon(Poly2Tri.kt:215)
    at com.soywiz.korma.triangle.internal.Sweep.triangulate(Poly2Tri.kt:196)
    at com.soywiz.korma.triangle.triangulate.TriangulateKt.triangulate(Triangulate.kt:12)
    at MainKt$main$2$1$1.invoke(main.kt:45)
        ...

error

soywiz commented 4 years ago

That triangulation is invalid.

http://r3mi.github.io/poly2tri.js/ https://github.com/r3mi/poly2tri.js/

https://github.com/nerik/poly2trihx http://nerik.github.io/poly2trihx/

soywiz commented 4 years ago

The haxe version sample detects invalid polygons and doesn't allow you to add the lines + allows to add holes. If you want to port the sample to support that too, would be great