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, foldMode: FoldMode = FoldMode.FOLD, 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.extractBoundaryEigenModes(count: Int, resolution: Int = 128, random: Random = Random(0)): List<BoundaryEigenMode>

Extracts the count lowest-frequency eigenmodes of this rectified contour's outline, ignoring its interior entirely -- the boundary-only counterpart to Shape.extractEigenModes. resolution parameters equidistant in rectified (arc-length) space are treated as a cycle graph, and its graph-Laplacian eigenvectors extracted; see org.openrndr.extra.math.eigenmodes.extractCycleEigenModes. A RectifiedContour is required rather than a plain ShapeContour specifically so that equal steps in t are equal steps in arc length -- true by construction here, since ts[i] = i / resolution in rectified space -- which is what the cycle graph's uniform edge weights assume.

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

Evaluates a normal at rectified t such that it is rotated towards the normal of the neighbouring segment when t lies within radius (in arc length) of a corner formed by a segment join.

Link copied to clipboard

Evaluates a normal at rectified t such that it is linearly blended with the normal of the neighbouring segment when t lies within radius (in arc length) of a corner formed by a segment join.

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.