Previous:Plane Main Index Next:Quadric

Higher order polynomial surfaces may be defined by the use of a

shape. The syntax is**poly**

*POLY:***poly {***Order***,***<A1***,***A2***,***A3***,***... An> [POLY_MODIFIERS...]***}***POLY_MODIFIERS:*

|**sturm***OBJECT_MODIFIER*

**
**

where *Order* is an integer number from 2 to 7 inclusively that specifies the order of the equation. *A1, A2, ... An* are float values for the coefficients of the equation. There are *m* such terms where

n = ((Order+1)*(Order+2)*(Order+3))/6.

The

object is an alternate way to specify 3rd order polys. Its syntax is:**cubic**

*CUBIC:***cubic {***<A1***,***A2***,***A3***,***... A20> [POLY_MODIFIERS...]***}**

**
**

**
**

Also 4th order equations may be specified with the

object. Its syntax is:**quartic**

*QUARTIC:***quartic {***<A1***,***A2***,***A3***,***... A35> [POLY_MODIFIERS...]***}**

**
**

**
**

The following table shows which polynomial terms correspond to which x,y,z factors. Remember

is actually a 3rd order polynomial and **cubic**

is 4th order.**quartic**

2nd |
3rd |
4th |
5th |
6th |
7th |
5th |
6th |
7th |
6th |
7th |
|||||

A |
x |
x |
x |
x |
x |
x |
A |
y |
xy |
x |
A |
z |
xz |
||

A |
xy |
x |
x |
x |
x |
x |
A |
y |
xy |
x |
A |
z |
xz |
||

A |
xz |
x |
x |
x |
x |
x |
A |
y |
xy |
x |
A |
z |
xz |
||

A |
x |
x |
x |
x |
x |
x |
A |
y |
xy |
x |
A |
1 |
x |
||

A |
y |
xy |
x |
x |
x |
x |
A |
y |
xy |
x |
A |
y |
|||

A |
yz |
xyz |
x |
x |
x |
x |
A |
yz |
xyz |
x |
A |
y |
|||

A |
y |
xy |
x |
x |
x |
x |
A |
yz |
xyz |
x |
A |
y |
|||

A |
z |
xz |
x |
x |
x |
x |
A |
yz |
xyz |
x |
A |
y |
|||

A |
z |
xz |
x |
x |
x |
x |
A |
yz |
xyz |
x |
A |
y |
|||

A |
1 |
x |
x |
x |
x |
x |
A |
y |
xy |
x |
A |
y |
|||

A |
y |
xy |
x |
x |
x |
A |
z |
xz |
x |
A |
y |
||||

A |
y |
xy |
x |
x |
x |
A |
z |
xz |
x |
A |
y |
||||

A |
y |
xy |
x |
x |
x |
A |
z |
xz |
x |
A |
y |
||||

A |
yz |
xyz |
x |
x |
x |
A |
z |
xz |
x |
A |
y |
||||

A |
yz |
xyz |
x |
x |
x |
A |
z |
xz |
x |
A |
y |
||||

A |
y |
xy |
x |
x |
x |
A |
1 |
x |
x |
A |
y |
||||

A |
z |
xz |
x |
x |
x |
A |
y |
xy |
A |
y |
|||||

A |
z |
xz |
x |
x |
x |
A |
y |
xy |
A |
y |
|||||

A |
z |
xz |
x |
x |
x |
A |
y |
xy |
A |
y |
|||||

A |
1 |
x |
x |
x |
x |
A |
y |
xy |
A |
y |
|||||

A |
y |
xy |
x |
x |
A |
y |
xy |
A |
y |
||||||

A |
y |
xy |
x |
x |
A |
y |
xy |
A |
y |
||||||

A |
y |
xy |
x |
x |
A |
y |
xy |
A |
y |
||||||

A |
y |
xy |
x |
x |
A |
y |
xy |
A |
y |
||||||

A |
y |
xy |
x |
x |
A |
y |
xy |
A |
y |
||||||

A |
y |
xy |
x |
x |
A |
y |
xy |
A |
yz |
||||||

A |
yz |
xyz |
x |
x |
A |
y |
xy |
A |
yz |
||||||

A |
yz |
xyz |
x |
x |
A |
y |
xy |
A |
yz |
||||||

A |
yz |
xyz |
x |
x |
A |
y |
xy |
A |
yz |
||||||

A |
y |
xy |
x |
x |
A |
y |
xy |
A |
yz |
||||||

A |
z |
xz |
x |
x |
A |
y |
xy |
A |
yz |
||||||

A |
z |
xz |
x |
x |
A |
yz |
xyz |
A |
y |
||||||

A |
z |
xz |
x |
x |
A |
yz |
xyz |
A |
z |
||||||

A |
z |
xz |
x |
x |
A |
yz |
xyz |
A |
z |
||||||

A |
1 |
x |
x |
x |
A |
yz |
xyz |
A |
z |
||||||

A |
y |
xy |
x |
A |
yz |
xyz |
A |
z |
|||||||

A |
y |
xy |
x |
A |
y |
xy |
A |
z |
|||||||

A |
y |
xy |
x |
A |
z |
xz |
A |
z |
|||||||

A |
y |
xy |
x |
A |
z |
xz |
A |
z |
|||||||

A |
y |
xy |
x |
A |
z |
xz |
A |
1 |

Polynomial shapes can be used to describe a large class of shapes including the torus, the lemniscate, etc. For example, to declare a quartic surface requires that each of the coefficients (*A1 ... A35*) be placed in order into a single long vector of 35 terms.

As an example let's define a torus the hard way. A Torus can be represented by the equation:

x^{4} + y^{4} + z^{4} + 2 x^{2} y^{2} + 2 x^{2} z^{2} + 2 y^{2} z^{2} -

2 (r_0^{2} + r_1^{2}) x^{2} + 2 (r_0^{2} - r_1^{2}) y^{2} -

2 (r_0^{2} + r_1^{2}) z^{2} + (r_0^{2} - r_1^{2})^{2} = 0

Where r_0 is the major radius of the torus, the distance from the hole of the donut to the middle of the ring of the donut, and r_1 is the minor radius of the torus, the distance from the middle of the ring of the donut to the outer surface. The following object declaration is for a torus having major radius 6.3 minor radius 3.5 (Making the maximum width just under 20).

// Torus having major radius sqrt(40), minor radius sqrt(12) quartic { < 1, 0, 0, 0, 2, 0, 0, 2, 0, -104, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 0, 56, 0, 0, 0, 0, 1, 0, -104, 0, 784 > sturm }

Poly, cubic and quartics are just like quadrics in that you don't have to understand what one is to use one. The file `shapesq.inc`

has plenty of pre-defined quartics for you to play with.

Polys use highly complex computations and will not always render perfectly. If the surface is not smooth, has dropouts, or extra random pixels, try using the optional keyword

in the definition. This will cause a slower but more accurate calculation method to be used. Usually, but not always, this will solve the problem. If sturm doesn't work, try rotating or translating the shape by some small amount.**sturm**

There are really so many different polynomial shapes, we can't even begin to list or describe them all. If you are interested and mathematically inclined, an excellent reference book for curves and surfaces where you'll find more polynomial shape formulas is:

"The CRC Handbook of Mathematical Curves and Surfaces"

David von Seggern

CRC Press, 1990

Previous:Plane Main Index Next:Quadric