hobbyCurve

fun ShapeContour.hobbyCurve(curl: Double = 0.0): ShapeContour(source)
fun Shape.hobbyCurve(curl: Double = 0.0): Shape(source)


fun hobbyCurve(points: List<Vector2>, closed: Boolean = false, curl: Double = 0.0, tensions: (chordIndex: Int, inAngleDegrees: Double, outAngleDegrees: Double) -> Pair<Double, Double> = { _, _, _ -> Pair(1.0, 1.0) }): ShapeContour(source)

Generates a smooth contour passing through a set of points based on Hobby's algorithm.

Return

A ShapeContour object representing the smoothed curve based on Hobby's algorithm.

Parameters

points

A list of 2D points through which the curve should pass.

closed

A boolean value indicating whether the curve is closed (true) forming a loop, or open (false). The default is false.

curl

A parameter that controls the curvature of the open-ended curve. Only applicable if the curve is not closed. The default is 0.0.

tensions

A lambda function that accepts the chord index (an integer) and returns a pair of tension values (Double) for the curve's control points. These tensions influence how tightly the curve conforms to the points. The default lambda assigns both values as 1.0.


fun hobbyCurve(points: List<Vector3>, closed: Boolean = false, curl: Double = 0.0, tensions: (chordIndex: Int, inAngleDegrees: Double, outAngleDegrees: Double) -> Pair<Double, Double> = { _, _, _ -> Pair(1.0, 1.0) }): Path3D(source)

Uses Hobby's algorithm to construct a Path3D through a given list of points.

Return

A Path3D through points.

Parameters

points

The list of points through which the curve should go.

closed

Whether to construct a closed or open curve.

curl

The 'curl' at the endpoints of the curve; this is only applicable when closed is false. Best results for values in -1, 1, where a higher value makes segments closer to circular arcs.

tensions

A function that returns the in and out tensions given a chord index.