org.lwjgl.util.vector
Class Matrix3f

java.lang.Object
  extended by org.lwjgl.util.vector.Matrix
      extended by org.lwjgl.util.vector.Matrix3f
All Implemented Interfaces:
java.io.Serializable

public class Matrix3f
extends Matrix
implements java.io.Serializable

Holds a 3x3 matrix.

Version:
$Revision: 3418 $ $Id: Matrix3f.java 3418 2010-09-28 21:11:35Z spasi $
Author:
cix_foo
See Also:
Serialized Form

Field Summary
 float m00
           
 float m01
           
 float m02
           
 float m10
           
 float m11
           
 float m12
           
 float m20
           
 float m21
           
 float m22
           
 
Constructor Summary
Matrix3f()
          Constructor for Matrix3f.
 
Method Summary
static Matrix3f add(Matrix3f left, Matrix3f right, Matrix3f dest)
          Add two matrices together and place the result in a third matrix.
 float determinant()
           
 Matrix invert()
          Invert this matrix
static Matrix3f invert(Matrix3f src, Matrix3f dest)
          Invert the source matrix and put the result into the destination matrix
 Matrix load(java.nio.FloatBuffer buf)
          Load from a float buffer.
 Matrix3f load(Matrix3f src)
          Load from another matrix
static Matrix3f load(Matrix3f src, Matrix3f dest)
          Copy source matrix to destination matrix
 Matrix loadTranspose(java.nio.FloatBuffer buf)
          Load from a float buffer.
static Matrix3f mul(Matrix3f left, Matrix3f right, Matrix3f dest)
          Multiply the right matrix by the left and place the result in a third matrix.
 Matrix negate()
          Negate this matrix
 Matrix3f negate(Matrix3f dest)
          Negate this matrix and place the result in a destination matrix.
static Matrix3f negate(Matrix3f src, Matrix3f dest)
          Negate the source matrix and place the result in the destination matrix.
 Matrix setIdentity()
          Set this matrix to be the identity matrix.
static Matrix3f setIdentity(Matrix3f m)
          Set the matrix to be the identity matrix.
 Matrix setZero()
          Set this matrix to 0.
static Matrix3f setZero(Matrix3f m)
          Set the matrix matrix to 0.
 Matrix store(java.nio.FloatBuffer buf)
          Store this matrix in a float buffer.
 Matrix storeTranspose(java.nio.FloatBuffer buf)
          Store this matrix in a float buffer.
static Matrix3f sub(Matrix3f left, Matrix3f right, Matrix3f dest)
          Subtract the right matrix from the left and place the result in a third matrix.
 java.lang.String toString()
          Returns a string representation of this matrix
static Vector3f transform(Matrix3f left, Vector3f right, Vector3f dest)
          Transform a Vector by a matrix and return the result in a destination vector.
 Matrix transpose()
          Transpose this matrix
 Matrix3f transpose(Matrix3f dest)
          Transpose this matrix and place the result in another matrix
static Matrix3f transpose(Matrix3f src, Matrix3f dest)
          Transpose the source matrix and place the result into the destination matrix
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m00

public float m00

m01

public float m01

m02

public float m02

m10

public float m10

m11

public float m11

m12

public float m12

m20

public float m20

m21

public float m21

m22

public float m22
Constructor Detail

Matrix3f

public Matrix3f()
Constructor for Matrix3f. Matrix is initialised to the identity.

Method Detail

load

public Matrix3f load(Matrix3f src)
Load from another matrix

Parameters:
src - The source matrix
Returns:
this

load

public static Matrix3f load(Matrix3f src,
                            Matrix3f dest)
Copy source matrix to destination matrix

Parameters:
src - The source matrix
dest - The destination matrix, or null of a new matrix is to be created
Returns:
The copied matrix

load

public Matrix load(java.nio.FloatBuffer buf)
Load from a float buffer. The buffer stores the matrix in column major (OpenGL) order.

Specified by:
load in class Matrix
Parameters:
buf - A float buffer to read from
Returns:
this

loadTranspose

public Matrix loadTranspose(java.nio.FloatBuffer buf)
Load from a float buffer. The buffer stores the matrix in row major (maths) order.

Specified by:
loadTranspose in class Matrix
Parameters:
buf - A float buffer to read from
Returns:
this

store

