public class Matrix3f extends Object implements Externalizable, Matrix3fc
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(Matrix3fc mat)
Create a new
Matrix3f and make it a copy of the given matrix. |
Matrix3f(Matrix4fc mat)
|
Matrix3f(Vector3fc col0,
Vector3fc col1,
Vector3fc col2)
Create a new
Matrix3f and initialize its three columns using the supplied vectors. |
Modifier and Type | Method and Description |
---|---|
Matrix3f |
add(Matrix3fc other)
Component-wise add
this and other . |
Matrix3f |
add(Matrix3fc other,
Matrix3f dest)
Component-wise add
this and other and store the result in dest . |
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 . |
Vector3f |
getEulerAnglesZYX(Vector3f dest)
Extract the Euler angles from the rotation represented by
this matrix and store the extracted Euler angles in dest . |
Quaterniond |
getNormalizedRotation(Quaterniond dest)
Get the current values of
this matrix and store the represented rotation
into the given Quaterniond . |
Quaternionf |
getNormalizedRotation(Quaternionf dest)
Get the current values of
this matrix and store the represented rotation
into the given Quaternionf . |
AxisAngle4f |
getRotation(AxisAngle4f dest)
Get the current values of
this matrix and store the represented rotation
into the given AxisAngle4f . |
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. |
Quaterniond |
getUnnormalizedRotation(Quaterniond dest)
Get the current values of
this matrix and store the represented rotation
into the given Quaterniond . |
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 |
lerp(Matrix3fc other,
float t)
Linearly interpolate
this and other using the given interpolation factor t
and store the result in this . |
Matrix3f |
lerp(Matrix3fc other,
float t,
Matrix3f dest)
Linearly interpolate
this and other using the given interpolation factor t
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(Vector3fc dir,
Vector3fc up)
Apply a rotation transformation to this matrix to make
-z point along dir . |
Matrix3f |
lookAlong(Vector3fc dir,
Vector3fc 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(Matrix3fc right)
Multiply this matrix by the supplied
right matrix. |
Matrix3f |
mul(Matrix3fc right,
Matrix3f dest)
Multiply this matrix by the supplied
right matrix and store the result in dest . |
Matrix3f |
mulComponentWise(Matrix3fc other)
Component-wise multiply
this by other . |
Matrix3f |
mulComponentWise(Matrix3fc other,
Matrix3f dest)
Component-wise multiply
this by other 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(AxisAngle4f axisAngle)
Apply a rotation transformation, rotating about the given
AxisAngle4f , to this matrix. |
Matrix3f |
rotate(AxisAngle4f axisAngle,
Matrix3f dest)
Apply a rotation transformation, rotating about the given
AxisAngle4f and store the result in dest . |
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,
Vector3fc axis)
Apply a rotation transformation, rotating the given radians about the specified axis, to this matrix.
|
Matrix3f |
rotate(float angle,
Vector3fc axis,
Matrix3f dest)
Apply a rotation transformation, rotating the given radians about the specified axis and store the result in
dest . |
Matrix3f |
rotate(Quaternionfc quat)
Apply the rotation transformation of the given
Quaternionfc to this matrix. |
Matrix3f |
rotate(Quaternionfc quat,
Matrix3f dest)
Apply the rotation transformation of the given
Quaternionfc 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(Quaternionfc quat)
Pre-multiply the rotation transformation of the given
Quaternionfc to this matrix. |
Matrix3f |
rotateLocal(Quaternionfc quat,
Matrix3f dest)
Pre-multiply the rotation transformation of the given
Quaternionfc to this matrix and store
the result in dest . |
Matrix3f |
rotateTowards(float dirX,
float dirY,
float dirZ,
float upX,
float upY,
float upZ)
Apply a model transformation to this matrix for a right-handed coordinate system,
that aligns the local
+Z axis with direction . |
Matrix3f |
rotateTowards(float dirX,
float dirY,
float dirZ,
float upX,
float upY,
float upZ,
Matrix3f dest)
Apply a model transformation to this matrix for a right-handed coordinate system,
that aligns the local
+Z axis with dir
and store the result in dest . |
Matrix3f |
rotateTowards(Vector3fc direction,
Vector3fc up)
Apply a model transformation to this matrix for a right-handed coordinate system,
that aligns the local
+Z axis with direction . |
Matrix3f |
rotateTowards(Vector3fc direction,
Vector3fc up,
Matrix3f dest)
Apply a model transformation to this matrix for a right-handed coordinate system,
that aligns the local
+Z axis with direction
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 |
rotateXYZ(Vector3f angles)
Apply rotation of
angles.x radians about the X axis, followed by a rotation of angles.y radians about the Y axis and
followed by a rotation of angles.z radians about the Z axis. |
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 |
rotateYXZ(float angleY,
float angleX,
float angleZ)
Apply 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 |
rotateYXZ(float angleY,
float angleX,
float angleZ,
Matrix3f dest)
Apply 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 and store the result in dest . |
Matrix3f |
rotateYXZ(Vector3f angles)
Apply rotation of
angles.y radians about the Y axis, followed by a rotation of angles.x radians about the X axis and
followed by a rotation of angles.z radians about the Z axis. |
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 |
rotateZYX(Vector3f angles)
Apply rotation of
angles.z radians about the Z axis, followed by a rotation of angles.y radians about the Y axis and
followed by a rotation of angles.x radians about the X axis. |
Matrix3f |
rotation(AxisAngle4f axisAngle)
Set this matrix to a rotation transformation using the given
AxisAngle4f . |
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,
Vector3fc axis)
Set this matrix to a rotation matrix which rotates the given radians about a given axis.
|
Matrix3f |
rotation(Quaternionfc quat)
Set this matrix to the rotation transformation of the given
Quaternionfc . |
Matrix3f |
rotationTowards(float dirX,
float dirY,
float dirZ,
float upX,
float upY,
float upZ)
Set this matrix to a model transformation for a right-handed coordinate system,
that aligns the local
-z axis with center - eye . |
Matrix3f |
rotationTowards(Vector3fc dir,
Vector3fc up)
Set this matrix to a model transformation for a right-handed coordinate system,
that aligns the local
-z axis with center - eye . |
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(Vector3fc 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(Vector3fc xyz,
Matrix3f dest)
Apply scaling to
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
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(Vector3fc 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(AxisAngle4d axisAngle)
Set this matrix to be equivalent to the rotation specified by the given
AxisAngle4d . |
Matrix3f |
set(AxisAngle4f axisAngle)
Set this matrix to be equivalent to the rotation specified by the given
AxisAngle4f . |
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(Matrix3fc m)
Set the elements of this matrix to the ones in
m . |
Matrix3f |
set(Matrix4fc mat)
Set the elements of this matrix to the upper left 3x3 of the given
Matrix4fc . |
Matrix3f |
set(Quaterniondc q)
Set this matrix to a rotation equivalent to the given quaternion.
|
Matrix3f |
set(Quaternionfc q)
Set this matrix to be equivalent to the rotation specified by the given
Quaternionfc . |
Matrix3f |
set(Vector3fc col0,
Vector3fc col1,
Vector3fc col2)
Set the three columns of this matrix to the supplied vectors, respectively.
|
Matrix3f |
setColumn(int column,
Vector3fc src)
Set the column at the given
column index, starting with 0 . |
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(Vector3fc dir,
Vector3fc up)
Set this matrix to a rotation transformation to make
-z
point along dir . |
Matrix3f |
setRow(int row,
Vector3fc src)
Set the row at the given
row index, starting with 0 . |
Matrix3f |
setSkewSymmetric(float a,
float b,
float c)
Set this matrix to a skew-symmetric matrix using the following layout:
0, a, -b
-a, 0, c
b, -c, 0
Reference: https://en.wikipedia.org
|
Matrix3f |
sub(Matrix3fc subtrahend)
Component-wise subtract
subtrahend from this . |
Matrix3f |
sub(Matrix3fc subtrahend,
Matrix3f dest)
Component-wise subtract
subtrahend from this and store the result in dest . |
Matrix3f |
swap(Matrix3f other)
Exchange the values of
this matrix with the given other matrix. |
Matrix3fc |
toImmutable()
Create a new immutable view of this
Matrix3f . |
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(float x,
float y,
float z,
Vector3f dest)
Transform the vector (x, y, z) by this matrix and store the result in
dest . |
Vector3f |
transform(Vector3f v)
Transform the given vector by this matrix.
|
Vector3f |
transform(Vector3fc 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 m01
public float m02
public float m10
public float m11
public float m12
public float m20
public float m21
public float m22
public Matrix3f()
public Matrix3f(Matrix3fc mat)
Matrix3f
and make it a copy of the given matrix.mat
- the Matrix3fc
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()
Matrix3fc
public float m01()
Matrix3fc
public float m02()
Matrix3fc
public float m10()
Matrix3fc
public float m11()
Matrix3fc
public float m12()
Matrix3fc
public float m20()
Matrix3fc
public float m21()
Matrix3fc
public float m22()
Matrix3fc
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(Matrix3fc m)
m
.m
- the matrix to copy the elements frompublic Matrix3f set(Matrix4fc mat)
Matrix4fc
.mat
- the Matrix4fc
to copy the values frompublic Matrix3f set(AxisAngle4f axisAngle)
AxisAngle4f
.axisAngle
- the AxisAngle4f
public Matrix3f set(AxisAngle4d axisAngle)
AxisAngle4d
.axisAngle
- the AxisAngle4d
public Matrix3f set(Quaternionfc q)
Quaternionfc
.
This method is equivalent to calling: rotation(q)
Reference: http://www.euclideanspace.com/
q
- the Quaternionfc
rotation(Quaternionfc)
public Matrix3f set(Quaterniondc q)
Reference: http://www.euclideanspace.com/
q
- the quaternionpublic Matrix3f mul(Matrix3fc 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(Matrix3fc right, Matrix3f dest)
Matrix3fc
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!
public 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 Matrix3f set(Vector3fc col0, Vector3fc col1, Vector3fc col2)
col0
- the first columncol1
- the second columncol2
- the third columnpublic float determinant()
Matrix3fc
determinant
in interface Matrix3fc
public Matrix3f invert()
public Matrix3f invert(Matrix3f dest)
Matrix3fc
this
matrix and store the result in dest
.public Matrix3f transpose()
public Matrix3f transpose(Matrix3f dest)
Matrix3fc
this
matrix and store the result in dest
.public 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(Matrix3fc)
and allows to obtain
intermediate calculation results when chaining multiple transformations.
get
in interface Matrix3fc
dest
- the destination matrixset(Matrix3fc)
public Matrix4f get(Matrix4f dest)
Matrix3fc
this
matrix and store them as
the rotational component of dest
. All other values of dest
will
be set to identity.get
in interface Matrix3fc
dest
- the destination matrixMatrix4f.set(Matrix3fc)
public AxisAngle4f getRotation(AxisAngle4f dest)
Matrix3fc
this
matrix and store the represented rotation
into the given AxisAngle4f
.getRotation
in interface Matrix3fc
dest
- the destination AxisAngle4f
AxisAngle4f.set(Matrix3fc)
public Quaternionf getUnnormalizedRotation(Quaternionf dest)
Matrix3fc
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.
getUnnormalizedRotation
in interface Matrix3fc
dest
- the destination Quaternionf
Quaternionf.setFromUnnormalized(Matrix3fc)
public Quaternionf getNormalizedRotation(Quaternionf dest)
Matrix3fc
this
matrix and store the represented rotation
into the given Quaternionf
.
This method assumes that the three column vectors of this matrix are normalized.
getNormalizedRotation
in interface Matrix3fc
dest
- the destination Quaternionf
Quaternionf.setFromNormalized(Matrix3fc)
public Quaterniond getUnnormalizedRotation(Quaterniond dest)
Matrix3fc
this
matrix and store the represented rotation
into the given Quaterniond
.
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.
getUnnormalizedRotation
in interface Matrix3fc
dest
- the destination Quaterniond
Quaterniond.setFromUnnormalized(Matrix3fc)
public Quaterniond getNormalizedRotation(Quaterniond dest)
Matrix3fc
this
matrix and store the represented rotation
into the given Quaterniond
.
This method assumes that the three column vectors of this matrix are normalized.
getNormalizedRotation
in interface Matrix3fc
dest
- the destination Quaterniond
Quaterniond.setFromNormalized(Matrix3fc)
public FloatBuffer get(FloatBuffer buffer)
Matrix3fc
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 Matrix3fc.get(int, FloatBuffer)
, taking
the absolute position as parameter.
get
in interface Matrix3fc
buffer
- will receive the values of this matrix in column-major order at its current positionMatrix3fc.get(int, FloatBuffer)
public FloatBuffer get(int index, FloatBuffer buffer)
Matrix3fc
FloatBuffer
starting at the specified
absolute buffer position/index.
This method will not increment the position of the given FloatBuffer.
public ByteBuffer get(ByteBuffer buffer)
Matrix3fc
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 Matrix3fc.get(int, ByteBuffer)
, taking
the absolute position as parameter.
get
in interface Matrix3fc
buffer
- will receive the values of this matrix in column-major order at its current positionMatrix3fc.get(int, ByteBuffer)
public ByteBuffer get(int index, ByteBuffer buffer)
Matrix3fc
ByteBuffer
starting at the specified
absolute buffer position/index.
This method will not increment the position of the given ByteBuffer.
public FloatBuffer getTransposed(FloatBuffer buffer)
Matrix3fc
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 Matrix3fc.getTransposed(int, FloatBuffer)
, taking
the absolute position as parameter.
getTransposed
in interface Matrix3fc
buffer
- will receive the values of this matrix in column-major order at its current positionMatrix3fc.getTransposed(int, FloatBuffer)
public FloatBuffer getTransposed(int index, FloatBuffer buffer)
Matrix3fc
FloatBuffer
starting at the specified
absolute buffer position/index.
This method will not increment the position of the given FloatBuffer.
getTransposed
in interface Matrix3fc
index
- the absolute position into the FloatBufferbuffer
- will receive the values of this matrix in column-major orderpublic ByteBuffer getTransposed(ByteBuffer buffer)
Matrix3fc
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 Matrix3fc.getTransposed(int, ByteBuffer)
, taking
the absolute position as parameter.
getTransposed
in interface Matrix3fc
buffer
- will receive the values of this matrix in column-major order at its current positionMatrix3fc.getTransposed(int, ByteBuffer)
public ByteBuffer getTransposed(int index, ByteBuffer buffer)
Matrix3fc
ByteBuffer
starting at the specified
absolute buffer position/index.
This method will not increment the position of the given ByteBuffer.
getTransposed
in interface Matrix3fc
index
- the absolute position into the ByteBufferbuffer
- will receive the values of this matrix in column-major orderpublic float[] get(float[] arr, int offset)
Matrix3fc
public float[] get(float[] arr)
Matrix3fc
In order to specify an explicit offset into the array, use the method Matrix3fc.get(float[], int)
.
get
in interface Matrix3fc
arr
- the array to write the matrix values intoMatrix3fc.get(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(Vector3fc xyz, Matrix3f dest)
Matrix3fc
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
.
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!
public Matrix3f scale(Vector3fc 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)
Matrix3fc
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!
public 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)
Matrix3fc
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!
scale
in interface Matrix3fc
xyz
- the factor for all componentsdest
- will hold the resultMatrix3fc.scale(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)
Matrix3fc
this
matrix by scaling the base axes by the given x,
y and z factors and store the result in 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!
scaleLocal
in interface Matrix3fc
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(Vector3fc 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(Vector3fc)
public Matrix3f rotation(float angle, Vector3fc axis)
The axis described by the axis
vector needs to be a unit vector.
When used with a right-handed coordinate system, the produced rotation will rotate a 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.
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, Vector3fc)
public Matrix3f rotation(AxisAngle4f axisAngle)
AxisAngle4f
.
When used with a right-handed coordinate system, the produced rotation will rotate a 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.
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
axisAngle
- the AxisAngle4f
(needs to be normalized
)rotate(AxisAngle4f)
public Matrix3f rotation(float angle, 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 a 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.
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)
When used with a right-handed coordinate system, the produced rotation will rotate a 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.
Reference: http://en.wikipedia.org
ang
- the angle in radianspublic Matrix3f rotationY(float ang)
When used with a right-handed coordinate system, the produced rotation will rotate a 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.
Reference: http://en.wikipedia.org
ang
- the angle in radianspublic Matrix3f rotationZ(float ang)
When used with a right-handed coordinate system, the produced rotation will rotate a 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.
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.
When used with a right-handed coordinate system, the produced rotation will rotate a 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.
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.
When used with a right-handed coordinate system, the produced rotation will rotate a 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.
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.
When used with a right-handed coordinate system, the produced rotation will rotate a 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.
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(Quaternionfc quat)
Quaternionfc
.
When used with a right-handed coordinate system, the produced rotation will rotate a 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.
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 Quaternionfc
rotate(Quaternionfc)
public Vector3f transform(Vector3f v)
Matrix3fc
public Vector3f transform(Vector3fc v, Vector3f dest)
Matrix3fc
dest
.public Vector3f transform(float x, float y, float z, Vector3f dest)
Matrix3fc
dest
.public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
IOException
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
IOException
ClassNotFoundException
public Matrix3f rotateX(float ang, Matrix3f dest)
Matrix3fc
dest
.
When used with a right-handed coordinate system, the produced rotation will rotate a 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 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
public Matrix3f rotateX(float ang)
When used with a right-handed coordinate system, the produced rotation will rotate a 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 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)
Matrix3fc
dest
.
When used with a right-handed coordinate system, the produced rotation will rotate a 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 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
public Matrix3f rotateY(float ang)
When used with a right-handed coordinate system, the produced rotation will rotate a 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 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)
Matrix3fc
dest
.
When used with a right-handed coordinate system, the produced rotation will rotate a 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 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
public Matrix3f rotateZ(float ang)
When used with a right-handed coordinate system, the produced rotation will rotate a 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 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(Vector3f angles)
angles.x
radians about the X axis, followed by a rotation of angles.y
radians about the Y axis and
followed by a rotation of angles.z
radians about the Z axis.
When used with a right-handed coordinate system, the produced rotation will rotate a 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 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(angles.x).rotateY(angles.y).rotateZ(angles.z)
angles
- the Euler anglespublic 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.
When used with a right-handed coordinate system, the produced rotation will rotate a 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 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)
Matrix3fc
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
.
When used with a right-handed coordinate system, the produced rotation will rotate a 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 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)
public Matrix3f rotateZYX(Vector3f angles)
angles.z
radians about the Z axis, followed by a rotation of angles.y
radians about the Y axis and
followed by a rotation of angles.x
radians about the X axis.
When used with a right-handed coordinate system, the produced rotation will rotate a 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 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(angles.z).rotateY(angles.y).rotateX(angles.x)
angles
- the Euler anglespublic 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.
When used with a right-handed coordinate system, the produced rotation will rotate a 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 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)
Matrix3fc
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
.
When used with a right-handed coordinate system, the produced rotation will rotate a 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 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)
public Matrix3f rotateYXZ(Vector3f angles)
angles.y
radians about the Y axis, followed by a rotation of angles.x
radians about the X axis and
followed by a rotation of angles.z
radians about the Z axis.
When used with a right-handed coordinate system, the produced rotation will rotate a 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 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: rotateY(angles.y).rotateX(angles.x).rotateZ(angles.z)
angles
- the Euler anglespublic Matrix3f rotateYXZ(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.
When used with a right-handed coordinate system, the produced rotation will rotate a 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 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: rotateY(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 rotateYXZ(float angleY, float angleX, float angleZ, Matrix3f dest)
Matrix3fc
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 and store the result in dest
.
When used with a right-handed coordinate system, the produced rotation will rotate a 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 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: rotateY(angleY, dest).rotateX(angleX).rotateZ(angleZ)
public Matrix3f rotate(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 a 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 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)
Matrix3fc
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 a 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 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
public 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 a 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
rotateLocal
in interface Matrix3fc
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 a 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(Quaternionfc quat)
Quaternionfc
to this matrix.
When used with a right-handed coordinate system, the produced rotation will rotate a 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 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(Quaternionfc)
.
Reference: http://en.wikipedia.org
quat
- the Quaternionfc
rotation(Quaternionfc)
public Matrix3f rotate(Quaternionfc quat, Matrix3f dest)
Quaternionfc
to this matrix and store
the result in dest
.
When used with a right-handed coordinate system, the produced rotation will rotate a 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 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(Quaternionfc)
.
Reference: http://en.wikipedia.org
rotate
in interface Matrix3fc
quat
- the Quaternionfc
dest
- will hold the resultrotation(Quaternionfc)
public Matrix3f rotateLocal(Quaternionfc quat, Matrix3f dest)
Quaternionfc
to this matrix and store
the result in dest
.
When used with a right-handed coordinate system, the produced rotation will rotate a 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(Quaternionfc)
.
Reference: http://en.wikipedia.org
rotateLocal
in interface Matrix3fc
quat
- the Quaternionfc
dest
- will hold the resultrotation(Quaternionfc)
public Matrix3f rotateLocal(Quaternionfc quat)
Quaternionfc
to this matrix.
When used with a right-handed coordinate system, the produced rotation will rotate a 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(Quaternionfc)
.
Reference: http://en.wikipedia.org
quat
- the Quaternionfc
rotation(Quaternionfc)
public Matrix3f rotate(AxisAngle4f axisAngle)
AxisAngle4f
, to this matrix.
When used with a right-handed coordinate system, the produced rotation will rotate a 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 A
the rotation matrix obtained from the given AxisAngle4f
,
then the new matrix will be M * A
. So when transforming a
vector v
with the new matrix by using M * A * v
,
the AxisAngle4f
rotation will be applied first!
In order to set the matrix to a rotation transformation without post-multiplying,
use rotation(AxisAngle4f)
.
Reference: http://en.wikipedia.org
axisAngle
- the AxisAngle4f
(needs to be normalized
)rotate(float, float, float, float)
,
rotation(AxisAngle4f)
public Matrix3f rotate(AxisAngle4f axisAngle, Matrix3f dest)
AxisAngle4f
and store the result in dest
.
When used with a right-handed coordinate system, the produced rotation will rotate a 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 A
the rotation matrix obtained from the given AxisAngle4f
,
then the new matrix will be M * A
. So when transforming a
vector v
with the new matrix by using M * A * v
,
the AxisAngle4f
rotation will be applied first!
In order to set the matrix to a rotation transformation without post-multiplying,
use rotation(AxisAngle4f)
.
Reference: http://en.wikipedia.org
rotate
in interface Matrix3fc
axisAngle
- the AxisAngle4f
(needs to be normalized
)dest
- will hold the resultrotate(float, float, float, float)
,
rotation(AxisAngle4f)
public Matrix3f rotate(float angle, Vector3fc axis)
When used with a right-handed coordinate system, the produced rotation will rotate a 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 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, Vector3fc)
.
Reference: http://en.wikipedia.org
angle
- the angle in radiansaxis
- the rotation axis (needs to be normalized
)rotate(float, float, float, float)
,
rotation(float, Vector3fc)
public Matrix3f rotate(float angle, Vector3fc axis, Matrix3f dest)
dest
.
When used with a right-handed coordinate system, the produced rotation will rotate a 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 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, Vector3fc)
.
Reference: http://en.wikipedia.org
rotate
in interface Matrix3fc
angle
- the angle in radiansaxis
- the rotation axis (needs to be normalized
)dest
- will hold the resultrotate(float, float, float, float)
,
rotation(float, Vector3fc)
public Matrix3f lookAlong(Vector3fc dir, Vector3fc 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(Vector3fc, Vector3fc)
public Matrix3f lookAlong(Vector3fc dir, Vector3fc 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()
.
lookAlong
in interface Matrix3fc
dir
- the direction in space to look alongup
- the direction of 'up'dest
- will hold the resultlookAlong(float, float, float, float, float, float)
,
setLookAlong(Vector3fc, Vector3fc)
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()
lookAlong
in interface Matrix3fc
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(Vector3fc dir, Vector3fc up)
-z
point along dir
.
In order to apply the lookalong transformation to any previous existing transformation,
use lookAlong(Vector3fc, Vector3fc)
.
dir
- the direction in space to look alongup
- the direction of 'up'setLookAlong(Vector3fc, Vector3fc)
,
lookAlong(Vector3fc, Vector3fc)
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
Matrix3fc
row
index, starting with 0
.getRow
in interface Matrix3fc
row
- the row index in [0..2]dest
- will hold the row componentsIndexOutOfBoundsException
- if row
is not in [0..2]public Matrix3f setRow(int row, Vector3fc src) throws IndexOutOfBoundsException
row
index, starting with 0
.row
- the row index in [0..2]src
- the row components to setIndexOutOfBoundsException
- if row
is not in [0..2]public Vector3f getColumn(int column, Vector3f dest) throws IndexOutOfBoundsException
Matrix3fc
column
index, starting with 0
.getColumn
in interface Matrix3fc
column
- the column index in [0..2]dest
- will hold the column componentsIndexOutOfBoundsException
- if column
is not in [0..2]public Matrix3f setColumn(int column, Vector3fc src) throws IndexOutOfBoundsException
column
index, starting with 0
.column
- the column index in [0..2]src
- the column components to setIndexOutOfBoundsException
- 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(Matrix3fc)
to set a given Matrix3f to this matrix.
set(Matrix3fc)
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(Matrix3fc)
to set a given Matrix3f to this matrix.
normal
in interface Matrix3fc
dest
- will hold the resultset(Matrix3fc)
public Vector3f getScale(Vector3f dest)
Matrix3fc
this
matrix for the three base axes.public Vector3f positiveZ(Vector3f dir)
Matrix3fc
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 Matrix3fc.normalizedPositiveZ(Vector3f)
instead.
Reference: http://www.euclideanspace.com
public Vector3f normalizedPositiveZ(Vector3f dir)
Matrix3fc
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));
Reference: http://www.euclideanspace.com
normalizedPositiveZ
in interface Matrix3fc
dir
- will hold the direction of +Zpublic Vector3f positiveX(Vector3f dir)
Matrix3fc
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 Matrix3fc.normalizedPositiveX(Vector3f)
instead.
Reference: http://www.euclideanspace.com
public Vector3f normalizedPositiveX(Vector3f dir)
Matrix3fc
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));
Reference: http://www.euclideanspace.com
normalizedPositiveX
in interface Matrix3fc
dir
- will hold the direction of +Xpublic Vector3f positiveY(Vector3f dir)
Matrix3fc
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 Matrix3fc.normalizedPositiveY(Vector3f)
instead.
Reference: http://www.euclideanspace.com
public Vector3f normalizedPositiveY(Vector3f dir)
Matrix3fc
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));
Reference: http://www.euclideanspace.com
normalizedPositiveY
in interface Matrix3fc
dir
- will hold the direction of +Ypublic Matrix3f swap(Matrix3f other)
this
matrix with the given other
matrix.other
- the other matrix to exchange the values withpublic Matrix3f add(Matrix3fc other)
this
and other
.other
- the other addendpublic Matrix3f add(Matrix3fc other, Matrix3f dest)
Matrix3fc
this
and other
and store the result in dest
.public Matrix3f sub(Matrix3fc subtrahend)
subtrahend
from this
.subtrahend
- the subtrahendpublic Matrix3f sub(Matrix3fc subtrahend, Matrix3f dest)
Matrix3fc
subtrahend
from this
and store the result in dest
.public Matrix3f mulComponentWise(Matrix3fc other)
this
by other
.other
- the other matrixpublic Matrix3f mulComponentWise(Matrix3fc other, Matrix3f dest)
Matrix3fc
this
by other
and store the result in dest
.mulComponentWise
in interface Matrix3fc
other
- the other matrixdest
- will hold the resultpublic Matrix3f setSkewSymmetric(float a, float b, float c)
0, a, -b -a, 0, c b, -c, 0Reference: https://en.wikipedia.org
a
- the value used for the matrix elements m01 and m10b
- the value used for the matrix elements m02 and m20c
- the value used for the matrix elements m12 and m21public Matrix3f lerp(Matrix3fc other, float t)
this
and other
using the given interpolation factor t
and store the result in this
.
If t
is 0.0 then the result is this
. If the interpolation factor is 1.0
then the result is other
.
other
- the other matrixt
- the interpolation factor between 0.0 and 1.0public Matrix3f lerp(Matrix3fc other, float t, Matrix3f dest)
Matrix3fc
this
and other
using the given interpolation factor t
and store the result in dest
.
If t
is 0.0 then the result is this
. If the interpolation factor is 1.0
then the result is other
.
public Matrix3f rotateTowards(Vector3fc direction, Vector3fc up, Matrix3f dest)
+Z
axis with direction
and store the result in dest
.
If M
is this
matrix and L
the lookat 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 lookat transformation will be applied first!
In order to set the matrix to a rotation transformation without post-multiplying it,
use rotationTowards()
.
This method is equivalent to calling: mul(new Matrix3f().lookAlong(new Vector3f(dir).negate(), up).invert(), dest)
rotateTowards
in interface Matrix3fc
direction
- the direction to rotate towardsup
- the model's up vectordest
- will hold the resultrotateTowards(float, float, float, float, float, float, Matrix3f)
,
rotationTowards(Vector3fc, Vector3fc)
public Matrix3f rotateTowards(Vector3fc direction, Vector3fc up)
+Z
axis with direction
.
If M
is this
matrix and L
the lookat 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 lookat transformation will be applied first!
In order to set the matrix to a rotation transformation without post-multiplying it,
use rotationTowards()
.
This method is equivalent to calling: mul(new Matrix3f().lookAlong(new Vector3f(dir).negate(), up).invert())
direction
- the direction to orient towardsup
- the up vectorrotateTowards(float, float, float, float, float, float)
,
rotationTowards(Vector3fc, Vector3fc)
public Matrix3f rotateTowards(float dirX, float dirY, float dirZ, float upX, float upY, float upZ)
+Z
axis with direction
.
If M
is this
matrix and L
the lookat 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 lookat transformation will be applied first!
In order to set the matrix to a rotation transformation without post-multiplying it,
use rotationTowards()
.
This method is equivalent to calling: mul(new Matrix3f().lookAlong(-dirX, -dirY, -dirZ, upX, upY, upZ).invert())
dirX
- the x-coordinate of the direction to rotate towardsdirY
- the y-coordinate of the direction to rotate towardsdirZ
- the z-coordinate of the direction to rotate towardsupX
- the x-coordinate of the up vectorupY
- the y-coordinate of the up vectorupZ
- the z-coordinate of the up vectorrotateTowards(Vector3fc, Vector3fc)
,
rotationTowards(float, float, float, float, float, float)
public Matrix3f rotateTowards(float dirX, float dirY, float dirZ, float upX, float upY, float upZ, Matrix3f dest)
+Z
axis with dir
and store the result in dest
.
If M
is this
matrix and L
the lookat 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 lookat transformation will be applied first!
In order to set the matrix to a rotation transformation without post-multiplying it,
use rotationTowards()
.
This method is equivalent to calling: mul(new Matrix3f().lookAlong(-dirX, -dirY, -dirZ, upX, upY, upZ).invert(), dest)
rotateTowards
in interface Matrix3fc
dirX
- the x-coordinate of the direction to rotate towardsdirY
- the y-coordinate of the direction to rotate towardsdirZ
- the z-coordinate of the direction to rotate towardsupX
- the x-coordinate of the up vectorupY
- the y-coordinate of the up vectorupZ
- the z-coordinate of the up vectordest
- will hold the resultrotateTowards(Vector3fc, Vector3fc)
,
rotationTowards(float, float, float, float, float, float)
public Matrix3f rotationTowards(Vector3fc dir, Vector3fc up)
-z
axis with center - eye
.
In order to apply the rotation transformation to a previous existing transformation,
use rotateTowards
.
This method is equivalent to calling: setLookAlong(new Vector3f(dir).negate(), up).invert()
dir
- the direction to orient the local -z axis towardsup
- the up vectorrotationTowards(Vector3fc, Vector3fc)
,
rotateTowards(float, float, float, float, float, float)
public Matrix3f rotationTowards(float dirX, float dirY, float dirZ, float upX, float upY, float upZ)
-z
axis with center - eye
.
In order to apply the rotation transformation to a previous existing transformation,
use rotateTowards
.
This method is equivalent to calling: setLookAlong(-dirX, -dirY, -dirZ, upX, upY, upZ).invert()
dirX
- the x-coordinate of the direction to rotate towardsdirY
- the y-coordinate of the direction to rotate towardsdirZ
- the z-coordinate of the direction to rotate towardsupX
- the x-coordinate of the up vectorupY
- the y-coordinate of the up vectorupZ
- the z-coordinate of the up vectorrotateTowards(Vector3fc, Vector3fc)
,
rotationTowards(float, float, float, float, float, float)
public Vector3f getEulerAnglesZYX(Vector3f dest)
this
matrix and store the extracted Euler angles in dest
.
This method assumes that this
matrix only represents a rotation without scaling.
Note that the returned Euler angles must be applied in the order Z * Y * X to obtain the identical matrix.
This means that calling rotateZYX(float, float, float)
using the obtained Euler angles will yield
the same rotation as the original matrix from which the Euler angles were obtained, so in the below code the matrix
m2 should be identical to m (disregarding possible floating-point inaccuracies).
Matrix3f m = ...; // <- matrix only representing rotation Matrix3f n = new Matrix3f(); n.rotateZYX(m.getEulerAnglesZYX(new Vector3f()));
Reference: http://nghiaho.com/
getEulerAnglesZYX
in interface Matrix3fc
dest
- will hold the extracted Euler anglespublic Matrix3fc toImmutable()
Matrix3f
.
The observable state of the returned object is the same as that of this
, but casting
the returned object to Matrix3f will not be possible.
This method allocates a new instance of a class implementing Matrix3fc on every call.
Copyright © 2015–2016 JOML. All rights reserved.