# Plotting quadratic equation in two variables

I need to draw a conic curve when quadratic equation in two variables is given:

$$Ax^2 + Bxy + Cy^2 + Dx + Ey + F = 0$$

Since I can't simply check whether the pixel is solving the equation, what I'm doing is plotting this function as a height map in 2D: the closest the function value to 0 the more greener the pixel, so it looks like this:

But then I get a non unique curve, in some places the curve is thick and in others thin and the more sharp the curve the more thick the curve. I know that it's because the function is still close to 0 at this point.

So I tried normalizing the values by dividing them with the partial derivatives, since they are greater at the thin place and that way the curve should become more unique, but then it got even worst:

So do anyone know of a way to draw the curve exactly as it is (only the correct or almost correct solutions), or how to correctly normalize my solution.

Solution by Henning Makholm:

"Plot all pixels where the sign of the polynomial differs from that of one of its neighbors."

Result:

I did lost the fade effect but it's very simple and yet still looking good, thanks.

-
You can get some crude anti-aliasing as follows: Let $(x',y')$ be the neighbor pixel to $(x,y)$ whose value differs most from $f(x,y)$ (in the appropriate direction), and color pixel $(x,y)$ in proportion to $\frac{|f(x',y')|}{|f(x',y')-f(x,y)|}$. – Henning Makholm Sep 28 '12 at 18:39