public Matrix store(java.nio.FloatBuffer buf)
Store this matrix in a float buffer. The matrix is stored in column major (openGL) order.

Specified by:
store in class Matrix
Parameters:
buf - The buffer to store this matrix in
Returns:
this

storeTranspose

public Matrix storeTranspose(java.nio.FloatBuffer buf)
Store this matrix in a float buffer. The matrix is stored in row major (maths) order.

Specified by:
storeTranspose in class Matrix
Parameters:
buf - The buffer to store this matrix in
Returns:
this

add

public static Matrix3f add(Matrix3f left,
                           Matrix3f right,
                           Matrix3f dest)
Add two matrices together and place the result in a third matrix.

Parameters:
left - The left source matrix
right - The right source matrix
dest - The destination matrix, or null if a new one is to be created
Returns:
the destination matrix

sub

public static Matrix3f sub(Matrix3f left,
                           Matrix3f right,
                           Matrix3f dest)
Subtract the right matrix from the left and place the result in a third matrix.

Parameters:
left - The left source matrix
right - The right source matrix
dest - The destination matrix, or null if a new one is to be created
Returns:
the destination matrix

mul

public static Matrix3f mul(Matrix3f left,
                           Matrix3f right,
                           Matrix3f dest)
Multiply the right matrix by the left and place the result in a third matrix.

Parameters:
left - The left source matrix
right - The right source matrix
dest - The destination matrix, or null if a new one is to be created
Returns:
the destination matrix

transform

public static Vector3f transform(Matrix3f left,
                                 Vector3f right,
                                 Vector3f dest)
Transform a Vector by a matrix and return the result in a destination vector.

Parameters:
left - The left matrix
right - The right vector
dest - The destination vector, or null if a new one is to be created
Returns:
the destination vector

transpose

public Matrix transpose()
Transpose this matrix

Specified by:
transpose in class Matrix
Returns:
this

transpose

public Matrix3f transpose(Matrix3f dest)
Transpose this matrix and place the result in another matrix

Parameters:
dest - The destination matrix or null if a new matrix is to be created
Returns:
the transposed matrix

transpose

public static Matrix3f transpose(Matrix3f src,
                                 Matrix3f dest)
Transpose the source matrix and place the result into the destination matrix

Parameters:
src - The source matrix to be transposed
dest - The destination matrix or null if a new matrix is to be created
Returns:
the transposed matrix

determinant

public float determinant()
Specified by:
determinant in class Matrix
Returns:
the determinant of the matrix

toString

public java.lang.String toString()
Returns a string representation of this matrix

Overrides:
toString in class java.lang.Object

invert

public Matrix invert()
Invert this matrix

Specified by:
invert in class Matrix
Returns:
this if successful, null otherwise

invert

public static Matrix3f invert(Matrix3f src,
                              Matrix3f dest)
Invert the source matrix and put the result into the destination matrix

Parameters:
src - The source matrix to be inverted
dest - The destination matrix, or null if a new one is to be created
Returns:
The inverted matrix if successful, null otherwise

negate

public Matrix negate()
Negate this matrix

Specified by:
negate in class Matrix
Returns:
this

negate

public Matrix3f negate(Matrix3f dest)
Negate this matrix and place the result in a destination matrix.

Parameters:
dest - The destination matrix, or null if a new matrix is to be created
Returns:
the negated matrix

negate

public static Matrix3f negate(Matrix3f src,
                              Matrix3f dest)
Negate the source matrix and place the result in the destination matrix.

Parameters:
src - The source matrix
dest - The destination matrix, or null if a new matrix is to be created
Returns:
the negated matrix

setIdentity

public Matrix setIdentity()
Set this matrix to be the identity matrix.

Specified by:
setIdentity in class Matrix
Returns:
this

setIdentity

public static Matrix3f setIdentity(Matrix3f m)
Set the matrix to be the identity matrix.

Parameters:
m - The matrix to be set to the identity
Returns:
m

setZero

public Matrix setZero()
Set this matrix to 0.

Specified by:
setZero in class Matrix
Returns:
this

setZero

public static Matrix3f setZero(Matrix3f m)
Set the matrix matrix to 0.

Parameters:
m - The matrix to be set to 0
Returns:
m


Copyright © 2002-2009 lwjgl.org. All Rights Reserved.