com.bulletphysics.linearmath
Class MatrixUtil

java.lang.Object
  extended by com.bulletphysics.linearmath.MatrixUtil

public class MatrixUtil
extends Object

Utility functions for matrices.


Constructor Summary
MatrixUtil()
           
 
Method Summary
static void absolute(Matrix3f mat)
           
static void diagonalize(Matrix3f mat, Matrix3f rot, float threshold, int maxSteps)
          Diagonalizes this matrix by the Jacobi method. rot stores the rotation from the coordinate system in which the matrix is diagonal to the original coordinate system, i.e., old_this = rot * new_this * rot^T.
static void getOpenGLSubMatrix(Matrix3f mat, float[] m)
           
static void getRotation(Matrix3f mat, Quat4f dest)
           
static void invert(Matrix3f mat)
           
static void scale(Matrix3f dest, Matrix3f mat, Vector3f s)
           
static void setEulerZYX(Matrix3f mat, float eulerX, float eulerY, float eulerZ)
          Sets rotation matrix from euler angles.
static void setFromOpenGLSubMatrix(Matrix3f mat, float[] m)
           
static void setRotation(Matrix3f dest, Quat4f q)
           
static void transposeTransform(Vector3f dest, Vector3f vec, Matrix3f mat)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MatrixUtil

public MatrixUtil()
Method Detail

scale

public static void scale(Matrix3f dest,
                         Matrix3f mat,
                         Vector3f s)

absolute

public static void absolute(Matrix3f mat)

setFromOpenGLSubMatrix

public static void setFromOpenGLSubMatrix(Matrix3f mat,
                                          float[] m)

getOpenGLSubMatrix

public static void getOpenGLSubMatrix(Matrix3f mat,
                                      float[] m)

setEulerZYX

public static void setEulerZYX(Matrix3f mat,
                               float eulerX,
                               float eulerY,
                               float eulerZ)
Sets rotation matrix from euler angles. The euler angles are applied in ZYX order. This means a vector is first rotated about X then Y and then Z axis.


transposeTransform

public static void transposeTransform(Vector3f dest,
                                      Vector3f vec,
                                      Matrix3f mat)

setRotation

public static void setRotation(Matrix3f dest,
                               Quat4f q)

getRotation

public static void getRotation(Matrix3f mat,
                               Quat4f dest)

invert

public static void invert(Matrix3f mat)

diagonalize

public static void diagonalize(Matrix3f mat,
                               Matrix3f rot,
                               float threshold,
                               int maxSteps)
Diagonalizes this matrix by the Jacobi method. rot stores the rotation from the coordinate system in which the matrix is diagonal to the original coordinate system, i.e., old_this = rot * new_this * rot^T. The iteration stops when all off-diagonal elements are less than the threshold multiplied by the sum of the absolute values of the diagonal, or when maxSteps have been executed. Note that this matrix is assumed to be symmetric.