Facemorph
Class Matrix3

java.lang.Object
  extended by Facemorph.Matrix3

public class Matrix3
extends java.lang.Object

3 by 3 matrix utility class


Constructor Summary
Matrix3()
          Creates a matrix initialised to an identity matrix
Matrix3(float aa, float ab, float ac, float ba, float bb, float bc, float ca, float cb, float cc)
          Sets the values of this matrix
 
Method Summary
 float get(int x, int y)
          Gets a single coefficient of this matrix
 int inverse()
          Inverts this matrix in place
 float magnitude()
          Return the magnitude of this matrix
 Matrix3 multiply(Matrix3 m1)
          Multiplies m1 by this
 void set(float aa, float ab, float ac, float ba, float bb, float bc, float ca, float cb, float cc)
          Sets the values of this matrix
 void set(int x, int y, float i)
          Sets a coefficient of the matrix
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Matrix3

public Matrix3()
Creates a matrix initialised to an identity matrix


Matrix3

public Matrix3(float aa,
               float ab,
               float ac,
               float ba,
               float bb,
               float bc,
               float ca,
               float cb,
               float cc)
Sets the values of this matrix

Parameters:
aa - matrix coefficient
ab - matrix coefficient
ac - matrix coefficient
ba - matrix coefficient
bb - matrix coefficient
bc - matrix coefficient
ca - matrix coefficient
cb - matrix coefficient
cc - matrix coefficient
Method Detail

set

public void set(float aa,
                float ab,
                float ac,
                float ba,
                float bb,
                float bc,
                float ca,
                float cb,
                float cc)
Sets the values of this matrix

Parameters:
aa - matrix coefficient
ab - matrix coefficient
ac - matrix coefficient
ba - matrix coefficient
bb - matrix coefficient
bc - matrix coefficient
ca - matrix coefficient
cb - matrix coefficient
cc - matrix coefficient

get

public float get(int x,
                 int y)
Gets a single coefficient of this matrix

Parameters:
x - the row to get
y - the col to get
Returns:
the value of matrix(x,y)

set

public void set(int x,
                int y,
                float i)
Sets a coefficient of the matrix

Parameters:
x - the row to set
y - the col to set
i - The value to set (x,y) to

inverse

public int inverse()
Inverts this matrix in place

Returns:
1 if non-singular, 0 if singular

magnitude

public float magnitude()
Return the magnitude of this matrix

Returns:
The magnitude of this matrix

multiply

public Matrix3 multiply(Matrix3 m1)
Multiplies m1 by this

Parameters:
m1 - the matrix to multiply with
Returns:
returns this*m1