[orx-shapes] Comment the ContourAdjuster and its demos

This commit is contained in:
Abe Pazos
2025-08-29 13:00:27 +02:00
parent c531c45608
commit 2e6c637b49
9 changed files with 248 additions and 33 deletions

View File

@@ -6,6 +6,16 @@ import org.openrndr.extra.shapes.adjust.adjustContour
import org.openrndr.math.Vector2
import org.openrndr.shape.contour
/**
* Demonstrates how to adjust and manipulate the vertices and edges of a contour.
*
* This method shows two approaches for transforming contours:
*
* 1. Adjusting vertices directly by selecting specific vertices in a contour and modifying their control points.
* 2. Adjusting edges of a contour by transforming their control points.
*
* For each approach, a red line is drawn representing the transformed contour.
*/
fun main() = application {
configure {
width = 800
@@ -13,6 +23,7 @@ fun main() = application {
}
program {
extend {
// Adjust a contour by transforming its vertices
var contour = contour {
moveTo(drawer.bounds.position(0.5, 0.1) - Vector2(300.0, 0.0))
lineTo(drawer.bounds.position(0.5, 0.1) + Vector2(300.0, 0.0))
@@ -29,7 +40,7 @@ fun main() = application {
drawer.stroke = ColorRGBa.RED
drawer.contour(contour)
// Achieve the same effect by transforming the control points of its edge
contour = contour {
moveTo(drawer.bounds.position(0.5, 0.2) - Vector2(300.0, 0.0))
lineTo(drawer.bounds.position(0.5, 0.2) + Vector2(300.0, 0.0))