public class Matrix3f extends Object implements Externalizable
m00 m10 m20
m01 m11 m21
m02 m12 m22
| Modifier and Type | Field and Description |
|---|---|
float |
m00 |
float |
m01 |
float |
m02 |
float |
m10 |
float |
m11 |
float |
m12 |
float |
m20 |
float |
m21 |
float |
m22 |
| Constructor and Description |
|---|
Matrix3f()
|
Matrix3f(FloatBuffer buffer)
Create a new
Matrix3f by reading its 9 float components from the given FloatBuffer
at the buffer's current position. |
Matrix3f(float m00,
float m01,
float m02,
float m10,
float m11,
float m12,
float m20,
float m21,
float m22)
Create a new 3x3 matrix using the supplied float values.
|
Matrix3f(Matrix3f mat)
Create a new
Matrix3f and make it a copy of the given matrix. |
Matrix3f(Matrix4f mat)
|
| Modifier and Type | Method and Description |
|---|---|
float |
determinant()
Return the determinant of this matrix.
|
boolean |
equals(Object obj) |
ByteBuffer |
get(ByteBuffer buffer)
Store this matrix in column-major order into the supplied
ByteBuffer at the current
buffer position. |
float[] |
get(float[] arr)
Store this matrix into the supplied float array in column-major order.
|
float[] |
get(float[] arr,
int offset)
Store this matrix into the supplied float array in column-major order at the given offset.
|
FloatBuffer |
get(FloatBuffer buffer)
Store this matrix in column-major order into the supplied
FloatBuffer at the current
buffer position. |
ByteBuffer |
get(int index,
ByteBuffer buffer)
Store this matrix in column-major order into the supplied
ByteBuffer starting at the specified
absolute buffer position/index. |
FloatBuffer |
get(int index,
FloatBuffer buffer)
Store this matrix in column-major order into the supplied
FloatBuffer starting at the specified
absolute buffer position/index. |
Matrix3f |
get(Matrix3f dest)
Get the current values of
this matrix and store them into
dest. |
Matrix4f |
get(Matrix4f dest)
Get the current values of
this matrix and store them as
the rotational component of dest. |
Vector3f |
getColumn(int column,
Vector3f dest)
Get the column at the given
column index, starting with 0. |
Quaternionf |
getNormalizedRotation(Quaternionf dest)
Get the current values of
this matrix and store the represented rotation
into the given Quaternionf. |
Vector3f |
getRow(int row,
Vector3f dest)
Get the row at the given
row index, starting with 0. |
Vector3f |
getScale(Vector3f dest)
Get the scaling factors of
this matrix for the three base axes. |
ByteBuffer |
getTransposed(ByteBuffer buffer)
Store the transpose of this matrix in column-major order into the supplied
ByteBuffer at the current
buffer position. |
FloatBuffer |
getTransposed(FloatBuffer buffer)
Store the transpose of this matrix in column-major order into the supplied
FloatBuffer at the current
buffer position. |
ByteBuffer |
getTransposed(int index,
ByteBuffer buffer)
Store the transpose of this matrix in column-major order into the supplied
ByteBuffer starting at the specified
absolute buffer position/index. |
FloatBuffer |
getTransposed(int index,
FloatBuffer buffer)
Store the transpose of this matrix in column-major order into the supplied
FloatBuffer starting at the specified
absolute buffer position/index. |
Quaternionf |
getUnnormalizedRotation(Quaternionf dest)
Get the current values of
this matrix and store the represented rotation
into the given Quaternionf. |
int |
hashCode() |
Matrix3f |
identity()
Set this matrix to the identity.
|
Matrix3f |
invert()
Invert this matrix.
|
Matrix3f |
invert(Matrix3f dest)
Invert the
this matrix and store the result in dest. |
Matrix3f |
lookAlong(float dirX,
float dirY,
float dirZ,
float upX,
float upY,
float upZ)
Apply a rotation transformation to this matrix to make
-z point along dir. |
Matrix3f |
lookAlong(float dirX,
float dirY,
float dirZ,
float upX,
float upY,
float upZ,
Matrix3f dest)
Apply a rotation transformation to this matrix to make
-z point along dir
and store the result in dest. |
Matrix3f |
lookAlong(Vector3f dir,
Vector3f up)
Apply a rotation transformation to this matrix to make
-z point along dir. |
Matrix3f |
lookAlong(Vector3f dir,
Vector3f up,
Matrix3f dest)
Apply a rotation transformation to this matrix to make
-z point along dir
and store the result in dest. |
float |
m00()
Return the value of the matrix element at column 0 and row 0.
|
Matrix3f |
m00(float m00)
Set the value of the matrix element at column 0 and row 0
|
float |
m01()
Return the value of the matrix element at column 0 and row 1.
|
Matrix3f |
m01(float m01)
Set the value of the matrix element at column 0 and row 1
|
float |
m02()
Return the value of the matrix element at column 0 and row 2.
|
Matrix3f |
m02(float m02)
Set the value of the matrix element at column 0 and row 2
|
float |
m10()
Return the value of the matrix element at column 1 and row 0.
|
Matrix3f |
m10(float m10)
Set the value of the matrix element at column 1 and row 0
|
float |
m11()
Return the value of the matrix element at column 1 and row 1.
|
Matrix3f |
m11(float m11)
Set the value of the matrix element at column 1 and row 1
|
float |
m12()
Return the value of the matrix element at column 1 and row 2.
|
Matrix3f |
m12(float m12)
Set the value of the matrix element at column 1 and row 2
|
float |
m20()
Return the value of the matrix element at column 2 and row 0.
|
Matrix3f |
m20(float m20)
Set the value of the matrix element at column 2 and row 0
|
float |
m21()
Return the value of the matrix element at column 2 and row 1.
|
Matrix3f |
m21(float m21)
Set the value of the matrix element at column 2 and row 1
|
float |
m22()
Return the value of the matrix element at column 2 and row 2.
|
Matrix3f |
m22(float m22)
Set the value of the matrix element at column 2 and row 2
|
Matrix3f |
mul(Matrix3f right)
Multiply this matrix by the supplied
right matrix. |
Matrix3f |
mul(Matrix3f right,
Matrix3f dest)
Multiply this matrix by the supplied
right matrix and store the result in dest. |
Matrix3f |
normal()
Set
this matrix to its own normal matrix. |
Matrix3f |
normal(Matrix3f dest)
Compute a normal matrix from
this matrix and store it into dest. |
Vector3f |
normalizedPositiveX(Vector3f dir)
Obtain the direction of +X before the transformation represented by
this orthogonal matrix is applied. |
Vector3f |
normalizedPositiveY(Vector3f dir)
Obtain the direction of +Y before the transformation represented by
this orthogonal matrix is applied. |
Vector3f |
normalizedPositiveZ(Vector3f dir)
Obtain the direction of +Z before the transformation represented by
this orthogonal matrix is applied. |
Vector3f |
positiveX(Vector3f dir)
Obtain the direction of +X before the transformation represented by
this matrix is applied. |
Vector3f |
positiveY(Vector3f dir)
Obtain the direction of +Y before the transformation represented by
this matrix is applied. |
Vector3f |
positiveZ(Vector3f dir)
Obtain the direction of +Z before the transformation represented by
this matrix is applied. |
void |
readExternal(ObjectInput in) |
Matrix3f |
rotate(float ang,
float x,
float y,
float z)
Apply rotation to this matrix by rotating the given amount of radians
about the given axis specified as x, y and z components.
|
Matrix3f |
rotate(float ang,
float x,
float y,
float z,
Matrix3f dest)
Apply rotation to this matrix by rotating the given amount of radians
about the given axis specified as x, y and z components, and store the result in
dest. |
Matrix3f |
rotate(float angle,
Vector3f axis)
Apply a rotation transformation, rotating the given radians about the specified axis, to this matrix.
|
Matrix3f |
rotate(float angle,
Vector3f axis,
Matrix3f dest)
Apply a rotation transformation, rotating the given radians about the specified axis and store the result in
dest. |
Matrix3f |
rotate(Quaternionf quat)
Apply the rotation transformation of the given
Quaternionf to this matrix. |
Matrix3f |
rotate(Quaternionf quat,
Matrix3f dest)
Apply the rotation transformation of the given
Quaternionf to this matrix and store
the result in dest. |
Matrix3f |
rotateLocal(float ang,
float x,
float y,
float z)
Pre-multiply a rotation to this matrix by rotating the given amount of radians
about the specified (x, y, z) axis.
|
Matrix3f |
rotateLocal(float ang,
float x,
float y,
float z,
Matrix3f dest)
Pre-multiply a rotation to this matrix by rotating the given amount of radians
about the specified (x, y, z) axis and store the result in
dest. |
Matrix3f |
rotateLocal(Quaternionf quat)
Pre-multiply the rotation transformation of the given
Quaternionf to this matrix. |
Matrix3f |
rotateLocal(Quaternionf quat,
Matrix3f dest)
Pre-multiply the rotation transformation of the given
Quaternionf to this matrix and store
the result in dest. |
Matrix3f |
rotateX(float ang)
Apply rotation about the X axis to this matrix by rotating the given amount of radians.
|
Matrix3f |
rotateX(float ang,
Matrix3f dest)
Apply rotation about the X axis to this matrix by rotating the given amount of radians
and store the result in
dest. |
Matrix3f |
rotateXYZ(float angleX,
float angleY,
float angleZ)
Apply rotation of
angleX radians about the X axis, followed by a rotation of angleY radians about the Y axis and
followed by a rotation of angleZ radians about the Z axis. |
Matrix3f |
rotateXYZ(float angleX,
float angleY,
float angleZ,
Matrix3f dest)
Apply rotation of
angleX radians about the X axis, followed by a rotation of angleY radians about the Y axis and
followed by a rotation of angleZ radians about the Z axis and store the result in dest. |
Matrix3f |
rotateY(float ang)
Apply rotation about the Y axis to this matrix by rotating the given amount of radians.
|
Matrix3f |
rotateY(float ang,
Matrix3f dest)
Apply rotation about the Y axis to this matrix by rotating the given amount of radians
and store the result in
dest. |
Matrix3f |
rotateZ(float ang)
Apply rotation about the Z axis to this matrix by rotating the given amount of radians.
|
Matrix3f |
rotateZ(float ang,
Matrix3f dest)
Apply rotation about the Z axis to this matrix by rotating the given amount of radians
and store the result in
dest. |
Matrix3f |
rotateZYX(float angleZ,
float angleY,
float angleX)
Apply rotation of
angleZ radians about the Z axis, followed by a rotation of angleY radians about the Y axis and
followed by a rotation of angleX radians about the X axis. |
Matrix3f |
rotateZYX(float angleZ,
float angleY,
float angleX,
Matrix3f dest)
Apply rotation of
angleZ radians about the Z axis, followed by a rotation of angleY radians about the Y axis and
followed by a rotation of angleX radians about the X axis and store the result in dest. |
Matrix3f |
rotation(float angle,
float x,
float y,
float z)
Set this matrix to a rotation matrix which rotates the given radians about a given axis.
|
Matrix3f |
rotation(float angle,
Vector3f axis)
Set this matrix to a rotation matrix which rotates the given radians about a given axis.
|
Matrix3f |
rotation(Quaternionf quat)
Set this matrix to the rotation transformation of the given
Quaternionf. |
Matrix3f |
rotationX(float ang)
Set this matrix to a rotation transformation about the X axis.
|
Matrix3f |
rotationXYZ(float angleX,
float angleY,
float angleZ)
Set this matrix to a rotation of
angleX radians about the X axis, followed by a rotation
of angleY radians about the Y axis and followed by a rotation of angleZ radians about the Z axis. |
Matrix3f |
rotationY(float ang)
Set this matrix to a rotation transformation about the Y axis.
|
Matrix3f |
rotationYXZ(float angleY,
float angleX,
float angleZ)
Set this matrix to a rotation of
angleY radians about the Y axis, followed by a rotation
of angleX radians about the X axis and followed by a rotation of angleZ radians about the Z axis. |
Matrix3f |
rotationZ(float ang)
Set this matrix to a rotation transformation about the Z axis.
|
Matrix3f |
rotationZYX(float angleZ,
float angleY,
float angleX)
Set this matrix to a rotation of
angleZ radians about the Z axis, followed by a rotation
of angleY radians about the Y axis and followed by a rotation of angleX radians about the X axis. |
Matrix3f |
scale(float xyz)
Apply scaling to this matrix by uniformly scaling all base axes by the given
xyz factor. |
Matrix3f |
scale(float x,
float y,
float z)
Apply scaling to this matrix by scaling the base axes by the given x,
y and z factors.
|
Matrix3f |
scale(float x,
float y,
float z,
Matrix3f dest)
Apply scaling to this matrix by scaling the base axes by the given x,
y and z factors and store the result in
dest. |
Matrix3f |
scale(float xyz,
Matrix3f dest)
Apply scaling to this matrix by uniformly scaling all base axes by the given
xyz factor
and store the result in dest. |
Matrix3f |
scale(Vector3f xyz)
Apply scaling to this matrix by scaling the base axes by the given xyz.x,
xyz.y and xyz.z factors, respectively.
|
Matrix3f |
scale(Vector3f xyz,
Matrix3f dest)
Apply scaling to the this matrix by scaling the base axes by the given xyz.x,
xyz.y and xyz.z factors, respectively and store the result in
dest. |
Matrix3f |
scaleLocal(float x,
float y,
float z)
Pre-multiply scaling to this matrix by scaling the base axes by the given x,
y and z factors.
|
Matrix3f |
scaleLocal(float x,
float y,
float z,
Matrix3f dest)
Pre-multiply scaling to the this matrix by scaling the base axes by the given x,
y and z factors and store the result in
dest. |
Matrix3f |
scaling(float factor)
Set this matrix to be a simple scale matrix, which scales all axes uniformly by the given factor.
|
Matrix3f |
scaling(float x,
float y,
float z)
Set this matrix to be a simple scale matrix.
|
Matrix3f |
scaling(Vector3f xyz)
Set this matrix to be a simple scale matrix which scales the base axes by xyz.x, xyz.y and xyz.z respectively.
|
Matrix3f |
set(ByteBuffer buffer)
Set the values of this matrix by reading 9 float values from the given
ByteBuffer in column-major order,
starting at its current position. |
Matrix3f |
set(float[] m)
Set the values in this matrix based on the supplied float array.
|
Matrix3f |
set(FloatBuffer buffer)
Set the values of this matrix by reading 9 float values from the given
FloatBuffer in column-major order,
starting at its current position. |
Matrix3f |
set(float m00,
float m01,
float m02,
float m10,
float m11,
float m12,
float m20,
float m21,
float m22)
Set the values within this matrix to the supplied float values.
|
Matrix3f |
set(Matrix3f m)
Set the elements of this matrix to the ones in
m. |
Matrix3f |
set(Matrix4f mat)
Set the elements of this matrix to the upper left 3x3 of the given
Matrix4f. |
Matrix3f |
set(Quaternionf q)
Set this matrix to be equivalent to the rotation specified by the given
Quaternionf. |
Matrix3f |
setLookAlong(float dirX,
float dirY,
float dirZ,
float upX,
float upY,
float upZ)
Set this matrix to a rotation transformation to make
-z
point along dir. |
Matrix3f |
setLookAlong(Vector3f dir,
Vector3f up)
Set this matrix to a rotation transformation to make
-z
point along dir. |
Matrix3f |
swap(Matrix3f other)
Exchange the values of
this matrix with the given other matrix. |
String |
toString()
Return a string representation of this matrix.
|
String |
toString(NumberFormat formatter)
Return a string representation of this matrix by formatting the matrix elements with the given
NumberFormat. |
Vector3f |
transform(Vector3f v)
Transform the given vector by this matrix.
|
Vector3f |
transform(Vector3f v,
Vector3f dest)
Transform the given vector by this matrix and store the result in
dest. |
Matrix3f |
transpose()
Transpose this matrix.
|
Matrix3f |
transpose(Matrix3f dest)
Transpose
this matrix and store the result in dest. |
void |
writeExternal(ObjectOutput out) |
Matrix3f |
zero()
Set all values within this matrix to zero.
|
public float m00
public float m10
public float m20
public float m01
public float m11
public float m21
public float m02
public float m12
public float m22
public Matrix3f()
public Matrix3f(Matrix3f mat)
Matrix3f and make it a copy of the given matrix.mat - the Matrix3f to copy the values frompublic Matrix3f(float m00,
float m01,
float m02,
float m10,
float m11,
float m12,
float m20,
float m21,
float m22)
m00 - the value of m00m01 - the value of m01m02 - the value of m02m10 - the value of m10m11 - the value of m11m12 - the value of m12m20 - the value of m20m21 - the value of m21m22 - the value of m22public Matrix3f(FloatBuffer buffer)
Matrix3f by reading its 9 float components from the given FloatBuffer
at the buffer's current position.
That FloatBuffer is expected to hold the values in column-major order.
The buffer's position will not be changed by this method.
buffer - the FloatBuffer to read the matrix values frompublic float m00()
public float m01()
public float m02()
public float m10()
public float m11()
public float m12()
public float m20()
public float m21()
public float m22()
public Matrix3f m00(float m00)
m00 - the new valuepublic Matrix3f m01(float m01)
m01 - the new valuepublic Matrix3f m02(float m02)
m02 - the new valuepublic Matrix3f m10(float m10)
m10 - the new valuepublic Matrix3f m11(float m11)
m11 - the new valuepublic Matrix3f m12(float m12)
m12 - the new valuepublic Matrix3f m20(float m20)
m20 - the new valuepublic Matrix3f m21(float m21)
m21 - the new valuepublic Matrix3f m22(float m22)
m22 - the new valuepublic Matrix3f set(Matrix3f m)
m.m - the matrix to copy the elements frompublic Matrix3f set(Matrix4f mat)
Matrix4f.mat - the Matrix4f to copy the values frompublic Matrix3f set(Quaternionf q)
Quaternionf.q - the QuaternionfQuaternionf.get(Matrix3f)public Matrix3f mul(Matrix3f right)
right matrix.
If M is this matrix and R the right matrix,
then the new matrix will be M * R. So when transforming a
vector v with the new matrix by using M * R * v, the
transformation of the right matrix will be applied first!
right - the right operand of the matrix multiplicationpublic Matrix3f mul(Matrix3f right, Matrix3f dest)
right matrix and store the result in dest.
If M is this matrix and R the right matrix,
then the new matrix will be M * R. So when transforming a
vector v with the new matrix by using M * R * v, the
transformation of the right matrix will be applied first!
right - the right operand of the matrix multiplicationdest - will hold the resultpublic Matrix3f set(float m00, float m01, float m02, float m10, float m11, float m12, float m20, float m21, float m22)
m00, m10, m20
m01, m11, m21
m02, m12, m22
m00 - the new value of m00m01 - the new value of m01m02 - the new value of m02m10 - the new value of m10m11 - the new value of m11m12 - the new value of m12m20 - the new value of m20m21 - the new value of m21m22 - the new value of m22public Matrix3f set(float[] m)
0, 3, 6
1, 4, 7
2, 5, 8
This method only uses the first 9 values, all others are ignored.
m - the array to read the matrix values frompublic float determinant()
public Matrix3f invert()
public Matrix3f invert(Matrix3f dest)
this matrix and store the result in dest.dest - will hold the resultpublic Matrix3f transpose()
public Matrix3f transpose(Matrix3f dest)
this matrix and store the result in dest.dest - will hold the resultpublic String toString()
This method creates a new DecimalFormat on every invocation with the format string " 0.000E0; -".
public String toString(NumberFormat formatter)
NumberFormat.formatter - the NumberFormat used to format the matrix values withpublic Matrix3f get(Matrix3f dest)
this matrix and store them into
dest.
This is the reverse method of set(Matrix3f) and allows to obtain
intermediate calculation results when chaining multiple transformations.
dest - the destination matrixset(Matrix3f)public Matrix4f get(Matrix4f dest)
this matrix and store them as
the rotational component of dest. All other values of dest will
be set to identity.dest - the destination matrixMatrix4f.set(Matrix3f)public Quaternionf getUnnormalizedRotation(Quaternionf dest)
this matrix and store the represented rotation
into the given Quaternionf.
This method assumes that the three column vectors of this matrix are not normalized and thus allows to ignore any additional scaling factor that is applied to the matrix.
dest - the destination QuaternionfQuaternionf.setFromUnnormalized(Matrix3f)public Quaternionf getNormalizedRotation(Quaternionf dest)
this matrix and store the represented rotation
into the given Quaternionf.
This method assumes that the three column vectors of this matrix are normalized.
dest - the destination QuaternionfQuaternionf.setFromNormalized(Matrix3f)public FloatBuffer get(FloatBuffer buffer)
FloatBuffer at the current
buffer position.
This method will not increment the position of the given FloatBuffer.
In order to specify the offset into the FloatBuffer at which
the matrix is stored, use get(int, FloatBuffer), taking
the absolute position as parameter.
buffer - will receive the values of this matrix in column-major order at its current positionget(int, FloatBuffer)public FloatBuffer get(int index, FloatBuffer buffer)
FloatBuffer starting at the specified
absolute buffer position/index.
This method will not increment the position of the given FloatBuffer.
index - the absolute position into the FloatBufferbuffer - will receive the values of this matrix in column-major orderpublic ByteBuffer get(ByteBuffer buffer)
ByteBuffer at the current
buffer position.
This method will not increment the position of the given ByteBuffer.
In order to specify the offset into the ByteBuffer at which
the matrix is stored, use get(int, ByteBuffer), taking
the absolute position as parameter.
buffer - will receive the values of this matrix in column-major order at its current positionget(int, ByteBuffer)public ByteBuffer get(int index, ByteBuffer buffer)
ByteBuffer starting at the specified
absolute buffer position/index.
This method will not increment the position of the given ByteBuffer.
index - the absolute position into the ByteBufferbuffer - will receive the values of this matrix in column-major orderpublic FloatBuffer getTransposed(FloatBuffer buffer)
FloatBuffer at the current
buffer position.
This method will not increment the position of the given FloatBuffer.
In order to specify the offset into the FloatBuffer at which
the matrix is stored, use getTransposed(int, FloatBuffer), taking
the absolute position as parameter.
buffer - will receive the values of this matrix in column-major order at its current positiongetTransposed(int, FloatBuffer)public FloatBuffer getTransposed(int index, FloatBuffer buffer)
FloatBuffer starting at the specified
absolute buffer position/index.
This method will not increment the position of the given FloatBuffer.
index - the absolute position into the FloatBufferbuffer - will receive the values of this matrix in column-major orderpublic ByteBuffer getTransposed(ByteBuffer buffer)
ByteBuffer at the current
buffer position.
This method will not increment the position of the given ByteBuffer.
In order to specify the offset into the ByteBuffer at which
the matrix is stored, use getTransposed(int, ByteBuffer), taking
the absolute position as parameter.
buffer - will receive the values of this matrix in column-major order at its current positiongetTransposed(int, ByteBuffer)public ByteBuffer getTransposed(int index, ByteBuffer buffer)
ByteBuffer starting at the specified
absolute buffer position/index.
This method will not increment the position of the given ByteBuffer.
index - the absolute position into the ByteBufferbuffer - will receive the values of this matrix in column-major orderpublic float[] get(float[] arr,
int offset)
arr - the array to write the matrix values intooffset - the offset into the arraypublic float[] get(float[] arr)
In order to specify an explicit offset into the array, use the method get(float[], int).
arr - the array to write the matrix values intoget(float[], int)public Matrix3f set(FloatBuffer buffer)
FloatBuffer in column-major order,
starting at its current position.
The FloatBuffer is expected to contain the values in column-major order.
The position of the FloatBuffer will not be changed by this method.
buffer - the FloatBuffer to read the matrix values from in column-major orderpublic Matrix3f set(ByteBuffer buffer)
ByteBuffer in column-major order,
starting at its current position.
The ByteBuffer is expected to contain the values in column-major order.
The position of the ByteBuffer will not be changed by this method.
buffer - the ByteBuffer to read the matrix values from in column-major orderpublic Matrix3f zero()
public Matrix3f identity()
public Matrix3f scale(Vector3f xyz, Matrix3f dest)
dest.
If M is this matrix and S the scaling matrix,
then the new matrix will be M * S. So when transforming a
vector v with the new matrix by using M * S * v
, the scaling will be applied first!
xyz - the factors of the x, y and z component, respectivelydest - will hold the resultpublic Matrix3f scale(Vector3f xyz)
If M is this matrix and S the scaling matrix,
then the new matrix will be M * S. So when transforming a
vector v with the new matrix by using M * S * v, the
scaling will be applied first!
xyz - the factors of the x, y and z component, respectivelypublic Matrix3f scale(float x, float y, float z, Matrix3f dest)
dest.
If M is this matrix and S the scaling matrix,
then the new matrix will be M * S. So when transforming a
vector v with the new matrix by using M * S * v
, the scaling will be applied first!
x - the factor of the x componenty - the factor of the y componentz - the factor of the z componentdest - will hold the resultpublic Matrix3f scale(float x, float y, float z)
If M is this matrix and S the scaling matrix,
then the new matrix will be M * S. So when transforming a
vector v with the new matrix by using M * S * v
, the scaling will be applied first!
x - the factor of the x componenty - the factor of the y componentz - the factor of the z componentpublic Matrix3f scale(float xyz, Matrix3f dest)
xyz factor
and store the result in dest.
If M is this matrix and S the scaling matrix,
then the new matrix will be M * S. So when transforming a
vector v with the new matrix by using M * S * v
, the scaling will be applied first!
xyz - the factor for all componentsdest - will hold the resultscale(float, float, float, Matrix3f)public Matrix3f scale(float xyz)
xyz factor.
If M is this matrix and S the scaling matrix,
then the new matrix will be M * S. So when transforming a
vector v with the new matrix by using M * S * v
, the scaling will be applied first!
xyz - the factor for all componentsscale(float, float, float)public Matrix3f scaleLocal(float x, float y, float z, Matrix3f dest)
dest.
If M is this matrix and S the scaling matrix,
then the new matrix will be S * M. So when transforming a
vector v with the new matrix by using S * M * v
, the scaling will be applied last!
x - the factor of the x componenty - the factor of the y componentz - the factor of the z componentdest - will hold the resultpublic Matrix3f scaleLocal(float x, float y, float z)
If M is this matrix and S the scaling matrix,
then the new matrix will be S * M. So when transforming a
vector v with the new matrix by using S * M * v, the
scaling will be applied last!
x - the factor of the x componenty - the factor of the y componentz - the factor of the z componentpublic Matrix3f scaling(float factor)
The resulting matrix can be multiplied against another transformation matrix to obtain an additional scaling.
In order to post-multiply a scaling transformation directly to a
matrix, use scale() instead.
factor - the scale factor in x, y and zscale(float)public Matrix3f scaling(float x, float y, float z)
x - the scale in xy - the scale in yz - the scale in zpublic Matrix3f scaling(Vector3f xyz)
The resulting matrix can be multiplied against another transformation matrix to obtain an additional scaling.
In order to post-multiply a scaling transformation directly to a
matrix use scale() instead.
xyz - the scale in x, y and z respectivelyscale(Vector3f)public Matrix3f rotation(float angle, Vector3f axis)
The resulting matrix can be multiplied against another transformation matrix to obtain an additional rotation.
In order to post-multiply a rotation transformation directly to a
matrix, use rotate() instead.
angle - the angle in radiansaxis - the axis to rotate about (needs to be normalized)rotate(float, Vector3f)public Matrix3f rotation(float angle, float x, float y, float z)
The axis described by the three components needs to be a unit vector.
The resulting matrix can be multiplied against another transformation matrix to obtain an additional rotation.
In order to apply the rotation transformation to an existing transformation,
use rotate() instead.
Reference: http://en.wikipedia.org
angle - the angle in radiansx - the x-component of the rotation axisy - the y-component of the rotation axisz - the z-component of the rotation axisrotate(float, float, float, float)public Matrix3f rotationX(float ang)
Reference: http://en.wikipedia.org
ang - the angle in radianspublic Matrix3f rotationY(float ang)
Reference: http://en.wikipedia.org
ang - the angle in radianspublic Matrix3f rotationZ(float ang)
Reference: http://en.wikipedia.org
ang - the angle in radianspublic Matrix3f rotationXYZ(float angleX, float angleY, float angleZ)
angleX radians about the X axis, followed by a rotation
of angleY radians about the Y axis and followed by a rotation of angleZ radians about the Z axis.
This method is equivalent to calling: rotationX(angleX).rotateY(angleY).rotateZ(angleZ)
angleX - the angle to rotate about XangleY - the angle to rotate about YangleZ - the angle to rotate about Zpublic Matrix3f rotationZYX(float angleZ, float angleY, float angleX)
angleZ radians about the Z axis, followed by a rotation
of angleY radians about the Y axis and followed by a rotation of angleX radians about the X axis.
This method is equivalent to calling: rotationZ(angleZ).rotateY(angleY).rotateX(angleX)
angleZ - the angle to rotate about ZangleY - the angle to rotate about YangleX - the angle to rotate about Xpublic Matrix3f rotationYXZ(float angleY, float angleX, float angleZ)
angleY radians about the Y axis, followed by a rotation
of angleX radians about the X axis and followed by a rotation of angleZ radians about the Z axis.
This method is equivalent to calling: rotationY(angleY).rotateX(angleX).rotateZ(angleZ)
angleY - the angle to rotate about YangleX - the angle to rotate about XangleZ - the angle to rotate about Zpublic Matrix3f rotation(Quaternionf quat)
Quaternionf.
The resulting matrix can be multiplied against another transformation matrix to obtain an additional rotation.
In order to apply the rotation transformation to an existing transformation,
use rotate() instead.
Reference: http://en.wikipedia.org
quat - the Quaternionfrotate(Quaternionf)public Vector3f transform(Vector3f v)
v - the vector to transformpublic Vector3f transform(Vector3f v, Vector3f dest)
dest.v - the vector to transformdest - will hold the resultpublic void writeExternal(ObjectOutput out) throws IOException
writeExternal in interface ExternalizableIOExceptionpublic void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal in interface ExternalizableIOExceptionClassNotFoundExceptionpublic Matrix3f rotateX(float ang, Matrix3f dest)
dest.
If M is this matrix and R the rotation matrix,
then the new matrix will be M * R. So when transforming a
vector v with the new matrix by using M * R * v
, the rotation will be applied first!
Reference: http://en.wikipedia.org
ang - the angle in radiansdest - will hold the resultpublic Matrix3f rotateX(float ang)
If M is this matrix and R the rotation matrix,
then the new matrix will be M * R. So when transforming a
vector v with the new matrix by using M * R * v
, the rotation will be applied first!
Reference: http://en.wikipedia.org
ang - the angle in radianspublic Matrix3f rotateY(float ang, Matrix3f dest)
dest.
If M is this matrix and R the rotation matrix,
then the new matrix will be M * R. So when transforming a
vector v with the new matrix by using M * R * v
, the rotation will be applied first!
Reference: http://en.wikipedia.org
ang - the angle in radiansdest - will hold the resultpublic Matrix3f rotateY(float ang)
If M is this matrix and R the rotation matrix,
then the new matrix will be M * R. So when transforming a
vector v with the new matrix by using M * R * v
, the rotation will be applied first!
Reference: http://en.wikipedia.org
ang - the angle in radianspublic Matrix3f rotateZ(float ang, Matrix3f dest)
dest.
If M is this matrix and R the rotation matrix,
then the new matrix will be M * R. So when transforming a
vector v with the new matrix by using M * R * v
, the rotation will be applied first!
Reference: http://en.wikipedia.org
ang - the angle in radiansdest - will hold the resultpublic Matrix3f rotateZ(float ang)
If M is this matrix and R the rotation matrix,
then the new matrix will be M * R. So when transforming a
vector v with the new matrix by using M * R * v
, the rotation will be applied first!
Reference: http://en.wikipedia.org
ang - the angle in radianspublic Matrix3f rotateXYZ(float angleX, float angleY, float angleZ)
angleX radians about the X axis, followed by a rotation of angleY radians about the Y axis and
followed by a rotation of angleZ radians about the Z axis.
If M is this matrix and R the rotation matrix,
then the new matrix will be M * R. So when transforming a
vector v with the new matrix by using M * R * v, the
rotation will be applied first!
This method is equivalent to calling: rotateX(angleX).rotateY(angleY).rotateZ(angleZ)
angleX - the angle to rotate about XangleY - the angle to rotate about YangleZ - the angle to rotate about Zpublic Matrix3f rotateXYZ(float angleX, float angleY, float angleZ, Matrix3f dest)
angleX radians about the X axis, followed by a rotation of angleY radians about the Y axis and
followed by a rotation of angleZ radians about the Z axis and store the result in dest.
If M is this matrix and R the rotation matrix,
then the new matrix will be M * R. So when transforming a
vector v with the new matrix by using M * R * v, the
rotation will be applied first!
This method is equivalent to calling: rotateX(angleX, dest).rotateY(angleY).rotateZ(angleZ)
angleX - the angle to rotate about XangleY - the angle to rotate about YangleZ - the angle to rotate about Zdest - will hold the resultpublic Matrix3f rotateZYX(float angleZ, float angleY, float angleX)
angleZ radians about the Z axis, followed by a rotation of angleY radians about the Y axis and
followed by a rotation of angleX radians about the X axis.
If M is this matrix and R the rotation matrix,
then the new matrix will be M * R. So when transforming a
vector v with the new matrix by using M * R * v, the
rotation will be applied first!
This method is equivalent to calling: rotateZ(angleZ).rotateY(angleY).rotateX(angleX)
angleZ - the angle to rotate about ZangleY - the angle to rotate about YangleX - the angle to rotate about Xpublic Matrix3f rotateZYX(float angleZ, float angleY, float angleX, Matrix3f dest)
angleZ radians about the Z axis, followed by a rotation of angleY radians about the Y axis and
followed by a rotation of angleX radians about the X axis and store the result in dest.
If M is this matrix and R the rotation matrix,
then the new matrix will be M * R. So when transforming a
vector v with the new matrix by using M * R * v, the
rotation will be applied first!
This method is equivalent to calling: rotateZ(angleZ, dest).rotateY(angleY).rotateX(angleX)
angleZ - the angle to rotate about ZangleY - the angle to rotate about YangleX - the angle to rotate about Xdest - will hold the resultpublic Matrix3f rotate(float ang, float x, float y, float z)
If M is this matrix and R the rotation matrix,
then the new matrix will be M * R. So when transforming a
vector v with the new matrix by using M * R * v
, the rotation will be applied first!
Reference: http://en.wikipedia.org
ang - the angle in radiansx - the x component of the axisy - the y component of the axisz - the z component of the axispublic Matrix3f rotate(float ang, float x, float y, float z, Matrix3f dest)
dest.
If M is this matrix and R the rotation matrix,
then the new matrix will be M * R. So when transforming a
vector v with the new matrix by using M * R * v
, the rotation will be applied first!
Reference: http://en.wikipedia.org
ang - the angle in radiansx - the x component of the axisy - the y component of the axisz - the z component of the axisdest - will hold the resultpublic Matrix3f rotateLocal(float ang, float x, float y, float z, Matrix3f dest)
dest.
The axis described by the three components needs to be a unit vector.
When used with a right-handed coordinate system, the produced rotation will rotate vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.
If M is this matrix and R the rotation matrix,
then the new matrix will be R * M. So when transforming a
vector v with the new matrix by using R * M * v, the
rotation will be applied last!
In order to set the matrix to a rotation matrix without pre-multiplying the rotation
transformation, use rotation().
Reference: http://en.wikipedia.org
ang - the angle in radiansx - the x component of the axisy - the y component of the axisz - the z component of the axisdest - will hold the resultrotation(float, float, float, float)public Matrix3f rotateLocal(float ang, float x, float y, float z)
The axis described by the three components needs to be a unit vector.
When used with a right-handed coordinate system, the produced rotation will rotate vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.
If M is this matrix and R the rotation matrix,
then the new matrix will be R * M. So when transforming a
vector v with the new matrix by using R * M * v, the
rotation will be applied last!
In order to set the matrix to a rotation matrix without pre-multiplying the rotation
transformation, use rotation().
Reference: http://en.wikipedia.org
ang - the angle in radiansx - the x component of the axisy - the y component of the axisz - the z component of the axisrotation(float, float, float, float)public Matrix3f rotate(Quaternionf quat)
Quaternionf to this matrix.
If M is this matrix and Q the rotation matrix obtained from the given quaternion,
then the new matrix will be M * Q. So when transforming a
vector v with the new matrix by using M * Q * v,
the quaternion rotation will be applied first!
In order to set the matrix to a rotation transformation without post-multiplying,
use rotation(Quaternionf).
Reference: http://en.wikipedia.org
quat - the Quaternionfrotation(Quaternionf)public Matrix3f rotate(Quaternionf quat, Matrix3f dest)
Quaternionf to this matrix and store
the result in dest.
If M is this matrix and Q the rotation matrix obtained from the given quaternion,
then the new matrix will be M * Q. So when transforming a
vector v with the new matrix by using M * Q * v,
the quaternion rotation will be applied first!
In order to set the matrix to a rotation transformation without post-multiplying,
use rotation(Quaternionf).
Reference: http://en.wikipedia.org
quat - the Quaternionfdest - will hold the resultrotation(Quaternionf)public Matrix3f rotateLocal(Quaternionf quat, Matrix3f dest)
Quaternionf to this matrix and store
the result in dest.
When used with a right-handed coordinate system, the produced rotation will rotate vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.
If M is this matrix and Q the rotation matrix obtained from the given quaternion,
then the new matrix will be Q * M. So when transforming a
vector v with the new matrix by using Q * M * v,
the quaternion rotation will be applied last!
In order to set the matrix to a rotation transformation without pre-multiplying,
use rotation(Quaternionf).
Reference: http://en.wikipedia.org
quat - the Quaternionfdest - will hold the resultrotation(Quaternionf)public Matrix3f rotateLocal(Quaternionf quat)
Quaternionf to this matrix.
When used with a right-handed coordinate system, the produced rotation will rotate vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.
If M is this matrix and Q the rotation matrix obtained from the given quaternion,
then the new matrix will be Q * M. So when transforming a
vector v with the new matrix by using Q * M * v,
the quaternion rotation will be applied last!
In order to set the matrix to a rotation transformation without pre-multiplying,
use rotation(Quaternionf).
Reference: http://en.wikipedia.org
quat - the Quaternionfrotation(Quaternionf)public Matrix3f rotate(float angle, Vector3f axis)
If M is this matrix and A the rotation matrix obtained from the given angle and axis,
then the new matrix will be M * A. So when transforming a
vector v with the new matrix by using M * A * v,
the axis-angle rotation will be applied first!
In order to set the matrix to a rotation transformation without post-multiplying,
use rotation(float, Vector3f).
Reference: http://en.wikipedia.org
angle - the angle in radiansaxis - the rotation axis (needs to be normalized)rotate(float, float, float, float),
rotation(float, Vector3f)public Matrix3f rotate(float angle, Vector3f axis, Matrix3f dest)
dest.
If M is this matrix and A the rotation matrix obtained from the given angle and axis,
then the new matrix will be M * A. So when transforming a
vector v with the new matrix by using M * A * v,
the axis-angle rotation will be applied first!
In order to set the matrix to a rotation transformation without post-multiplying,
use rotation(float, Vector3f).
Reference: http://en.wikipedia.org
angle - the angle in radiansaxis - the rotation axis (needs to be normalized)dest - will hold the resultrotate(float, float, float, float),
rotation(float, Vector3f)public Matrix3f lookAlong(Vector3f dir, Vector3f up)
-z point along dir.
If M is this matrix and L the lookalong rotation matrix,
then the new matrix will be M * L. So when transforming a
vector v with the new matrix by using M * L * v, the
lookalong rotation transformation will be applied first!
In order to set the matrix to a lookalong transformation without post-multiplying it,
use setLookAlong().
dir - the direction in space to look alongup - the direction of 'up'lookAlong(float, float, float, float, float, float),
setLookAlong(Vector3f, Vector3f)public Matrix3f lookAlong(Vector3f dir, Vector3f up, Matrix3f dest)
-z point along dir
and store the result in dest.
If M is this matrix and L the lookalong rotation matrix,
then the new matrix will be M * L. So when transforming a
vector v with the new matrix by using M * L * v, the
lookalong rotation transformation will be applied first!
In order to set the matrix to a lookalong transformation without post-multiplying it,
use setLookAlong().
dir - the direction in space to look alongup - the direction of 'up'dest - will hold the resultlookAlong(float, float, float, float, float, float),
setLookAlong(Vector3f, Vector3f)public Matrix3f lookAlong(float dirX, float dirY, float dirZ, float upX, float upY, float upZ, Matrix3f dest)
-z point along dir
and store the result in dest.
If M is this matrix and L the lookalong rotation matrix,
then the new matrix will be M * L. So when transforming a
vector v with the new matrix by using M * L * v, the
lookalong rotation transformation will be applied first!
In order to set the matrix to a lookalong transformation without post-multiplying it,
use setLookAlong()
dirX - the x-coordinate of the direction to look alongdirY - the y-coordinate of the direction to look alongdirZ - the z-coordinate of the direction to look alongupX - the x-coordinate of the up vectorupY - the y-coordinate of the up vectorupZ - the z-coordinate of the up vectordest - will hold the resultsetLookAlong(float, float, float, float, float, float)public Matrix3f lookAlong(float dirX, float dirY, float dirZ, float upX, float upY, float upZ)
-z point along dir.
If M is this matrix and L the lookalong rotation matrix,
then the new matrix will be M * L. So when transforming a
vector v with the new matrix by using M * L * v, the
lookalong rotation transformation will be applied first!
In order to set the matrix to a lookalong transformation without post-multiplying it,
use setLookAlong()
dirX - the x-coordinate of the direction to look alongdirY - the y-coordinate of the direction to look alongdirZ - the z-coordinate of the direction to look alongupX - the x-coordinate of the up vectorupY - the y-coordinate of the up vectorupZ - the z-coordinate of the up vectorsetLookAlong(float, float, float, float, float, float)public Matrix3f setLookAlong(Vector3f dir, Vector3f up)
-z
point along dir.
In order to apply the lookalong transformation to any previous existing transformation,
use lookAlong(Vector3f, Vector3f).
dir - the direction in space to look alongup - the direction of 'up'setLookAlong(Vector3f, Vector3f),
lookAlong(Vector3f, Vector3f)public Matrix3f setLookAlong(float dirX, float dirY, float dirZ, float upX, float upY, float upZ)
-z
point along dir.
In order to apply the lookalong transformation to any previous existing transformation,
use lookAlong()
dirX - the x-coordinate of the direction to look alongdirY - the y-coordinate of the direction to look alongdirZ - the z-coordinate of the direction to look alongupX - the x-coordinate of the up vectorupY - the y-coordinate of the up vectorupZ - the z-coordinate of the up vectorsetLookAlong(float, float, float, float, float, float),
lookAlong(float, float, float, float, float, float)public Vector3f getRow(int row, Vector3f dest) throws IndexOutOfBoundsException
row index, starting with 0.row - the row index in [0..2]dest - will hold the row componentsIndexOutOfBoundsException - if row is not in [0..2]public Vector3f getColumn(int column, Vector3f dest) throws IndexOutOfBoundsException
column index, starting with 0.column - the column index in [0..2]dest - will hold the column componentsIndexOutOfBoundsException - if column is not in [0..2]public Matrix3f normal()
this matrix to its own normal matrix.
Please note that, if this is an orthogonal matrix or a matrix whose columns are orthogonal vectors,
then this method need not be invoked, since in that case this itself is its normal matrix.
In this case, use set(Matrix3f) to set a given Matrix3f to this matrix.
set(Matrix3f)public Matrix3f normal(Matrix3f dest)
this matrix and store it into dest.
Please note that, if this is an orthogonal matrix or a matrix whose columns are orthogonal vectors,
then this method need not be invoked, since in that case this itself is its normal matrix.
In this case, use set(Matrix3f) to set a given Matrix3f to this matrix.
dest - will hold the resultset(Matrix3f)public Vector3f getScale(Vector3f dest)
this matrix for the three base axes.dest - will hold the scaling factors for x, y and zpublic Vector3f positiveZ(Vector3f dir)
this matrix is applied.
This method is equivalent to the following code:
Matrix3f inv = new Matrix3f(this).invert(); inv.transform(dir.set(0, 0, 1)).normalize();If
this is already an orthogonal matrix, then consider using normalizedPositiveZ(Vector3f) instead.
Reference: http://www.euclideanspace.com
dir - will hold the direction of +Zpublic Vector3f normalizedPositiveZ(Vector3f dir)
this orthogonal matrix is applied.
This method only produces correct results if this is an orthogonal matrix.
This method is equivalent to the following code:
Matrix3f inv = new Matrix3f(this).transpose(); inv.transform(dir.set(0, 0, 1)).normalize();
Reference: http://www.euclideanspace.com
dir - will hold the direction of +Zpublic Vector3f positiveX(Vector3f dir)
this matrix is applied.
This method is equivalent to the following code:
Matrix3f inv = new Matrix3f(this).invert(); inv.transform(dir.set(1, 0, 0)).normalize();If
this is already an orthogonal matrix, then consider using normalizedPositiveX(Vector3f) instead.
Reference: http://www.euclideanspace.com
dir - will hold the direction of +Xpublic Vector3f normalizedPositiveX(Vector3f dir)
this orthogonal matrix is applied.
This method only produces correct results if this is an orthogonal matrix.
This method is equivalent to the following code:
Matrix3f inv = new Matrix3f(this).transpose(); inv.transform(dir.set(1, 0, 0)).normalize();
Reference: http://www.euclideanspace.com
dir - will hold the direction of +Xpublic Vector3f positiveY(Vector3f dir)
this matrix is applied.
This method is equivalent to the following code:
Matrix3f inv = new Matrix3f(this).invert(); inv.transform(dir.set(0, 1, 0)).normalize();If
this is already an orthogonal matrix, then consider using normalizedPositiveY(Vector3f) instead.
Reference: http://www.euclideanspace.com
dir - will hold the direction of +Ypublic Vector3f normalizedPositiveY(Vector3f dir)
this orthogonal matrix is applied.
This method only produces correct results if this is an orthogonal matrix.
This method is equivalent to the following code:
Matrix3f inv = new Matrix3f(this).transpose(); inv.transform(dir.set(0, 1, 0)).normalize();
Reference: http://www.euclideanspace.com
dir - will hold the direction of +YCopyright © 2015–2016 JOML. All rights reserved.