This tutorial looks at the basics of creating patterns defined within a 2D polar
coordinate system. Using polar coordinates is somewhat unusual because the
majority of effects applied by shaders generally depend on the direct use of 2D 'st' texture coordinates
and/or the 3D coordinates of points, vectors and normals such as the global variables
Locations within Cartesian coordinate systems are measured relative to the intersection
of fixed coordinate axes that are
perpendicular to each other. For example, figure 1 shows the coordinates (
Figure 2 shows the coordinates (
2D Polar Coordinates
Figure 3 illustrates how the location of a point, within a polar coordinate system, is
specified by distance (
Relative to the center of the 1 x 1 polygon, shown in figure 3, the coordinates of
the hilited box are,
Listing 1 - polar.h
The School of Mathematics and Statistics at the University of St.Andrews, Scotland maintains a web site of "Famous Curves". Many of the curves are defined by formula that require the use of polar coordinates. For example, figure 4 uses the polar description of a curve called the "Trisectrix of Maclaurin"
Listing 2 provides the code for the shader that produced the pattern shown above. A sample rib file, listing 3, demonstrates the use of the shader.
Listing 2 - maclaurin.sl
Listing 3 - maclaurin.rib
© 2002- Malcolm Kesson. All rights reserved.