lt.monarch.chart.chart3D.engine.vecmath
Class Matrix4x4

java.lang.Object
  extended by lt.monarch.chart.chart3D.engine.vecmath.Matrix4x4
All Implemented Interfaces:
java.io.Serializable

public class Matrix4x4
extends java.lang.Object
implements java.io.Serializable

Represents a matrix data and all operations for it.

See Also:
Serialized Form

Constructor Summary
Constructor and Description
Matrix4x4()
          Constructs a new instance with default attribute values.
Matrix4x4(Matrix4x4 matrix)
          Copy constructor.
 
Method Summary
Modifier and Type Method and Description
static Matrix4x4 flipAboutY()
           
 double[][] get()
          Retrieves the specified matrix data fields.
static Matrix4x4 getCopy(Matrix4x4 m)
          Retrieves a new instance with data fields copied.
static Matrix4x4 mul_m4_m4(Matrix4x4 m1, Matrix4x4 m2)
          Multiplies two matrices.
static Point3D mul_m4_v3(Matrix4x4 m, Point3D v)
          Transforms the vector.
static Matrix4x4 rotationAboutX(double angle)
          Retrieves a rotation matrix which rotates about x axis.
static Matrix4x4 rotationAboutY(double angle)
          Retrieves a rotation matrix which rotates about y axis.
static Matrix4x4 rotationAboutZ(double angle)
          Retrieves a rotation matrix which rotates about z axis.
static Matrix4x4 rotationMatrix(Point3D normal, double angle)
          Retrieves a rotation matrix.
static Matrix4x4 scaleMatrix(Point3D scale)
          Retrieves a scale matrix.
 void setValue(int row, int column, double value)
          Set matrix element value
static Matrix4x4 translationMatrix(Point3D translation)
          Retrieves a translation matrix.
static Matrix4x4 unitMatrix()
          Retrieves unit matrix.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Matrix4x4

public Matrix4x4()
Constructs a new instance with default attribute values.


Matrix4x4

public Matrix4x4(Matrix4x4 matrix)
Copy constructor.

Method Detail

get

public double[][] get()
Retrieves the specified matrix data fields.

Returns:
matrix data fields

mul_m4_m4

public static Matrix4x4 mul_m4_m4(Matrix4x4 m1,
                                  Matrix4x4 m2)
Multiplies two matrices.

Parameters:
m1 - the first matrix
m2 - the second matrix
Returns:
the product

mul_m4_v3

public static Point3D mul_m4_v3(Matrix4x4 m,
                                Point3D v)
Transforms the vector.

Parameters:
m - a matrix to transform with
v - a vector to be transformed
Returns:
a transformed vector

getCopy

public static Matrix4x4 getCopy(Matrix4x4 m)
Retrieves a new instance with data fields copied.

Parameters:
m - the matrix which data copy will be retrieved
Returns:
a new matrix instance

unitMatrix

public static Matrix4x4 unitMatrix()
Retrieves unit matrix.

Returns:
unit matrix

scaleMatrix

public static Matrix4x4 scaleMatrix(Point3D scale)
Retrieves a scale matrix.

Parameters:
scale - the scale for each axis
Returns:
the scale matrix

translationMatrix

public static Matrix4x4 translationMatrix(Point3D translation)
Retrieves a translation matrix.

Parameters:
translation - the translation vector
Returns:
the translation matrix

rotationMatrix

public static Matrix4x4 rotationMatrix(Point3D normal,
                                       double angle)
Retrieves a rotation matrix.

Parameters:
normal - the normal to rotate about
angle - the rotation angle
Returns:
a rotation matrix

rotationAboutX

public static Matrix4x4 rotationAboutX(double angle)
Retrieves a rotation matrix which rotates about x axis.

Parameters:
angle - the rotation angle
Returns:
a rotation matrix

rotationAboutY

public static Matrix4x4 rotationAboutY(double angle)
Retrieves a rotation matrix which rotates about y axis.

Parameters:
angle - the rotation angle
Returns:
a rotation matrix

rotationAboutZ

public static Matrix4x4 rotationAboutZ(double angle)
Retrieves a rotation matrix which rotates about z axis.

Parameters:
angle - the rotation angle
Returns:
a rotation matrix

flipAboutY

public static Matrix4x4 flipAboutY()

setValue

public void setValue(int row,
                     int column,
                     double value)
Set matrix element value

Parameters:
row -
column -
value -