Fix demos

This commit is contained in:
Edwin Jakobs
2022-10-21 11:56:55 +02:00
parent 1f16aa6a31
commit 99bd0514b4
3 changed files with 17 additions and 4 deletions

View File

@@ -59,6 +59,8 @@ kotlin {
implementation(project(":orx-camera")) implementation(project(":orx-camera"))
implementation(project(":orx-color")) implementation(project(":orx-color"))
implementation(project(":orx-triangulation")) implementation(project(":orx-triangulation"))
implementation(project(":orx-shapes"))
implementation(project(":orx-noise"))
} }
} }
} }

View File

@@ -78,3 +78,13 @@ Edwin Jakobs / [@edwinRNDR](https://github.com/edwinRNDR)
[source code](src/demo/kotlin/DemoVoronoi01.kt) [source code](src/demo/kotlin/DemoVoronoi01.kt)
![DemoVoronoi01Kt](https://raw.githubusercontent.com/openrndr/orx/media/orx-triangulation/images/DemoVoronoi01Kt.png) ![DemoVoronoi01Kt](https://raw.githubusercontent.com/openrndr/orx/media/orx-triangulation/images/DemoVoronoi01Kt.png)
### DemoVoronoi02
[source code](src/demo/kotlin/DemoVoronoi02.kt)
![DemoVoronoi02Kt](https://raw.githubusercontent.com/openrndr/orx/media/orx-triangulation/images/DemoVoronoi02Kt.png)
### DemoVoronoi03
[source code](src/demo/kotlin/DemoVoronoi03.kt)
![DemoVoronoi03Kt](https://raw.githubusercontent.com/openrndr/orx/media/orx-triangulation/images/DemoVoronoi03Kt.png)

View File

@@ -1,6 +1,7 @@
import org.openrndr.application import org.openrndr.application
import org.openrndr.color.ColorRGBa import org.openrndr.color.ColorRGBa
import org.openrndr.extra.noise.poissonDiskSampling import org.openrndr.extra.noise.poissonDiskSampling
import org.openrndr.extra.noise.scatter
import org.openrndr.extra.triangulation.delaunayTriangulation import org.openrndr.extra.triangulation.delaunayTriangulation
import org.openrndr.math.Vector2 import org.openrndr.math.Vector2
import org.openrndr.shape.Rectangle import org.openrndr.shape.Rectangle
@@ -13,11 +14,11 @@ fun main() {
} }
program { program {
val frame = Rectangle.fromCenter(Vector2(400.0), 600.0, 600.0) val frame = Rectangle.fromCenter(Vector2(400.0), 600.0, 600.0)
val points = poissonDiskSampling(frame, 50.0).map { it + frame.corner } val points = frame.scatter(50.0)
val delaunay = points.delaunayTriangulation() val delaunay = points.delaunayTriangulation()
val halfedges = delaunay.halfedges() val halfedges = delaunay.halfedges()
val hull = delaunay.hull() //val hull = delaunay.hull()
extend { extend {
drawer.clear(ColorRGBa.BLACK) drawer.clear(ColorRGBa.BLACK)
@@ -26,8 +27,8 @@ fun main() {
drawer.stroke = ColorRGBa.PINK drawer.stroke = ColorRGBa.PINK
drawer.contours(halfedges) drawer.contours(halfedges)
drawer.stroke = ColorRGBa.GREEN //drawer.stroke = ColorRGBa.GREEN
drawer.contour(hull) //drawer.contour(hull)
} }
} }
} }