[orx-shapes] Add RectifiedContour.splitAt

This commit is contained in:
Edwin Jakobs
2023-12-29 18:51:58 +01:00
parent c8b9dcf62c
commit 2f8e8d5379

View File

@@ -1,5 +1,6 @@
package org.openrndr.extra.shapes.rectify package org.openrndr.extra.shapes.rectify
import org.openrndr.extra.shapes.utilities.splitAt
import org.openrndr.math.Matrix44 import org.openrndr.math.Matrix44
import org.openrndr.math.Vector2 import org.openrndr.math.Vector2
import org.openrndr.math.clamp import org.openrndr.math.clamp
@@ -123,6 +124,14 @@ class RectifiedContour(val contour: ShapeContour, distanceTolerance: Double = 0.
contour.sub(rectify(t0), rectify(t1)) contour.sub(rectify(t0), rectify(t1))
} }
} }
/**
* Split contour at [ascendingTs]
* @since orx 0.4.4
*/
fun splitAt(ascendingTs: List<Double>, weldEpsilon: Double = 1E-6): List<ShapeContour> {
return contour.splitAt(ascendingTs.map { rectify(it) }, weldEpsilon)
}
} }
/** create a rectified contour /** create a rectified contour