Demos: ensure all use fun main() = application {

- Adjust some demo window sizes.
- Replace Random.double by Double.uniform
- Tweak some demos so screenshots look more interesting
This commit is contained in:
Abe Pazos
2025-01-26 20:57:04 +01:00
parent 1975a820fc
commit c8f7dd52c6
116 changed files with 2889 additions and 2942 deletions

View File

@@ -12,35 +12,33 @@ import org.openrndr.shape.Circle
* You can think of bezierPatch.position() as requesting points
* in a wavy flag (the bezier patch) using normalized uv coordinates.
*/
fun main() {
application {
configure {
width = 800
height = 800
}
program {
val bp = bezierPatch(
Circle(drawer.bounds.center, 350.0).contour
//Rectangle.fromCenter(drawer.bounds.center, 550.0).contour
)
fun main() = application {
configure {
width = 800
height = 800
}
program {
val bp = bezierPatch(
Circle(drawer.bounds.center, 350.0).contour
//Rectangle.fromCenter(drawer.bounds.center, 550.0).contour
)
extend {
drawer.clear(ColorRGBa.PINK)
drawer.stroke = ColorRGBa.BLACK
extend {
drawer.clear(ColorRGBa.PINK)
drawer.stroke = ColorRGBa.BLACK
for (j in 1 until 50 step 2) {
for (i in 1 until 50 step 2) {
val u = i / 50.0
val v = j / 50.0
val pos = bp.position(u, v)
val grad = bp.gradient(u, v).normalized * 10.0
val perpendicular = grad.perpendicular()
drawer.lineSegment(pos - grad, pos + grad)
drawer.lineSegment(pos - perpendicular, pos + perpendicular)
//drawer.circle(pos + grad, 3.0)
}
for (j in 1 until 50 step 2) {
for (i in 1 until 50 step 2) {
val u = i / 50.0
val v = j / 50.0
val pos = bp.position(u, v)
val grad = bp.gradient(u, v).normalized * 10.0
val perpendicular = grad.perpendicular()
drawer.lineSegment(pos - grad, pos + grad)
drawer.lineSegment(pos - perpendicular, pos + perpendicular)
//drawer.circle(pos + grad, 3.0)
}
}
}
}
}
}