Class Mat

java.lang.Object
  extended byMat

public class Mat
extends java.lang.Object

Matrix transforms and composites for homogeneous coords points in 3D.

For CSU540 Computer Graphics class, Spring 2005 CCIS, Northeastern University

Consists of a single 4x4 double matrix, mat, and various static methods.
Method names ending with "Same" alter the matrix argument. Others return a copy.

Version:
26 January 2005
Author:
Bob Futrelle

Field Summary
 double[][] mat
          The only (non-static) field, a 4x4 array.
 
Constructor Summary
Mat()
          Creates unit matrix with homogeneous 4th row, column elements
 
Method Summary
static Mat emptyMat()
          Creates an empty matrix with 1.0 in 3,3 lower corner
static void main(java.lang.String[] args)
          Tests and prints results of all methods (all are static)
static Mat matrixXmatrix(Mat m1, Mat m2)
          Matrix product
static Vec matrixXvector(Mat mat, Vec v)
          Matrix x vector ==> vector
static Mat rotxMat(double theta)
          Creates a rotation matrix around x axis.
static Mat rotyMat(double theta)
          Creates a rotation matrix around y axis.
static Mat rotzMat(double theta)
          Creates a rotation matrix around z axis.
static Mat scaleMat(double theta)
          Creates a scaling matrix.
 java.lang.String toString()
          Lists all 16 elements of the matrix.
static Mat transMat(double tx, double ty, double tz)
          Creates a translation matrix with displacements tx, ty, tz.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

mat

public double[][] mat
The only (non-static) field, a 4x4 array.

Constructor Detail

Mat

public Mat()
Creates unit matrix with homogeneous 4th row, column elements

Method Detail

main

public static void main(java.lang.String[] args)
Tests and prints results of all methods (all are static)


toString

public java.lang.String toString()
Lists all 16 elements of the matrix.


emptyMat

public static Mat emptyMat()
Creates an empty matrix with 1.0 in 3,3 lower corner


transMat

public static Mat transMat(double tx,
                           double ty,
                           double tz)
Creates a translation matrix with displacements tx, ty, tz.


rotxMat

public static Mat rotxMat(double theta)
Creates a rotation matrix around x axis. TO BE COMPLETED


rotyMat

public static Mat rotyMat(double theta)
Creates a rotation matrix around y axis. TO BE COMPLETED


rotzMat

public static Mat rotzMat(double theta)
Creates a rotation matrix around z axis. TO BE COMPLETED


scaleMat

public static Mat scaleMat(double theta)
Creates a scaling matrix. TO BE COMPLETED


matrixXvector

public static Vec matrixXvector(Mat mat,
                                Vec v)
Matrix x vector ==> vector

Returns:
The resulting vector

matrixXmatrix

public static Mat matrixXmatrix(Mat m1,
                                Mat m2)
Matrix product

Returns:
The product of the two matrices