Algebraic surfaces are surfaces whose points (*x*,*y*,*z*)
satisfy a polynomial of three variables *p*(*x*,*y*,*z*)=0.
For example, a sphere is an algebraic surface since it can be described as

(The degree of an algebraic surface is the highest degree of all of its terms. Thus, spheres are degree two algebraic surfaces. It is very difficult to display algebraic surfaces correctly because some of them may extend to infinity and some of them are extremely complicated.x - a)^{2}+ (y - b)^{2}+ (z - c)^{2}=r^{2}

POVRAY can raytrace any algebraic surface of degree less than or equal to 7. In general, this range is sufficient for most applications because algebraic surfaces of degree higher than 7 are rarely used and are very complex. POVRAY supports two forms. One for quadric, cubic and quartic surfaces which are commonly used. The other is a general form.

where these ten values are coefficients of a quadric polynomial as follows:quadric { < A, B, C >, < D, E, F >, < G, H, I >, J // pigment and finish }

For example, to trace the following quadric surfaceAx^{2}+By^{2}+Cz^{2}+Dxy+Exz+Fyz+Gx+Hy+Iz+J= 0

10use the followingx^{2}+y^{2}+ 2z^{2}+ 3xy+ 4xz+yz+ 5x+y+ 10z= 0

Note that in general geometric transformations are required to bring the surface into your camera's coverage. Also note that the above equation is different from what has been discussed in class. The result a flat ellipsoid as shown below:quadric { < 10, 1, 2 >, < 3, 4, 1 >, < 5, 1, 10 >, 0 // pigment, finish and transformations }

Click **here** to download the scene file.

There are 20 coefficients organized as follows:A_{1}x^{3}+A_{2}x^{2}y+A_{3}x^{2}z+A_{4}x^{2}+A_{5}xy^{2}+A_{6}xyz+A_{7}xy+A_{8}xz^{2}+A_{9}xz+A_{10}x+A_{11}y^{3}+A_{12}y^{2}z+A_{13}y^{2}+A_{14}yz^{2}+A_{15}yz+A_{16}y+A_{17}z^{3}+A_{18}z^{2}+A_{19}z+A_{20}= 0

All 20 coefficients are in acubic { < A1, A2, A3, ...., A20 > sturm // optional // pigment, finish and transformations }

To trace the following cubic surface

use the following:x^{3}- 0.11111xz^{2}+y^{2}= 0

cubic { // x3 x2y x2z x2 xy2 < 1, 0, 0, 0, 0, // xyz xy xz2 xz x 0, 0, -0.11111, 0, 0, // y3 y2z y2 yz2 yz 0, 0, 1, 0, 0, // y z3 z2 z Const 0, 0, 0, 0, 0 > sturm clipped_by { box { < -2, -2, -2 >, < 2, 2, 2 > } } }

Because cubic surfaces extend to infinity, frequently a **clipped_by {}** is
used to cut off unwanted part. It may require several tries to get the result
right. Here is the result:

Click **here** to download this scene file.

A_{1}x^{4}+A_{2}x^{3}y+A_{3}x^{3}z+A_{4}x^{3}+A_{5}x^{2}y^{2}+A_{6}x^{2}yz+A_{7}x^{2}y+A_{8}x^{2}z^{2}+A_{9}x^{2}z+A_{10}x^{2}+A_{11}xy^{3}+A_{12}xy^{2}z+A_{13}xy^{2}+A_{14}xyz^{2}+A_{15}xyz+A_{16}xy+A_{17}xz^{3}+A_{18}xz^{2}+A_{19}xz+A_{20}x+A_{21}y^{4}+A_{22}y^{3}z+A_{23}y^{3}+A_{24}y^{2}z^{2}+A_{25}y^{2}z+A_{26}y^{2}+A_{27}yz^{3}+A_{28}yz^{2}+A_{29}yz+A_{30}y+A_{31}z^{4}+A_{32}z^{3}+A_{33}z^{2}+A_{34}z+A_{35}= 0

These coefficients are organized as follows:

To trace the following quartic surfacequartic { < A1, A2, ...., A35 > sturm // optional // pigment, finish and transformations }

use the followingx^{4}+x^{2}y^{2}- 3x^{2}y+ 2.5x^{2}z^{2}+ 1.5y^{2}z^{2}- 3yz^{2}+ 1.5z^{4}= 0

quartic { // x^4 x^3y x^3z x^3 x^2y^2 < 1, 0, 0, 0, 1, // x^2yz x^2y x^2z^2 x^2z x^2 0, -3, 2.5, 0, 0, // xy^3 xy^2z xy^2 xyz^2 xyz 0, 0, 0, 0, 0, // xy xz^3 xz^2 xz x 0, 0, 0, 0, 0, // y^4 y^3z y^3 y^2z^2 y^2z 0, 0, 0, 1.5, 0, // y^2 yz^3 yz^2 yz y 0, 0, -3, 0, 0 // z^4 z^3 z^2 z Const 1.5, 0, 0, 0, 0 > sturm // pigment, finish and transformations }

The result is the following well-known cross-cup surface

Click **here** to download the scene file.

where the degreepoly { n, // degree of the surface < A1, A2, ..... > // coefficients sturm // optional // pigment, finish and transformations }