Package-level declarations

Functions

Link copied to clipboard
fun distortedSegment(curve: Segment2D, samples: Int = 40, errorTolerance: Double = 0.5, maxDepth: Int = 8, distort: (Vector2) -> Vector2): List<Segment2D>

Same idea as before: sample the curve, distort each sample, fit tangent-continuous beziers to the result.

Link copied to clipboard
fun fitCubicBeziers(points: List<Vector2>, errorTolerance: Double = 1.0, maxDepth: Int = 10, minPointsToSplit: Int = 5, tangentWindow: Int = 1, preferLowCurvatureSplits: Boolean = true, curvatureSearchRadius: Int = 3): List<Segment2D>

Fits a polyline of points with one or more tangent-continuous cubic Beziers, splitting wherever a single piece can't stay within errorTolerance. Compared to the plain least-squares version:

Link copied to clipboard
fun List<Segment2D>.toContour(): ShapeContour

Stitch the fitted pieces into a single open contour, e.g. for drawing.