com.jme3.math
クラス Matrix3f

java.lang.Object
  上位を拡張 com.jme3.math.Matrix3f
すべての実装されたインタフェース:
Savable, java.io.Serializable, java.lang.Cloneable

public final class Matrix3f
extends java.lang.Object
implements Savable, java.lang.Cloneable, java.io.Serializable

Matrix3f defines a 3x3 matrix. Matrix data is maintained internally and is accessible via the get and set methods. Convenience methods are used for matrix operations as well as generating a matrix from a given set of values.

関連項目:
直列化された形式

フィールドの概要
static Matrix3f IDENTITY
           
static Matrix3f ZERO
           
 
コンストラクタの概要
Matrix3f()
          Constructor instantiates a new Matrix3f object.
Matrix3f(float m00, float m01, float m02, float m10, float m11, float m12, float m20, float m21, float m22)
          constructs a matrix with the given values.
Matrix3f(Matrix3f mat)
          Copy constructor that creates a new Matrix3f object that is the same as the provided matrix.
 
メソッドの概要
 void absoluteLocal()
          Takes the absolute value of all matrix fields locally.
 Matrix3f adjoint()
          Returns a new matrix representing the adjoint of this matrix.
 Matrix3f adjoint(Matrix3f store)
          Places the adjoint of this matrix in store (creates store if null.)
 Matrix3f clone()
           
 float determinant()
          determinant generates the determinate of this matrix.
 boolean equals(java.lang.Object o)
          are these two matrices the same?
 void fillFloatArray(float[] f, boolean columnMajor)
           
 java.nio.FloatBuffer fillFloatBuffer(java.nio.FloatBuffer fb, boolean columnMajor)
          fillFloatBuffer fills a FloatBuffer object with the matrix data.
 void fromAngleAxis(float angle, Vector3f axis)
          fromAngleAxis sets this matrix4f to the values specified by an angle and an axis of rotation.
 void fromAngleNormalAxis(float angle, Vector3f axis)
          fromAngleNormalAxis sets this matrix4f to the values specified by an angle and a normalized axis of rotation.
 void fromAxes(Vector3f uAxis, Vector3f vAxis, Vector3f wAxis)
          Recreate Matrix using the provided axis.
 void fromStartEndVectors(Vector3f start, Vector3f end)
          A function for creating a rotation matrix that rotates a vector called "start" into another vector called "end".
 void get(float[] data, boolean rowMajor)
          get(float[]) returns the matrix in row-major or column-major order.
 float get(int i, int j)
          get retrieves a value from the matrix at the given position.
 Vector3f getColumn(int i)
          getColumn returns one of three columns specified by the parameter.
 Vector3f getColumn(int i, Vector3f store)
          getColumn returns one of three columns specified by the parameter.
 Vector3f getRow(int i)
          getColumn returns one of three rows as specified by the parameter.
 Vector3f getRow(int i, Vector3f store)
          getRow returns one of three rows as specified by the parameter.
 int hashCode()
          hashCode returns the hash code value as an integer and is supported for the benefit of hashing based collection classes such as Hashtable, HashMap, HashSet etc.
 Matrix3f invert()
          Inverts this matrix as a new Matrix3f.
 Matrix3f invert(Matrix3f store)
          Inverts this matrix and stores it in the given store.
 Matrix3f invertLocal()
          Inverts this matrix locally.
 boolean isIdentity()
           
 void loadIdentity()
          loadIdentity sets this matrix to the identity matrix.
 Matrix3f mult(Matrix3f mat)
          mult multiplies this matrix by a given matrix.
 Matrix3f mult(Matrix3f mat, Matrix3f product)
          mult multiplies this matrix by a given matrix.
 Vector3f mult(Vector3f vec)
          mult multiplies this matrix by a given Vector3f object.
 Vector3f mult(Vector3f vec, Vector3f product)
          Multiplies this 3x3 matrix by the 1x3 Vector vec and stores the result in product.
 Matrix3f multLocal(float scale)
          multLocal multiplies this matrix internally by a given float scale factor.
 Matrix3f multLocal(Matrix3f mat)
          mult multiplies this matrix by a given matrix.
 Vector3f multLocal(Vector3f vec)
          multLocal multiplies this matrix by a given Vector3f object.
 void read(JmeImporter e)
           
 void scale(Vector3f scale)
          scale scales the operation performed by this matrix on a per-component basis.
 Matrix3f set(float[] matrix)
          set sets the values of this matrix from an array of values assuming that the data is rowMajor order;
 Matrix3f set(float[][] matrix)
          set sets the values of the matrix to those supplied by the 3x3 two dimenion array.
 Matrix3f set(float[] matrix, boolean rowMajor)
          set sets the values of this matrix from an array of values;
 Matrix3f set(int i, int j, float value)
          set places a given value into the matrix at the given position.
 Matrix3f set(Matrix3f matrix)
          copy transfers the contents of a given matrix to this matrix.
 Matrix3f set(Quaternion quaternion)
          set defines the values of the matrix based on a supplied Quaternion.
 Matrix3f setColumn(int i, Vector3f column)
          setColumn sets a particular column of this matrix to that represented by the provided vector.
 Matrix3f setRow(int i, Vector3f row)
          setRow sets a particular row of this matrix to that represented by the provided vector.
 java.nio.FloatBuffer toFloatBuffer()
          toFloatBuffer returns a FloatBuffer object that contains the matrix data.
 java.lang.String toString()
          toString returns the string representation of this object.
 Matrix3f transpose()
          transpose locally transposes this Matrix.
 Matrix3f transposeLocal()
          Transposes this matrix in place.
 Matrix3f transposeNew()
          transposeNew returns a transposed version of this matrix.
 void write(JmeExporter e)
           
 Matrix3f zero()
          Sets all of the values in this matrix to zero.
 
