Visualising Conic Sections

x² +
y² +
xy +
xz +
yz +
Your browser doesn't support HTML5

In the WebGL canvas above, the user can visualize conic sections by altering the coefficients of the formula above the canvas. The conic section is shown for z = 1. Conic sections are defined by the following quadratic form.

$$ ax^2 + by^2 + 2cxy + 2dxz + 2eyz + fz^2 = 0 $$

$$ \Leftrightarrow \begin{pmatrix} x & y & z \end{pmatrix} \begin{pmatrix} a & c & d \\ c & b & e \\ d & e & f \end{pmatrix} \begin{pmatrix} x \\ y \\ z \end{pmatrix} = 0 $$

Aliasing is reduced by implementing rudimentary anisotropic filtering as discussed in:

There are two rendering modes.

  • One conic tracing renderer that tests for each pixel whether the horizontal, vertical or one of the two diagonal lines going through this pixel intersects the conic section in the vicinity of the point. To read more about how to intersect lines with conics, please refer to chapter 11.3 "Intersecting a Conic and a Line" in the book on projective geometry by Richter-Gebert [2011]1. This renderer renders conic section curves with perfectly equal thickness at all points, but may miss degenerate conics formed by two complex lines with a double real point on them.

  • A conic sketch renderer that evaluates the quadratic form shown above and checks whether the evaluated value for a point is close to zero. It uses the first derivative of the quadratic form wrt. the spatial coordinates to normalize this value, but this is only approximate, so equal thickness at all points is not guaranteed. It does not miss any real degenerate conics.

Another possibility for a conic section renderer would be to first determine the conic section type (e.g., ellipse, parabola or hyperbola for real nondegenerate conics) and then to render the conic section by deriving a parametrization for the type of underlying curve. How to determine the conic section type depending on the eigenvalue signatures of the matrix representing a quadratic form can be found in chapter 9 of the book by Richter-Gebert [2011]1.

  1. Jürgen, Richter-Gebert. (2011). Perspectives on projective geometry. A guided tour through real and complex geometry. 10.1007/978-3-642-17286-1. ↩︎