RectifiedContour

class RectifiedContour(contour: ShapeContour, distanceTolerance: Double = 0.5, lengthScale: Double = 1.0) : RectifiedPath<Vector2> (source)

Constructors

Link copied to clipboard
constructor(contour: ShapeContour, distanceTolerance: Double = 0.5, lengthScale: Double = 1.0)

Properties

Link copied to clipboard
val contour: ShapeContour
Link copied to clipboard

Lazy-evaluated list of parameter intervals corresponding to the points property, used for mapping and inverse mapping of parameter values.

Link copied to clipboard
val originalPath: Path<Vector2>

The underlying path being rectified.

Link copied to clipboard
val points: List<Pair<Vector2, Double>>

Final list of points used in the rectification process, possibly including an additional point to close the loop if the original path is closed.

Link copied to clipboard

Functions

Link copied to clipboard
fun RectifiedContour.convolute(errorTolerance: Double = 0.5, maxDepth: Int = 6, sampleDistance: Double = 4.0, kernel: DoubleArray): ShapeContour

Convolutes the contour underlying this RectifiedContour with kernel.

Link copied to clipboard

Evaluate curvature for t

Link copied to clipboard
fun direction(t: Double): Vector2
Link copied to clipboard
fun RectifiedContour.distort(errorTolerance: Double = 0.5, maxDepth: Int = 6, samplesPerPiece: Int = 24, distort: (t: Double, position: Vector2) -> Vector2): ShapeContour

Distorts the contour underlying this RectifiedContour using a distortion function that is evaluated on the rectified (proportional to contour length) t parameter.

Link copied to clipboard
fun RectifiedContour.distortUniform(errorTolerance: Double = 0.5, maxDepth: Int = 6, sampleDistance: Double = 4.0, distort: (t: Double, position: Vector2) -> Vector2): ShapeContour

Distorts the contour underlying this RectifiedContour using a distortion function that is evaluated on the rectified (proportional to contour length) t parameter.

Link copied to clipboard
fun RectifiedContour.findLocalMaxima(samples: Int, windowSize: Double, f: ShapeContour.(Double) -> Double): List<LocalMaximum>

Finds local maxima of f sampled along RectifiedContour, using arc-length-uniform sampling so that windowSize (expressed as a fraction of curve length) means the same thing everywhere on the contour, regardless of how unevenly the original contour's segments are distributed.

Link copied to clipboard

Computes an inverse rectified t-value for the given normalized t parameter. This method determines the original parameter space value from a rectified (uniformly distributed) parameter space value.

Link copied to clipboard
Link copied to clipboard
fun RectifiedContour.mix(other: RectifiedContour, blendFunction: (Double) -> Double): ShapeContour

Blends two rectified contours by applying a blend function to their segments.

Link copied to clipboard
fun nearest(query: Vector2): Double
Link copied to clipboard
fun normal(t: Double): Vector2
Link copied to clipboard
fun pose(t: Double): Matrix44
Link copied to clipboard
fun position(t: Double): Vector2
Link copied to clipboard

computes a rectified t-value for originalPath

Link copied to clipboard
fun RectifiedContour.shift(dt: Double): ShapeContour

Shifts the contour by a specified amount along its parameterized path. If the contour is not closed, it returns the original contour unaltered.

Link copied to clipboard
open override fun splitAt(ascendingTs: List<Double>, weldEpsilon: Double = 1.0E-6): List<ShapeContour>

Split contour at ascendingTs

Link copied to clipboard
Link copied to clipboard
open override fun sub(t0: Double, t1: Double): ShapeContour
Link copied to clipboard
fun velocity(t: Double): Vector2
Link copied to clipboard
fun RectifiedContour.warp(basis: RectifiedContour, warp: RectifiedContour, errorTolerance: Double = 0.5, maxDepth: Int = 6, samplesPerPiece: Int = 24): ShapeContour

Warps the current contour by applying a distortion based on the provided basis and warp contours. The operation computes a mapping where the nearest position and normal of the basis contour are used to calculate the displacement applied to the warp contour, creating a warped result.