For reasons that will become clear in a couple of posts, I wanted to be able to calculate quadratic Bézier curve parameters from a focus and horizontal directrix.
A focus and directrix are enough to define a parabola (in fact a parabola is the locus of points equidistance from a point, the focus, and a line, the directrix).
A quadratic Bézier curve is a section of a parabola and is defined by three points, according to the formula:
B(t) = (1-t)²P₀ + 2t(1-t)P₁ + t²P₂, t ∈ [0, 1]
Here's how I came to my result...
Given the directrix is horizontal,
and by definition:
Now even though somewhat arbitrary and assuming the directrix is below the focus,
So,
Therefore,
for some α where (Fx, Fy) is focus and Dy is y-coordinate of directrix.
By definition,
But, given P₀ and P₂ have a y-coordinate of 0 and directrix is horizontal,
Therefore,
And so, assuming the directrix is horizontal and below the focus, the following Bézier curve parameters can also be used to create the parabola:
UPDATE (2008-11-29): Now see Voronoi Canvas Tutorial, Part III for the motivation for wanting to do this as well as an implementation in Javascript for drawing parabolae in a canvas element.
The original post was in the category: mathematics but I'm still in the process of migrating categories over.