[orx-shapes] Add Tunni point/line operations

This commit is contained in:
Edwin Jakobs
2024-01-17 00:07:22 +01:00
parent 9b08ae20e6
commit 83b8faed94
2 changed files with 67 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
package tunni
import contour
import org.openrndr.application
import org.openrndr.color.ColorRGBa
import org.openrndr.extra.shapes.adjust.adjustContour
import org.openrndr.extra.shapes.tunni.tunniLine
import org.openrndr.shape.Circle
import kotlin.math.cos
fun main() {
application {
program {
extend {
val c = Circle(drawer.bounds.center, 200.0).contour
val c2 = adjustContour(c) {
selectEdges { it -> true }
for (e in edges) {
val tl = e.tunniLine
e.withTunniLine(tl.position(0.5) + tl.normal * cos(seconds)*200.0)
}
}
for (s in c2.segments) {
drawer.stroke = ColorRGBa.WHITE
drawer.lineSegment(s.tunniLine)
}
drawer.contour(c2)
}
}
}
}