[orx-marching-squares] Add orx-marching-squares module
This commit is contained in:
24
orx-marching-squares/src/jvmDemo/kotlin/FindContours02.kt
Normal file
24
orx-marching-squares/src/jvmDemo/kotlin/FindContours02.kt
Normal file
@@ -0,0 +1,24 @@
|
||||
import org.openrndr.application
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.extra.marchingsquares.findContours
|
||||
import org.openrndr.math.Vector2
|
||||
import kotlin.math.PI
|
||||
import kotlin.math.cos
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
configure {
|
||||
width = 720
|
||||
height = 720
|
||||
}
|
||||
program {
|
||||
extend {
|
||||
drawer.clear(ColorRGBa.BLACK)
|
||||
drawer.stroke = ColorRGBa.PINK
|
||||
fun f(v: Vector2) = cos((v.distanceTo(drawer.bounds.center) / 100.0) * 2 * PI)
|
||||
val segments = findContours(::f, drawer.bounds.offsetEdges(32.0), 16.0)
|
||||
drawer.lineSegments(segments)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user