Any non degenerate regular quadratic Bézier is essentialy a affine image of a unit parabola $y=x^2$. An important property of such transformation is that it have orthogonal and uniformly scaled basis. The intuition behind this is that a parabola is defined with a line (directrix) and a point (focus), and no affine transformation can either skew or non-uniformly scale this system. The transformation matrix can be calculated in the following way.

Non-degenerate case

For a quadratic Bézier, defined with control points $A$, $C$, $B$ (see the pic) find a midpoint $M$ of $AB$. The line $CM$ is parallel to the axis of the parabola. Normalizing $\vec{CM}$ we get vector $\vec{Y}$, and rotating it 90° to the right we get vector $\vec{X}$. These vectors with scale applied would form a basis of the transformation.

Now to find endpoints $x_0$ and $x_1$ of the parabola segment we should calculate the tangents of angles $\alpha_0$ and $\alpha_1$:

Since $AC$ and $CB$ are tangents to the parabola at points $A$ and $B$, considering $(x^2)’ = 2 x$, we get

Projecting $\vec{BA}$ to $\vec{X}$ and dividing by distance between $x_0$ and $x_1$, we get the scale of the transformation:

The vertex of the parabola can be found as

This would give us a translational part, and we can build the transformation matrix:

Degenerate cases

In degenerate cases, (a) and (b) on the pic, a quadratic Bézier is either a line segment $AB$ or two line segments $AP$ and $PB$, where

with

(in a non-degenerate case the tangent to this point is orthogonal to a bisector of angle $\angle ACB$).

Arc length

In degenerate cases the arc length is the length of the corresponding line segments. In non-degenerate case, the arc length of a quadratic Bézier can be found as

where

Nearest point on a curve

Degenerate cases are trivial. In non-degenerate case, nearest point on a curve to a point $T$ can be found by first transforming $T$ to the parabola coordinate system $S = Q^{-1} T$ and then solving the cubic equation

The roots of this equation correspond to the closest points to $S$ on the parabola. Clamp the roots to $[x_0,x_1]$, choose the point nearest to $S$ and transform it back to the world space.

Compass and Straightedge construction

Example of compass and straightedge construction with Geogebra:

https://www.geogebra.org/geometry/caa8bnuh

Comments