# September 2012 Archives

## Comparing implicit and parametric functions

In an earlier post I talked about Sederberg *et al.’s* paper that uses Elimination Theory to demonstrate how parametric curves can be represented in implicit form. Reading through the literature it quickly becomes clear that this is important work if you’re interested in rendering parametric curves or surfaces. Unfortunately it can be difficult to get to grips with the theory without also being able to play around with the functions themselves. Consequently I’d expected to spend much of my summer writing software to render the different types of curves for exploring them and play around with their different representations.

That was, until I realised Functy was quite capable of doing it already. Functy’s parametric curves are already perfectly suited to the rendering of parametric equations. This part might be obvious. Less obvious for me was that the colouring of a flat Cartesian surface is perfect for the rendering of the implicit form.

Above are a couple of screenshots showing the two types of function. These are both taken from the example in another paper by Sederberg, Anderson and Goldman about “Implicitization, Inversion, and Intersection of Planar Rational Cubic Curves” (available from ScienceDirect). The curve is a quartic monoid which can be expressed parametrically and implicitly as follows.

Implicitly:

(*x*^{4} - 2*x*^{3}*y* + 3*x*^{2}*y*^{2} - *xy*^{3} +*y*^{4}) + (2*x*^{3} - *x*^{2}*y* + *xy*^{2} + 3*y*^{3}) = 0

Parametrically:

*x* = - (3*t*^{3} + *t*^{2} - *t* + 2) / (*t*^{4} - *t*^{3} + 3*t*^{2} - 2*t* + 1)

*y* = - (3*t*^{4} + *t*^{3} - *t*^{2} + 2*t*) / (*t*^{4} - *t*^{3} + 3*t*^{2} - 2*t* + 1)

In the screenshots the red line is the parametric version of the curve for *t* in the interval (0, 1). The other colours on the surface represent the values of the implicit function. Note that the implicit function actually lies at the boundary of the yellow and blue areas. You can see this slightly better in the 3D version, where the height represents the value of the implicit function. The actual curve occurs only where this is zero - in other words where the surface cuts through the plane *z* = 0.

It was reassuring to see that the parametric curve matches the implicit version. It’s also interesting to note that the implicit version is rendered entirely using the shaders in a resolution-independent way. It’s possible to zoom in as much as you like without getting pixelisation. This is exciting for me since, although it’s not what I’m really trying to achieve (that would be *too* easy!), it hints at the possibility.

## The importance of great literature

I’ve recently been working on the question of whether mathematical surfaces can be rendered entirely using Shaders in a resolution-independent way, by avoiding the need to simplify the curve using triangles first. As part of the research in to this I found myself reading Sederberg, Anderson and Goldman’s 1984 paper “Implicit Representation of Parametric Curves and Surfaces” (available from ScienceDirect). Although not a new paper by computing standards, it’s definitely one of the best papers I’ve read in a long time, and goes to show that previous work is important not just from a legacy perspective.

It’s not just the contemporary relevance of the paper that demonstrates this point, but also its content. As the authors explain at the end of the paper, they present “two important examples of problems deemed unsolvable in the CAD literature, which are, in fact, solvable using century-old theorems.”

I’m not sure why I’ve been quite so surprised by this; I’m sure most people will consider this obvious. I should also add that Sederberg is very well cited in the rasterisation literature. However, it’s nice to come across such a clear example of less recent research that remains essential (and enjoyable) reading today.

I recommend the paper if you’ve not already read it. It’s very well written and contains some fascinating but clearly explained work.