Package-level declarations

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
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.

fun Segment2D.distort(errorTolerance: Double = 0.5, maxDepth: Int = 6, samplesPerPiece: Int = 24, distort: (Vector2) -> Vector2): List<Segment2D>

Approximates the curve you'd get by applying an arbitrary point-wise distort function to every point of curve, while representing the result as adaptively-split cubic Beziers.

fun Segment2D.distort(errorTolerance: Double = 0.5, maxDepth: Int = 6, samplesPerPiece: Int = 24, distort: (Vector2, Double) -> Vector2): List<Segment2D>

Parameter-aware variant of distort: the distort function additionally receives the global parameter t of the original curve, which makes it possible to express displacement fields that vary along the curve, for example tapering toward the endpoints.

fun ShapeContour.distort(errorTolerance: Double = 0.5, maxDepth: Int = 6, samplesPerPiece: Int = 24, distort: (Vector2) -> Vector2): ShapeContour

Distorts the points along this ShapeContour by applying a specified distortion function. The output is a new ShapeContour with segments that adaptively approximate the distorted curve while maintaining the original closed property.

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 Shape.envelope(basis: Rectangle, target: BezierPatch): Shape

Transforms the shape by distorting its contours based on a mapping between a reference rectangle and a target Bézier patch.

fun ShapeContour.envelope(basis: Rectangle, target: BezierPatch): ShapeContour

Distorts the current ShapeContour by mapping its points to a target BezierPatch using the parameterization derived from the basis rectangle.

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.

fun Shape.warp(basis: RectifiedContour, warp: RectifiedContour, errorTolerance: Double = 0.5, maxDepth: Int = 6, samplesPerPiece: Int = 24): Shape

Warps the shape by applying a transformation based on provided basis and warp contours. Each contour within the shape undergoes the transformation process to produce a new warped shape.