[orx-marching-squares] Change findContours to return List<ShapeContour>

This commit is contained in:
Edwin Jakobs
2023-02-02 22:03:51 +01:00
parent 9019e7e7ea
commit 5e6123c958
5 changed files with 65 additions and 18 deletions

View File

@@ -16,14 +16,13 @@ fun main() {
extend {
drawer.clear(ColorRGBa.BLACK)
drawer.stroke = ColorRGBa.PINK
drawer.fill = null
fun f(v: Vector2): Double {
val p = v + Vector2(cos(v.y * 0.1 + seconds) * 40.0, sin(v.x * 0.1 + seconds) * 40.0)
return cos((p.distanceTo(drawer.bounds.center) / 720.0) * 6 * PI)
return cos((p.distanceTo(drawer.bounds.center) / 720.0) * 12 * PI)
}
val segments = findContours(::f, drawer.bounds.offsetEdges(32.0), 4.0)
drawer.lineSegments(segments)
val contours = findContours(::f, drawer.bounds.offsetEdges(-2.0), 4.0)
drawer.contours(contours)
}
}
}