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

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, as for org.openrndr.extra.shapes.arcer.arcer.

Properties

Link copied to clipboard
val controlPoints: List<Vector2>

The six control points of the quintic Bézier.

Link copied to clipboard
val end: Vector2

The end point.

Link copied to clipboard

The exact arc length.

Link copied to clipboard
val start: Vector2

The start point.

Functions

Link copied to clipboard

The exact arc length from the start to parameter t.

Link copied to clipboard
fun contour(offset: Double = 0.0, tolerance: Double = 0.01, polarity: YPolarity = YPolarity.CW_NEGATIVE_Y): ShapeContour

The curve, or its offset at offset, as a contour of cubic Béziers within tolerance, see segments.

Link copied to clipboard

The signed curvature 2·Im(conj(w)·w') / |w|⁴, positive where the curve turns towards the normal.

Link copied to clipboard
fun derivative(t: Double): Vector2

The derivative r'(t) = w(t)².

Link copied to clipboard
fun normal(t: Double): Vector2

The unit normal (-y, x) of the tangent.

Link copied to clipboard
fun offset(t: Double, distance: Double): Vector2

The exact point of the offset curve at distance distance along the normal.

Link copied to clipboard
fun offsetDerivative(t: Double, distance: Double): Vector2

The derivative of the offset curve, r'(t)·(1 - distance·κ(t)).

Link copied to clipboard

The parameter at which the arc length from the start equals length, by Newton's method on the polynomial.

Link copied to clipboard
fun position(t: Double): Vector2

The position at parameter t in 0, 1.

Link copied to clipboard
fun segments(offset: Double = 0.0, tolerance: Double = 0.01): List<Segment2D>

Cubic Bézier segments that approximate the curve, or its offset at offset, within tolerance. Every piece matches the position and derivative exactly at both ends, pieces are halved until their midpoint deviates less than tolerance.

Link copied to clipboard

The parametric speed |r'(t)| = |w(t)|², a polynomial.

Link copied to clipboard
fun tangent(t: Double): Vector2

The unit tangent w²/|w|², rational in t.