es.ucm.look.ar.math.geom
Class Matrix3

java.lang.Object
  extended by es.ucm.look.ar.math.geom.Matrix3

public class Matrix3
extends java.lang.Object

Represent a 3D Matrix that can be used with OpenGL. It has functions to rotate, scale and translate


Constructor Summary
Matrix3()
          Constructs a matrix with the identity
 
Method Summary
 float[] getMatrix()
          Returns the float's array representing the matrix in the form: [ m0 m4 m8 m12 ] [ m1 m5 m9 m13 ] [ m2 m6 m10 m14 ] [ m3 m7 m11 m15 ]
 void postMultiply(float[] matrix)
          Postmultiplies the current matrix with the given one
 void preMultipliy(float[] matrix)
          Premultiplies the current matrix with the given one
 void rotate(float x, float y, float z)
          Rotates the matrix with the given rotations (in radians)
 void scale(float x, float y, float z)
          Scales the matrix with the given factors
 void set(float[] matrix)
           
 void setIdentity()
          Sets the identity for this matrix
 void transform(Point3 p)
           
 void translate(float x, float y, float z)
          Translates with the given parameters
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Matrix3

public Matrix3()
Constructs a matrix with the identity

Method Detail

getMatrix

public float[] getMatrix()
Returns the float's array representing the matrix in the form:

[ m0 m4 m8 m12 ]

[ m1 m5 m9 m13 ]

[ m2 m6 m10 m14 ]

[ m3 m7 m11 m15 ]

Returns:
the float's array representing the matrix

postMultiply

public void postMultiply(float[] matrix)
Postmultiplies the current matrix with the given one

Parameters:
matrix - matrix to postmultiply

preMultipliy

public void preMultipliy(float[] matrix)
Premultiplies the current matrix with the given one

Parameters:
matrix - matrix to premultiply

rotate

public void rotate(float x,
                   float y,
                   float z)
Rotates the matrix with the given rotations (in radians)

Parameters:
x - rotation in x axis
y - rotation in y axis
z - rotation in z axis

scale

public void scale(float x,
                  float y,
                  float z)
Scales the matrix with the given factors

Parameters:
x - scale in x axis
y - scale in y axis
z - scale in z axis

set

public void set(float[] matrix)

setIdentity

public void setIdentity()
Sets the identity for this matrix


transform

public void transform(Point3 p)

translate

public void translate(float x,
                      float y,
                      float z)
Translates with the given parameters

Parameters:
x - translation in x axis
y - translation in y axis
z - translation in z axis