Reference:Quadric

From POV-Wiki
Jump to navigation Jump to search

The quadric object can produce shapes like paraboloids (dish shapes) and hyperboloids (saddle or hourglass shapes). It can also produce ellipsoids, spheres, cones, and cylinders but you should use the sphere, cone, and cylinder objects built into POV-Ray because they are faster than the quadric version.

Note: Do not confuse "quaDRic" with "quaRTic". A quadric is a 2nd order polynomial while a quartic is 4th order.

Quadrics render much faster and are less error-prone but produce less complex objects. The syntax is:

QUADRIC:
  quadric {
    <A,B,C>,<D,E,F>,<G,H,I>,J
    [OBJECT_MODIFIERS...]
    }

Although the syntax actually will parse 3 vector expressions followed by a float, we traditionally have written the syntax as above where A through J are float expressions. These 10 float that define a surface of x, y, z points which satisfy the equation A x2 + B y2 + C z2 + D xy + E xz + F yz + G x + H y + I z + J = 0

Different values of A, B, C, ... J will give different shapes. If you take any three dimensional point and use its x, y and z coordinates in the above equation the answer will be 0 if the point is on the surface of the object. The answer will be negative if the point is inside the object and positive if the point is outside the object. Here are some examples:

X2 + Y2 + Z2 - 1 = 0 Sphere
X2 + Y2 - 1 = 0 Infinite cylinder along the Z axis
X2 + Y2 - Z2 = 0 Infinite cone along the Z axis

The easiest way to use these shapes is to include the standard file shapes.inc into your program. It contains several pre-defined quadrics and you can transform these pre-defined shapes (using translate, rotate and scale) into the ones you want. For a complete list, see the file shapes.inc.