A small demo of the contour adjuster. I accidentally found this shape and I found it interesting
imports
import org.openrndr.application
import org.openrndr.color.ColorRGBa
import org.openrndr.extra.shapes.adjust.adjustContour
import org.openrndr.shape.Circle
import org.openrndr.shape.Rectangle
fun main() {
application {
program {
extend {
val cir = adjustContour(Circle(drawer.bounds.center, 200.0).contour) {
vertices.forEach {
it.rotate(75.0)
}
}
val rect = adjustContour(Rectangle.fromCenter(drawer.bounds.center, 200.0).contour) {
vertices.forEach {
it.rotate(75.0)
}
}
drawer.clear(ColorRGBa.WHITE)
drawer.stroke = ColorRGBa.BLACK.opacify(0.7)
drawer.fill = ColorRGBa.PINK
drawer.contour(cir)
drawer.fill = ColorRGBa.PINK.shade(1.1)
drawer.contour(rect)
}
}
}
}
This program uses two adjustContour
operations to alter all vertices in a circle and in a rectangle. The larger shape used to be a circle, which is internally constructed out of 4 bezier curves. The smaller shape was a square with 4 straight segments.
The program iterates over all (4) vertices of each shape, and uses the rotate
operation to rotate the control points on each side of each vertex, producing what you see in the image. It’s a bit like sculpting 2D shapes.
I will continue exploring the ContourAdjuster and maybe share other interesting results.