[orx-noise] Add comments to all demos, add demo

This commit is contained in:
Abe Pazos
2025-08-30 13:54:25 +02:00
parent 935e7cd9a8
commit 878f2b040d
18 changed files with 156 additions and 23 deletions

View File

@@ -6,6 +6,17 @@ import org.openrndr.extra.noise.shapes.uniform
import org.openrndr.shape.Circle
import kotlin.random.Random
/**
* Demonstrates how to draw circles distributed within two subregions of a rectangular area
* using uniform random distribution and a hash-based method for randomness.
*
* The application divides the window area into two subregions, offsets the edges inwards,
* and then calculates two circles representing these subregions. Points are then generated and drawn
* within these circles using two different methods:
*
* - A uniform random distribution within the first circle.
* - A hash-based deterministic random point generation within the second circle.
*/
fun main() = application {
configure {
width = 720

View File

@@ -5,6 +5,14 @@ import org.openrndr.extra.noise.shapes.hash
import org.openrndr.extra.noise.shapes.uniform
import kotlin.random.Random
/**
* Demonstrates how to generate and draw random points within two subregions of a rectangular area
* using two different randomization methods.
*
* The first subregion generates points using a _uniform_ random distribution, while the second subregion
* generates points deterministically with a _hash-based_ randomization approach. The points are visualized
* as small circles.
*/
fun main() = application {
configure {
width = 720

View File

@@ -4,6 +4,14 @@ import org.openrndr.application
import org.openrndr.color.ColorRGBa
import org.openrndr.extra.noise.fhash3D
/**
* Demonstrates how to render a dynamic grid of points where the color of each point
* is determined using a hash-based noise generation method.
*
* The application dynamically updates the visual output by calculating a 3D hash
* value for each point in the grid, based on the current time and the point's coordinates.
* The hash value is then used to determine the grayscale color intensity of each point.
*/
fun main() = application {
configure {
width = 720
@@ -14,7 +22,7 @@ fun main() = application {
drawer.points {
for (y in 0 until height) {
for (x in 0 until width) {
val c = fhash3D(100, x + (seconds * 60.0).toInt(), y, (0).toInt())
val c = fhash3D(seed = 100, x = x + (seconds * 60.0).toInt(), y, z = 0)
//val u = uhash11(x.toUInt()).toDouble() / UInt.MAX_VALUE.toDouble()
fill = ColorRGBa(c, c, c, 1.0)
point(x.toDouble(), y.toDouble())