biarcs

fun List<Vector2>.biarcs(closed: Boolean, tangents: List<Vector2>? = null, tangentMethod: BiarcTangents = BiarcTangents.CatmullRom(), offset: Double = 0.0, polarity: YPolarity = YPolarity.CW_NEGATIVE_Y): ShapeContour(source)

Converts this polyline into a contour of biarcs: every pair of consecutive points is joined by two circular arcs that leave the first point in its tangent direction, meet tangentially at a joint, and arrive at the second point in its tangent direction. Unlike org.openrndr.extra.shapes.arcer.arcer, every edge is fixed by its own end tangents, so the contour is tangent-continuous everywhere, also where it closes, and an edge doesn't influence the edges after it.

Of the one-parameter family of biarcs between two points with tangents, the one with equal tangent lengths at both ends is used. When both tangents are equal the joint is the midpoint of the chord.

When tangents is null the tangents are derived from the points by tangentMethod, by default the centripetal Catmull-Rom spline through the points, see BiarcTangents. Collinear points then give a straight line and two points a straight segment.

With a non-zero offset the parallel curve at that distance is returned, which is exact because the offset of an arc is the concentric arc. Positive offsets lie on the side of the normal (-y, x) of the direction of travel, which is to the right in a y-down frame.

Arcs are approximated with one cubic Bézier per 90 degrees of turn.

Parameters

closed

whether the polyline is closed, the last point should then not repeat the first

tangents

the tangent direction at every point, or null to derive them with tangentMethod

tangentMethod

how tangents are derived from the points when tangents is null

offset

the signed distance of the returned parallel curve, 0.0 for the curve through the points

polarity

the polarity of the resulting contour