All Packages  This Package  Class Hierarchy  Class Search  Index

Class acg.stuttgart.rich.tmatrix.Tmatrix
java.lang.Object
   |
   +----acg.stuttgart.rich.tmatrix.Tmatrix

  Summary

public class  Tmatrix
     extends java.lang.Object
{
          // Fields 15
     public static final int IDENTITY;
     public static final int MAX_DEPTH;
     public static final int ORTHOGRAPHIC;
     public static final int ORTHONORMAL_BASIS;
     public static final int PERSPECTIVE;
     public static final int ROTATE;
     public static final int ROTATEX;
     public static final int ROTATEY;
     public static final int ROTATEZ;
     public static final int SCALE;
     public static final int TMATRIX_COMPOSITION;
     public static final int TRANSLATE;
     public static final int UNSPECIFIED;
     public static float[] cos;
     public static float[] sin;

          // Constructors 1
     public Tmatrix();

          // Methods 19
     public void backward(Vector3D, Vector3D);
     public void backwardArray(Vector3D[], Vector3D[], int);
     public void compose(Tmatrix);
     public void forward(Vector3D, Vector3D);
     public void forwardArray(Vector3D[], Vector3D[], int);
     public void frustum(float, float, float, float, float, float);
     public void identity();
     public void pop() throws TmatrixException;
     public void push() throws TmatrixException;
     public void rotate(Vector3D, int);
     public void rotateIntoBasis(Vector3D, Vector3D, Vector3D);
     public void rotateOutOfBasis(Vector3D, Vector3D, Vector3D);
     public void rotateX(int);
     public void rotateY(int);
     public void rotateZ(int);
     public void scale(float, float, float);
     public String toString();
     public void translate(float, float, float);
     protected void updateComposed(Tmatrix.Matrix4D, Tmatrix.Matrix4D, int);

          // Inner Classes 1
     protected class Tmatrix.Matrix4D
}

The Tmatrix class is a transformation matrix class designed to work with the acg.stuttgart.rich.vector.Vector3D class. This class allows general coordinate transformations to be composed as a matrix stack, much in the same way that OpenGL handles its transformations. The coordinate system is assumed to be right-handed.




  Fields

· MAX_DEPTH

Summary  |  Top

   public static final int MAX_DEPTH

We statically allocate a matrix stack which is MAX_DEPTH deep.


· UNSPECIFIED

Summary  |  Top
   public static final int UNSPECIFIED

Each level in the stack has an identifier associated with it for debugging and descriptive purposes. Every time an operation is composed with a stack level, that operation's identifier is logically ANDed with the current identifier. A level should never be UNSPECIFIED unless it is currently above the stack pointer.


· IDENTITY

Summary  |  Top
   public static final int IDENTITY


· TRANSLATE

Summary  |  Top
   public static final int TRANSLATE


· SCALE

Summary  |  Top
   public static final int SCALE


· ROTATEX

Summary  |  Top
   public static final int ROTATEX


· ROTATEY

Summary  |  Top
   public static final int ROTATEY


· ROTATEZ

Summary  |  Top
   public static final int ROTATEZ


· ROTATE

Summary  |  Top
   public static final int ROTATE


· ORTHONORMAL_BASIS

Summary  |  Top
   public static final int ORTHONORMAL_BASIS


· PERSPECTIVE

Summary  |  Top
   public static final int PERSPECTIVE


· ORTHOGRAPHIC

Summary  |  Top
   public static final int ORTHOGRAPHIC


· TMATRIX_COMPOSITION

Summary  |  Top
   public static final int TMATRIX_COMPOSITION


· sin

Summary  |  Top
   public static float[] sin

The sin array holds a table of sine values in one degree increments from zero to 359 degrees.


· cos

Summary  |  Top
   public static float[] cos

The cos array holds a table of cosine values in one degree increments from zero to 359 degrees.


  Constructors

· Tmatrix

Summary  |  Top

   public Tmatrix() 

The Tmatrix constructor allocates and initializes the various internal arrays, sets the stack pointer to level zero, and makes the current transform the identity matrix.



  Methods

