next up previous contents index
Next: Index Up: Toolkit classes: MatrixVector, Previous: Colors

Transforms

  A transform struct has two matrices in it, and is often used for objects so that we have a matrix to go from primitive space to worldspace (fore) and another to go back to worldspace (aft).

The Transform class is a toolkit of transform functions that is used by Mirage. They are accessed as Transform::<function_name>(a,b,c) eg. Transform::unit(tran);

  // Apply the unit transform.
  inline static void unit(transform a)

  // Set one transform to another.
  inline static void set(transform a, transform b)
 
  // Invert a transform.
  inline static void invert(transform t, transform inv)

  // The combine for transforms is used a lot everywhere.
  // combine(a, b, c) means that the fore matrix of c (the transform
  // from primitive to world space) is equivalent to a then b. In other
  // words, the primitive has first a done to it, then b. 
  inline static void combine(transform a, transform b, transform result)

  // rotate(t, axis, axis, angle) rotates the given transform from one axis
  // to the next axis by the angle specified.
  inline static void rotate(transform t, axis from, axis to, double angle)

  // rotate(t, axis, angle) rotates the transform around the axis
  // by the angle specified.
  inline static void rotate(transform t, axis around, double angle)

  // rotate(t, forward, up) rotates the given transform so that its X axis
  // points along the forward vector and its Z axis points in the direction of
  // the up vector.
  inline static void rotate(transform t, vector given\_fwd, vector given\_up)

  // shift(t, xshift, yshift, zshift) translates the given transform.
  inline static void shift(transform t, double xshift, double yshift,
			   double zshift)

  // shift(t, shift\_vec) translates the given transform.
  inline static void shift(transform t, vector shift\_vec)

  // stretch(t, xstretch, ystretch, zstretch) stretches the given transform.
  inline static void stretch(transform t, double xstretch, double ystretch,
			     double zstretch)

  // scale(t, scale\_factor) scales the given transform.
  inline static void scale(transform t, double scale\_factor)

  // scale(t, scale\_factor) scales the given transform.
  inline static void scale(transform t, double scale\_factor)

  // shear(t, fromaxis, towardsaxis, amount) shears the given transform.
  // The point at distance 1 along fromaxis goes to the same point
  // that is (amount) moved along the towardsaxis.
  // e.g. shear(X, Z, 0.5) takes (1, 0, 0) to (1, 0, 0.5).
  inline static void shear(transform t, axis from, axis to, double amount)



Sophie Day
Fri Feb 20 15:47:19 NZDT 1998