-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathDemoBezierPatch02.kt
37 lines (33 loc) · 1009 Bytes
/
DemoBezierPatch02.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package bezierpatch
import org.openrndr.application
import org.openrndr.color.ColorRGBa
import org.openrndr.extra.shapes.bezierpatches.bezierPatch
import org.openrndr.shape.Circle
import org.openrndr.shape.ShapeContour
/**
* Shows how to create a [bezierPatch] out of a
* closed [ShapeContour] with 4 curved segments.
*
* Calling [Circle.contour] is one way of producing
* such a contour with vertices at the cardinal points
* but one can manually create any other 4-segment closed contour
* to use in bezier patches.
*/
fun main() = application {
configure {
width = 800
height = 800
}
program {
val c = Circle(width / 2.0, height / 2.0, 350.0).contour
val bp = bezierPatch(c)
extend {
drawer.clear(ColorRGBa.PINK)
drawer.stroke = ColorRGBa.BLACK
for (i in 0..10) {
drawer.contour(bp.horizontal(i / 10.0))
drawer.contour(bp.vertical(i / 10.0))
}
}
}
}