Update for OPENRNDR segment and path generalizations
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package rectify
|
||||
|
||||
import org.openrndr.application
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.extra.noise.scatter
|
||||
import org.openrndr.extra.shapes.hobbycurve.hobbyCurve
|
||||
import org.openrndr.extra.shapes.rectify.rectified
|
||||
import kotlin.random.Random
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
configure {
|
||||
width = 720
|
||||
height = 720
|
||||
}
|
||||
program {
|
||||
val points = drawer.bounds.scatter(80.0, distanceToEdge = 100.0, random = Random(0))
|
||||
val curve = hobbyCurve(points, closed = true)
|
||||
val rectified = curve.rectified()
|
||||
extend {
|
||||
drawer.clear(ColorRGBa.BLACK)
|
||||
drawer.fill = null
|
||||
drawer.stroke = ColorRGBa.GRAY
|
||||
drawer.contour(curve)
|
||||
|
||||
val points = (0 until 100).map {
|
||||
rectified.position(it/100.0)
|
||||
}
|
||||
drawer.circles(points, 5.0)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package rectify
|
||||
|
||||
import org.openrndr.WindowMultisample
|
||||
import org.openrndr.application
|
||||
import org.openrndr.color.ColorRGBa
|
||||
import org.openrndr.draw.DrawPrimitive
|
||||
import org.openrndr.draw.isolated
|
||||
import org.openrndr.extra.camera.Orbital
|
||||
import org.openrndr.extra.meshgenerators.sphereMesh
|
||||
import org.openrndr.extra.noise.uniformRing
|
||||
import org.openrndr.extra.shapes.rectify.rectified
|
||||
import org.openrndr.math.Vector3
|
||||
import org.openrndr.shape.path3D
|
||||
|
||||
|
||||
fun main() {
|
||||
application {
|
||||
configure {
|
||||
width = 720
|
||||
height = 720
|
||||
multisample = WindowMultisample.SampleCount(4)
|
||||
}
|
||||
program {
|
||||
val p = path3D {
|
||||
moveTo(0.0, 0.0, 0.0)
|
||||
for (i in 0 until 10) {
|
||||
curveTo(
|
||||
Vector3.uniformRing(0.1, 1.0)*10.0,
|
||||
Vector3.uniformRing(0.1, 1.0)*10.0,
|
||||
Vector3.uniformRing(0.1, 1.0)*10.0
|
||||
)
|
||||
}
|
||||
}
|
||||
val pr = p.rectified(0.01, 100.0)
|
||||
val sphere = sphereMesh(radius = 0.1)
|
||||
extend(Orbital())
|
||||
extend {
|
||||
drawer.stroke = ColorRGBa.PINK
|
||||
for (i in 0 until 500) {
|
||||
drawer.isolated {
|
||||
drawer.translate(pr.position(i/499.0))
|
||||
drawer.vertexBuffer(sphere, DrawPrimitive.TRIANGLES)
|
||||
}
|
||||
}
|
||||
drawer.path(p)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user