j3d.org Code

org.j3d.util
Class MatrixUtils

java.lang.Object
  extended by org.j3d.util.MatrixUtils

public class MatrixUtils
extends java.lang.Object

A utility class that performs various matrix operations on the javax.vecmath package.

Version:
$Revision: 1.9 $
Author:
Justin Couch

Constructor Summary
MatrixUtils()
          Construct a default instance of this class.
 
Method Summary
 boolean inverse(javax.vecmath.Matrix4f src, javax.vecmath.Matrix4f dest)
          Calculate the inverse of a 4x4 matrix and place it in the output.
 void lookAt(javax.vecmath.Point3d eye, javax.vecmath.Point3d center, javax.vecmath.Vector3d up, javax.vecmath.Matrix4d res)
          Perform a LookAt camera calculation and place it in the given matrix.
 void lookAt(javax.vecmath.Point3f eye, javax.vecmath.Point3f center, javax.vecmath.Vector3f up, javax.vecmath.Matrix4f res)
          Perform a LookAt camera calculation and place it in the given matrix.
 void rotateX(float angle, javax.vecmath.Matrix4f mat)
          Set the matrix to the rotation about the X axis by the given angle.
 void rotateY(float angle, javax.vecmath.Matrix4f mat)
          Set the matrix to the rotation about the Y axis by the given angle.
 void setEuler(float x, float y, float z, javax.vecmath.Matrix4f mat)
          Set the upper 3x3 matrix based on the given the euler angles.
 void setEuler(javax.vecmath.Vector3f angles, javax.vecmath.Matrix4f mat)
          Set the upper 3x3 matrix based on the given the euler angles.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MatrixUtils

public MatrixUtils()
Construct a default instance of this class.

Method Detail

lookAt

public void lookAt(javax.vecmath.Point3f eye,
                   javax.vecmath.Point3f center,
                   javax.vecmath.Vector3f up,
                   javax.vecmath.Matrix4f res)
Perform a LookAt camera calculation and place it in the given matrix. If using this for a viewing transformation, you should invert() the matrix after the call.

Parameters:
eye - The eye location
center - The place to look at
up - The up vector
res - The result to put the calculation into

lookAt

public void lookAt(javax.vecmath.Point3d eye,
                   javax.vecmath.Point3d center,
                   javax.vecmath.Vector3d up,
                   javax.vecmath.Matrix4d res)
Perform a LookAt camera calculation and place it in the given matrix. If using this for a viewing transformation, you should invert() the matrix after the call.

Parameters:
eye - The eye location
center - The place to look at
up - The up vector
res - The result to put the calculation into

setEuler

public void setEuler(javax.vecmath.Vector3f angles,
                     javax.vecmath.Matrix4f mat)
Set the upper 3x3 matrix based on the given the euler angles.

Parameters:
angles - The set of angles to use, one per axis
mat - The matrix to set the values in

setEuler

public void setEuler(float x,
                     float y,
                     float z,
                     javax.vecmath.Matrix4f mat)
Set the upper 3x3 matrix based on the given the euler angles.

Parameters:
x - The amount to rotate around the X axis
y - The amount to rotate around the Y axis
z - The amount to rotate around the Z axis
mat - The matrix to set the values in

rotateX

public void rotateX(float angle,
                    javax.vecmath.Matrix4f mat)
Set the matrix to the rotation about the X axis by the given angle.

Parameters:
angle - The angle to rotate in radians
mat - The matrix to set the values in

rotateY

public void rotateY(float angle,
                    javax.vecmath.Matrix4f mat)
Set the matrix to the rotation about the Y axis by the given angle.

Parameters:
angle - The angle to rotate in radians
mat - The matrix to set the values in

inverse

public boolean inverse(javax.vecmath.Matrix4f src,
                       javax.vecmath.Matrix4f dest)
Calculate the inverse of a 4x4 matrix and place it in the output. The implementation uses the algorithm from http://www.j3d.org/matrix_faq/matrfaq_latest.html#Q24

Parameters:
src - The source matrix to read the values from
dest - The place to put the inverted matrix
Returns:
true if the inversion was successful

j3d.org Code

Latest Info from http://code.j3d.org/
Copyright © 2001 - j3d.org