Transformations Routines.


All transformations are cumulative, so if you rotate something and then do a translate you are translating relative to the rotated axes. If you need to preserve the current transformation matrix use pushmatrix(), do the drawing, and then call popmatrix() to get back where you were before.

When doing transformations, ensure your objects remain in the viewing volume or they will be clipped. See routines such as ortho(3) for more information.

transformations

translate(x, y, z)

Set up a translation.

   Fortran:
      subroutine translate(x, y, z)
      real x, y, z
   C:
      translate(x, y, z)
      float     x, y, z;
   Pascal:
      procedure Translate(x, y, z: real)

scale(x, y, z)

Set up scaling factors in x, y, and z axis.

    Fortran:
         subroutine scale(x, y, z)
         real x, y, z
    C:
         scale(x, y, z)
              float     x, y, z;
    Pascal:
         procedure Scale(x, y, z: real)

rotate(angle, axis)

Set up a rotation in axis axis. Where axis is one of 'x', 'y', or 'z'.

    Fortran:
         subroutine rotate(angle, axis)
         real angle
         character axis
    C:
         rotate(angle, axis)
              float     angle;
              char axis;
    Pascal:
         procedure Rotate(angle: real; axis: char)