Package-level declarations

Types

Link copied to clipboard
class PHQuintic

A planar Pythagorean-hodograph (PH) quintic: a quintic Bézier curve whose hodograph, its derivative, is the square of a complex quadratic, r'(t) = w(t)², with w(t) = w0·(1-t)² + w1·2t(1-t) + w2·t². Its parametric speed |r'(t)| = |w(t)|² is therefore a polynomial, so unlike for ordinary Béziers the arc length is a polynomial too, the unit tangent and normal are rational, and so are its offset curves. See Farouki, "Pythagorean-Hodograph Curves: Algebra and Geometry Inseparable" (Springer, 2008).

Functions

Link copied to clipboard
fun phQuinticHermite(start: Vector2, startDerivative: Vector2, end: Vector2, endDerivative: Vector2): PHQuintic

The PH quintic from start to end with derivatives startDerivative and endDerivative at its ends, after Farouki and Neff, "Hermite interpolation by Pythagorean hodograph quintics" (Mathematics of Computation, 1995). With w0 = √d0 and w2 = ±√d1 the end condition ∫w² = end - start is a quadratic in w1, 2·w1² + 3(w0 + w2)·w1 + 3w0² + w0w2 + 3w2² - 15(end - start) = 0, so there are four interpolants. The one with the smallest absolute rotation of its tangent is returned, which is the one without loops for reasonable data.

Link copied to clipboard
fun List<Vector2>.phQuintics(closed: Boolean, offset: Double = 0.0, tolerance: Double = 0.01, polarity: YPolarity = YPolarity.CW_NEGATIVE_Y): ShapeContour

Converts this polyline into a C2 spline of Pythagorean-hodograph quintics through all points, see phQuinticSpline, as a contour of cubic Béziers within tolerance. With a non-zero offset the offset curve at that distance is returned; it is evaluated exactly, PH curves have rational offsets, and approximated within tolerance too.

Link copied to clipboard
fun List<Vector2>.phQuinticSpline(closed: Boolean): List<PHQuintic>

The C2 interpolating spline of PH quintics through this polyline, one per edge, after Albrecht and Farouki, "Construction of C2 Pythagorean-hodograph interpolating splines by the homotopy method" (Advances in Computational Mathematics, 1996).