クラス java.lang.Object から継承されたメソッド
getClass, notify, notifyAll, wait, wait, wait
 

フィールドの詳細

ZERO

public static final Matrix3f ZERO

IDENTITY

public static final Matrix3f IDENTITY
コンストラクタの詳細

Matrix3f

public Matrix3f()
Constructor instantiates a new Matrix3f object. The initial values for the matrix is that of the identity matrix.


Matrix3f

public Matrix3f(float m00,
                float m01,
                float m02,
                float m10,
                float m11,
                float m12,
                float m20,
                float m21,
                float m22)
constructs a matrix with the given values.

パラメータ:
m00 - 0x0 in the matrix.
m01 - 0x1 in the matrix.
m02 - 0x2 in the matrix.
m10 - 1x0 in the matrix.
m11 - 1x1 in the matrix.
m12 - 1x2 in the matrix.
m20 - 2x0 in the matrix.
m21 - 2x1 in the matrix.
m22 - 2x2 in the matrix.

Matrix3f

public Matrix3f(Matrix3f mat)
Copy constructor that creates a new Matrix3f object that is the same as the provided matrix.

パラメータ:
mat - the matrix to copy.
メソッドの詳細

absoluteLocal

public void absoluteLocal()
Takes the absolute value of all matrix fields locally.


set

public Matrix3f set(Matrix3f matrix)
copy transfers the contents of a given matrix to this matrix. If a null matrix is supplied, this matrix is set to the identity matrix.

パラメータ:
matrix - the matrix to copy.
戻り値:
this

get

public float get(int i,
                 int j)
get retrieves a value from the matrix at the given position. If the position is invalid a JmeException is thrown.

パラメータ:
i - the row index.
j - the colum index.
戻り値:
the value at (i, j).

get

public void get(float[] data,
                boolean rowMajor)
get(float[]) returns the matrix in row-major or column-major order.

パラメータ:
data - The array to return the data into. This array can be 9 or 16 floats in size. Only the upper 3x3 are assigned to in the case of a 16 element array.
rowMajor - True for row major storage in the array (translation in elements 3, 7, 11 for a 4x4), false for column major (translation in elements 12, 13, 14 for a 4x4).

getColumn

public Vector3f getColumn(int i)
getColumn returns one of three columns specified by the parameter. This column is returned as a Vector3f object.

パラメータ:
i - the column to retrieve. Must be between 0 and 2.
戻り値:
the column specified by the index.

getColumn

public Vector3f getColumn(int i,
                          Vector3f store)
getColumn returns one of three columns specified by the parameter. This column is returned as a Vector3f object.

パラメータ:
i - the column to retrieve. Must be between 0 and 2.
store - the vector object to store the result in. if null, a new one is created.
戻り値:
the column specified by the index.

getRow

public Vector3f getRow(int i)
getColumn returns one of three rows as specified by the parameter. This row is returned as a Vector3f object.

パラメータ:
i - the row to retrieve. Must be between 0 and 2.
戻り値:
the row specified by the index.

getRow

public Vector3f getRow(int i,
                       Vector3f store)
getRow returns one of three rows as specified by the parameter. This row is returned as a Vector3f object.

パラメータ:
i - the row to retrieve. Must be between 0 and 2.
store - the vector object to store the result in. if null, a new one is created.
戻り値:
the row specified by the index.

