home

Notes on Quadratic Curves in ℝ²

15 Jan 2015

Quadratic Curves

The general bivariate quadratic curve can be written in the implict form:

$$ ax^2+2bxy+cy^2+2dx+2fy+g=0 $$

Quadratics represent conic sections: lines, ellipses, hyperbolas, and parabolas. For example, with the following coefficients:

$$ a=1,\; b=0,\; c=1,\; d=0,\; f=0,\; g=-1 $$

Is the equation for a circle:

$$ x^2+y^2=1 $$

Quadratic Bézier Curves

Bézier curves can’t exactly express a circle, although a general quadratic curve can. What subset of conic sections are they? The quadratic Bézier is usually written as the set of parametric equations:

$$ x(t) = (1-t)^2x_0+2t(1-t)x_1+t^2x_2 $$
$$ y(t) = (1-t)^2y_0+2t(1-t)y_1+t^2y_2 $$

Deparameterizing the above (using Mathematica to eliminate t) leads to the implicit form:

Implicit Form of Quadratic Bézier

Pulling out the coefficients to match the general form given above:

Coefficients of Quadratic Bézier

The type of quadratic curve can be classified with the discriminant.

Discriminant of Quadratic Bézier

The discriminant is always zero, meaning it is a parabola in the non-degenerate case. I assume it should also be possible to show that degenerate case is coincident lines. Therefore quadratic Béziers can only represent parabolas (and lines), but not ellipses or hyperbolas. See also degenerate conic.

Rational Quadratic Bézier Curves

The Bézier equations can be extended with a denominator of an additional Bernstein polynomial. A weight parameter adds an additional level of control over the curvature. When all of the weights are equal it is equivalent to a non-rational Bézier curve. Usually the endpoint weights are normalized to one, because what matters is relative ratio of the weights, and this normalization simplifies the curve to having a single weight w.

Redefining the Bernstein polynomials in terms of linear interpolation.

Lerp definition of Quadratic Bézier

An example evaluation of the rational equations with a weight of 0.5 and extended t parameter range clearly shows an ellipse:

w=0.5 Rational Quadratic Bézier

This form of the equations also clearly shows the concept of the rational Béziers, which is similar in idea to homogeneous coordinates and the homogeneous divide. The weight denominator is interpolated with the same Bernstein polynomial as the x and y coordinates.

An example evaluation of the rational equations with a weight of 1.5 and extended t parameter range clearly shows a hyperbola:

w=1.5 Rational Quadratic Bézier

The sign of the descriminant of the Rational Bézier depends only on the weight, because the rest of the expression is squared and thus always positive. Looking at a graph of the weight contribution, the curve will be undefined at w of zero, a parabola at w of ±1, an ellipse between -1 and 1, and a hyperbola elsewhere. See also the eccentricity of a conic.

Weight Factor in Discriminant of Rational Quadratic Bézier

Some references that cover the classification of Rational Bézier Curves more formally are here and here.