· toString

Summary  |  Top
   public String toString() 

The toString method prints out a textual representation of the Tmatrix.

Overrides:
toString in class Object


· identity

Summary  |  Top
   public void identity() 

The identity method sets the current transform to the identity matrix and updates the relevant book-keeping.



· translate

Summary  |  Top
   public void translate(float x, 
                         float y, 
                         float z) 

The translate method produces an x,y,z translation.



· scale

Summary  |  Top
   public void scale(float u, 
                     float v, 
                     float w) 

The scale method scales the x, and z, axes by u, v, and w respectively.



· rotateX

Summary  |  Top
   public void rotateX(int angle) 

The rotateX method takes an integer angle specified in degrees and produces an appropriate rotation.



· rotateY

Summary  |  Top
   public void rotateY(int angle) 

The rotateY method takes an integer angle specified in degrees and produces an appropriate rotation.



· rotateZ

Summary  |  Top
   public void rotateZ(int angle) 

The rotateZ method takes an integer angle specified in degrees and produces an appropriate rotation.



· rotate

Summary  |  Top
   public void rotate(Vector3D axis, 
                      int angle) 

The rotate methods takes an axis and an angle, and produces a rotation about that axis. Note that this requires significantly more calculation than the rotateX, rotateY, or rotateZ methods, and those should be used in place of rotate where appropriate.



· rotateIntoBasis

Summary  |  Top
   public void rotateIntoBasis(Vector3D u, 
                               Vector3D v, 
                               Vector3D w) 

The rotateIntoBasis method rotates the x, y, and z unit vectors into the u, v, and w directions respectively. Note that u, v, and w must be unit vectors specifying a right-handed orthonormal basis.



· rotateOutOfBasis

Summary  |  Top
   public void rotateOutOfBasis(Vector3D u, 
                                Vector3D v, 
                                Vector3D w) 

The rotateOutOfBasis method rotates the u, v, and w unit vectors into the x, y, and z directions respectively. Note that u, v, and w must be unit vectors specifying a right-handed orthonormal basis.



· frustum

Summary  |  Top
   public void frustum(float left, 
                       float right, 
                       float bottom, 
                       float top, 
                       float near, 
                       float far) 

The frustum method operates identically to the OpenGL glFrustum call. It defines a viewing frustum generally oriented in the direction of the negative z axis with the view plane parallel to the x-y plane. Note that this can be used to specify funky non-symmetric viewing volumes.



· compose

Summary  |  Top
   public void compose(Tmatrix B) 

The compose method multiplies the top level of this matrix stack by the top level of another matrix stack.



· updateComposed

Summary  |  Top
   protected void updateComposed(Tmatrix.Matrix4D forward, 
                                 Tmatrix.Matrix4D backward, 
                                 int operation) 

The updateComposed method updates the matrix stacks.



· forward

Summary  |  Top
   public void forward(Vector3D vect, 
                       Vector3D result) 

The forward method computes the forward transform of a vector using the top of the composed matrix stack.



· forwardArray

Summary  |  Top
   public void forwardArray(Vector3D[] vectArray, 
                            Vector3D[] resultArray, 
                            int offset) 

The forwardArray method computes the forward transformation of an array of vectors using the top of the composed matrix stack.



· backward

Summary  |  Top
   public void backward(Vector3D vect, 
                        Vector3D result) 

The backward method computes the inverse transform of a vector using the top of the inverseComposed matrix stack.



· backwardArray

Summary  |  Top
   public void backwardArray(Vector3D[] vectArray, 
                             Vector3D[] resultArray, 
                             int offset) 

The backwardArray method computes the inverse transformation of an array of vectors using the top of the inverseComposed matrix stack.



· push

Summary  |  Top
   public void push()  throws TmatrixException

The push method pushes a layer on the matrix stack.



· pop

Summary  |  Top
   public void pop()  throws TmatrixException

The pop method pops a layer off the matrix stack.



All Packages  This Package  Class Hierarchy  Class Search  Index
Freshly brewed Java API Documentation automatically generated with polardoc Version 1.0.7