toFloatBuffer

public java.nio.FloatBuffer toFloatBuffer()
toFloatBuffer returns a FloatBuffer object that contains the matrix data.

戻り値:
matrix data as a FloatBuffer.

fillFloatBuffer

public java.nio.FloatBuffer fillFloatBuffer(java.nio.FloatBuffer fb,
                                            boolean columnMajor)
fillFloatBuffer fills a FloatBuffer object with the matrix data.

パラメータ:
fb - the buffer to fill, starting at current position. Must have room for 9 more floats.
戻り値:
matrix data as a FloatBuffer. (position is advanced by 9 and any limit set is not changed).

fillFloatArray

public void fillFloatArray(float[] f,
                           boolean columnMajor)

setColumn

public Matrix3f setColumn(int i,
                          Vector3f column)
setColumn sets a particular column of this matrix to that represented by the provided vector.

パラメータ:
i - the column to set.
column - the data to set.
戻り値:
this

setRow

public Matrix3f setRow(int i,
                       Vector3f row)
setRow sets a particular row of this matrix to that represented by the provided vector.

パラメータ:
i - the row to set.
row - the data to set.
戻り値:
this

set

public Matrix3f set(int i,
                    int j,
                    float value)
set places a given value into the matrix at the given position. If the position is invalid a JmeException is thrown.

パラメータ:
i - the row index.
j - the colum index.
value - the value for (i, j).
戻り値:
this

set

public Matrix3f set(float[][] matrix)
set sets the values of the matrix to those supplied by the 3x3 two dimenion array.

パラメータ:
matrix - the new values of the matrix.
戻り値:
this
例外:
JmeException - if the array is not of size 9.

fromAxes

public void fromAxes(Vector3f uAxis,
                     Vector3f vAxis,
                     Vector3f wAxis)
Recreate Matrix using the provided axis.

パラメータ:
uAxis - Vector3f
vAxis - Vector3f
wAxis - Vector3f

set

public Matrix3f set(float[] matrix)
set sets the values of this matrix from an array of values assuming that the data is rowMajor order;

パラメータ:
matrix - the matrix to set the value to.
戻り値:
this

set

public Matrix3f set(float[] matrix,
                    boolean rowMajor)
set sets the values of this matrix from an array of values;

パラメータ:
matrix - the matrix to set the value to.
rowMajor - whether the incoming data is in row or column major order.
戻り値:
this

set

public Matrix3f set(Quaternion quaternion)
set defines the values of the matrix based on a supplied Quaternion. It should be noted that all previous values will be overridden.

パラメータ:
quaternion - the quaternion to create a rotational matrix from.
戻り値:
this

loadIdentity

public void loadIdentity()
loadIdentity sets this matrix to the identity matrix. Where all values are zero except those along the diagonal which are one.


isIdentity

public boolean isIdentity()
戻り値:
true if this matrix is identity

fromAngleAxis

public void fromAngleAxis(float angle,
                          Vector3f axis)
fromAngleAxis sets this matrix4f to the values specified by an angle and an axis of rotation. This method creates an object, so use fromAngleNormalAxis if your axis is already normalized.

パラメータ:
angle - the angle to rotate (in radians).
axis - the axis of rotation.

fromAngleNormalAxis

public void fromAngleNormalAxis(float angle,
                                Vector3f axis)
fromAngleNormalAxis sets this matrix4f to the values specified by an angle and a normalized axis of rotation.

パラメータ:
angle - the angle to rotate (in radians).
axis - the axis of rotation (already normalized).

mult

public Matrix3f mult(Matrix3f mat)
mult multiplies this matrix by a given matrix. The result matrix is returned as a new object. If the given matrix is null, a null matrix is returned.

パラメータ:
mat - the matrix to multiply this matrix by.
戻り値:
the result matrix.

mult

public Matrix3f mult(Matrix3f mat,
                     Matrix3f product)
mult multiplies this matrix by a given matrix. The result matrix is returned as a new object.

パラメータ:
mat - the matrix to multiply this matrix by.
product - the matrix to store the result in. if null, a new matrix3f is created. It is safe for mat and product to be the same object.
戻り値:
a matrix3f object containing the result of this operation

mult

public Vector3f mult(Vector3f vec)
mult multiplies this matrix by a given Vector3f object. The result vector is returned. If the given vector is null, null will be returned.

パラメータ:
vec - the vector to multiply this matrix by.
戻り値:
the result vector.

mult

public Vector3f mult(Vector3f vec,
                     Vector3f product)
