Bump to OPENRNDR 0.3.44-rc.7, add intersection demos

This commit is contained in:
Edwin Jakobs
2020-07-29 12:01:23 +02:00
parent dd9a0b351a
commit 6060ebffcd
4 changed files with 111 additions and 1 deletions

View File

@@ -0,0 +1,32 @@
import org.openrndr.application
import org.openrndr.color.ColorRGBa
import org.openrndr.math.Vector2
import org.openrndr.shape.ShapeContour
import org.openrndr.shape.intersections
import kotlin.math.PI
import kotlin.math.cos
import kotlin.math.sin
fun main() = application {
program {
val contour = ShapeContour.fromPoints(
List(80) {
val a = PI * 2 * it / 80.0
val x = 200.0 * sin(a * 2)
val y = 200.0 * cos(a)
Vector2(x, y)
}, closed = true
)
val ints = intersections(contour, contour)
extend {
drawer.run {
clear(ColorRGBa.WHITE)
translate(width * 0.5, height * 0.5)
fill = null
stroke = ColorRGBa.BLACK
contour(contour)
circles(ints.map { it.position }, 10.0)
}
}
}
}