Multiplies this 3x3 matrix by the 1x3 Vector vec and stores the result in product.

パラメータ:
vec - The Vector3f to multiply.
product - The Vector3f to store the result, it is safe for this to be the same as vec.
戻り値:
The given product vector.

multLocal

public Matrix3f multLocal(float scale)
multLocal multiplies this matrix internally by a given float scale factor.

パラメータ:
scale - the value to scale by.
戻り値:
this Matrix3f

multLocal

public Vector3f multLocal(Vector3f vec)
multLocal multiplies this matrix by a given Vector3f object. The result vector is stored inside the passed vector, then returned . If the given vector is null, null will be returned.

パラメータ:
vec - the vector to multiply this matrix by.
戻り値:
The passed vector after multiplication

multLocal

public Matrix3f multLocal(Matrix3f mat)
mult multiplies this matrix by a given matrix. The result matrix is saved in the current matrix. If the given matrix is null, nothing happens. The current matrix is returned. This is equivalent to this*=mat

パラメータ:
mat - the matrix to multiply this matrix by.
戻り値:
This matrix, after the multiplication

transposeLocal

public Matrix3f transposeLocal()
Transposes this matrix in place. Returns this matrix for chaining

戻り値:
This matrix after transpose

invert

public Matrix3f invert()
Inverts this matrix as a new Matrix3f.

戻り値:
The new inverse matrix

invert

public Matrix3f invert(Matrix3f store)
Inverts this matrix and stores it in the given store.

戻り値:
The store

invertLocal

public Matrix3f invertLocal()
Inverts this matrix locally.

戻り値:
this

adjoint

public Matrix3f adjoint()
Returns a new matrix representing the adjoint of this matrix.

戻り値:
The adjoint matrix

adjoint

public Matrix3f adjoint(Matrix3f store)
Places the adjoint of this matrix in store (creates store if null.)

パラメータ:
store - The matrix to store the result in. If null, a new matrix is created.
戻り値:
store

determinant

public float determinant()
determinant generates the determinate of this matrix.

戻り値:
the determinate

zero

public Matrix3f zero()
Sets all of the values in this matrix to zero.

戻り値:
this matrix

transpose

public Matrix3f transpose()
transpose locally transposes this Matrix. This is inconsistent with general value vs local semantics, but is preserved for backwards compatibility. Use transposeNew() to transpose to a new object (value).

戻り値:
this object for chaining.

transposeNew

public Matrix3f transposeNew()
transposeNew returns a transposed version of this matrix.

戻り値:
The new Matrix3f object.

toString

public java.lang.String toString()
toString returns the string representation of this object. It is in a format of a 3x3 matrix. For example, an identity matrix would be represented by the following string. com.jme.math.Matrix3f
[
1.0 0.0 0.0
0.0 1.0 0.0
0.0 0.0 1.0
]

オーバーライド:
クラス java.lang.Object 内の toString
戻り値:
the string representation of this object.

hashCode

public int hashCode()
hashCode returns the hash code value as an integer and is supported for the benefit of hashing based collection classes such as Hashtable, HashMap, HashSet etc.

オーバーライド:
クラス java.lang.Object 内の hashCode
戻り値:
the hashcode for this instance of Matrix4f.
関連項目:
Object.hashCode()

equals

public boolean equals(java.lang.Object o)
are these two matrices the same? they are is they both have the same mXX values.

オーバーライド:
クラス java.lang.Object 内の equals
パラメータ:
o - the object to compare for equality
戻り値:
true if they are equal

write

public void write(JmeExporter e)
           throws java.io.IOException
定義:
インタフェース Savable 内の write
例外:
java.io.IOException

read

public void read(JmeImporter e)
          throws java.io.IOException
定義:
インタフェース Savable 内の read
例外:
java.io.IOException

fromStartEndVectors

public void fromStartEndVectors(Vector3f start,
                                Vector3f end)
A function for creating a rotation matrix that rotates a vector called "start" into another vector called "end".

パラメータ:
start - normalized non-zero starting vector
end - normalized non-zero ending vector
関連項目:
"Tomas M�ller, John Hughes \"Efficiently Building a Matrix to Rotate \ One Vector to Another\" Journal of Graphics Tools, 4(4):1-4, 1999"

scale

public void scale(Vector3f scale)
scale scales the operation performed by this matrix on a per-component basis.

パラメータ:
scale - The scale applied to each of the X, Y and Z output values.

clone

public Matrix3f clone()
オーバーライド:
クラス java.lang.Object 内の clone