Create a new Matrix4 and set it to {@link #identity() identity}.
Create a new Matrix4 and make it a copy of the given matrix.
the <a href="Matrix4.html">Matrix4</a> to copy the values from
Create a new 4x4 matrix using the supplied double values.
The matrix layout will be:
m00, m10, m20, m30
m01, m11, m21, m31
m02, m12, m22, m32
m03, m13, m23, m33
the value of m00
the value of m01
the value of m02
the value of m03
the value of m10
the value of m11
the value of m12
the value of m13
the value of m20
the value of m21
the value of m22
the value of m23
the value of m30
the value of m31
the value of m32
the value of m33
Create a new {@link Matrix4d} and initialize its four columns using the supplied vectors.
the first column
the second column
the third column
the fourth column
Assume the given properties about this matrix.
Use one or multiple of 0, {@link Matrix4dc#PROPERTY_IDENTITY}, {@link Matrix4dc#PROPERTY_TRANSLATION}, {@link Matrix4dc#PROPERTY_AFFINE}, {@link Matrix4dc#PROPERTY_PERSPECTIVE}, {@link Matrix4fc#PROPERTY_ORTHONORMAL}.
this
Compute the extents of the coordinate system before this {@link #isAffine() affine} transformation was applied
and store the resulting corner coordinates in corner
and the span vectors in
xDir
, yDir
and zDir
.
That means, given the maximum extents of the coordinate system between [-1..+1]
in all dimensions,
this method returns one corner and the length and direction of the three base axis vectors in the coordinate
system before this transformation is applied, which transforms into the corner coordinates [-1, +1]
.
This method is equivalent to computing at least three adjacent corners using {@link #frustumCorner(int, Vector3d)} and subtracting them to obtain the length and direction of the span vectors.
will hold one corner of the span (usually the corner {@link Matrix4dc#CORNER_NXNYNZ})
will hold the direction and length of the span along the positive X axis
will hold the direction and length of the span along the positive Y axis
will hold the direction and length of the span along the positive z axis
this
Apply an arcball view transformation to this matrix with the given radius
and center
position of the arcball and the specified X and Y rotation angles.
This method is equivalent to calling: translate(0, 0, -radius).rotateX(angleX).rotateY(angleY).translate(-center.x, -center.y, -center.z)
the arcball radius
the center position of the arcball
the rotation angle around the X axis in radians
the rotation angle around the Y axis in radians
dest
Set this matrix to a cylindrical billboard transformation that rotates the local +Z axis of a given object with position objPos
towards
a target position at targetPos
while constraining a cylindrical rotation around the given up
vector.
This method can be used to create the complete model transformation for a given object, including the translation of the object to
its position objPos
.
the position of the object to rotate towards <code>targetPos</code>
the position of the target (for example the camera) towards which to rotate the object
the rotation axis (must be {@link Vector3d#normalize() normalized})
this
Set this matrix to a spherical billboard transformation that rotates the local +Z axis of a given object with position objPos
towards
a target position at targetPos
.
This method can be used to create the complete model transformation for a given object, including the translation of the object to
its position objPos
.
If preserving an up vector is not necessary when rotating the +Z axis, then a shortest arc rotation can be obtained using {@link #billboardSpherical(Vector3dc, Vector3dc)}.
the position of the object to rotate towards <code>targetPos</code>
the position of the target (for example the camera) towards which to rotate the object
the up axis used to orient the object
this
Set this matrix to a spherical billboard transformation that rotates the local +Z axis of a given object with position objPos
towards
a target position at targetPos
using a shortest arc rotation by not preserving any up vector of the object.
This method can be used to create the complete model transformation for a given object, including the translation of the object to
its position objPos
.
In order to specify an up vector which needs to be maintained when rotating the +Z axis of the object, use {@link #billboardSpherical(Vector3, Vector3, Vector3)}.
the position of the object to rotate towards <code>targetPos</code>
the position of the target (for example the camera) towards which to rotate the object
this
Compute the cofactor matrix of the upper left 3x3 submatrix of this
and store it into dest
.
The cofactor matrix can be used instead of {@link #normal(Matrix3d)} to transform normals when the orientation of the normals with respect to the surface should be preserved.
will hold the result
dest
Compute the cofactor matrix of the upper left 3x3 submatrix of this
and store it into dest
.
All other values of dest
will be set to {@link #identity() identity}.
The cofactor matrix can be used instead of {@link #normal(Matrix4d)} to transform normals when the orientation of the normals with respect to the surface should be preserved.
will hold the result
dest
Component-wise add the upper 4x3 submatrices of this
and other
by first multiplying each component of other
's 4x3 submatrix by otherFactor
and
adding that result to this
.
The matrix other
will not be changed.
the other matrix
the factor to multiply each of the other matrix's 4x3 components
this
Apply an arbitrary perspective projection frustum transformation for a right-handed coordinate system
using the given NDC z range to this matrix and store the result in dest
.
If M
is this
matrix and F
the frustum matrix,
then the new matrix will be M * F
. So when transforming a
vector v
with the new matrix by using M * F * v
,
the frustum transformation will be applied first!
In order to set the matrix to a perspective frustum transformation without post-multiplying, use {@link #setFrustum(double, double, double, double, double, double, boolean) setFrustum()}.
Reference: http://www.songho.ca
the distance along the x-axis to the left frustum edge
the distance along the x-axis to the right frustum edge
the distance along the y-axis to the bottom frustum edge
the distance along the y-axis to the top frustum edge
near clipping plane distance. This value must be greater than zero.
If the special value {@link Double#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity.
In that case, <code>zFar</code> may not also be {@link Double#POSITIVE_INFINITY}.
far clipping plane distance. This value must be greater than zero.
If the special value {@link Double#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity.
In that case, <code>zNear</code> may not also be {@link Double#POSITIVE_INFINITY}.
whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>
will hold the result
dest
Compute the axis-aligned bounding box of the frustum described by this
matrix and store the minimum corner
coordinates in the given min
and the maximum corner coordinates in the given max
vector.
The matrix this
is assumed to be the {@link #invert() inverse} of the origial view-projection matrix
for which to compute the axis-aligned bounding box in world-space.
The axis-aligned bounding box of the unit frustum is (-1, -1, -1)
, (1, 1, 1)
.
will hold the minimum corner coordinates of the axis-aligned bounding box
will hold the maximum corner coordinates of the axis-aligned bounding box
this
Apply an arbitrary perspective projection frustum transformation for a left-handed coordinate system
using the given NDC z range to this matrix and store the result in dest
.
If M
is this
matrix and F
the frustum matrix,
then the new matrix will be M * F
. So when transforming a
vector v
with the new matrix by using M * F * v
,
the frustum transformation will be applied first!
In order to set the matrix to a perspective frustum transformation without post-multiplying, use {@link #setFrustumLH(double, double, double, double, double, double, boolean) setFrustumLH()}.
Reference: http://www.songho.ca
the distance along the x-axis to the left frustum edge
the distance along the x-axis to the right frustum edge
the distance along the y-axis to the bottom frustum edge
the distance along the y-axis to the top frustum edge
near clipping plane distance. This value must be greater than zero.
If the special value {@link Double#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity.
In that case, <code>zFar</code> may not also be {@link Double#POSITIVE_INFINITY}.
far clipping plane distance. This value must be greater than zero.
If the special value {@link Double#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity.
In that case, <code>zNear</code> may not also be {@link Double#POSITIVE_INFINITY}.
whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>
will hold the result
dest
Apply a rotation transformation, rotating about the given {@link AxisAngle4d} 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 {@link AxisAngle4d},
then the new matrix will be M * A
. So when transforming a
vector v
with the new matrix by using M * A * v
,
the {@link AxisAngle4d} rotation will be applied first!
In order to set the matrix to a rotation transformation without post-multiplying, use {@link #rotation(AxisAngle4d)}.
Reference: http://en.wikipedia.org
will hold the result
dest
Reset this matrix to the identity.
Please note that if a call to {@link #identity()} is immediately followed by a call to: {@link #translate(double, double, double) translate}, {@link #rotate(double, double, double, double) rotate}, {@link #scale(double, double, double) scale}, {@link #perspective(double, double, double, double) perspective}, {@link #frustum(double, double, double, double, double, double) frustum}, {@link #ortho(double, double, double, double, double, double) ortho}, {@link #ortho2D(double, double, double, double) ortho2D}, {@link #lookAt(double, double, double, double, double, double, double, double, double) lookAt}, {@link #lookAlong(double, double, double, double, double, double) lookAlong}, or any of their overloads, then the call to {@link #identity()} can be omitted and the subsequent call replaced with: {@link #translation(double, double, double) translation}, {@link #rotation(double, double, double, double) rotation}, {@link #scaling(double, double, double) scaling}, {@link #setPerspective(double, double, double, double) setPerspective}, {@link #setFrustum(double, double, double, double, double, double) setFrustum}, {@link #setOrtho(double, double, double, double, double, double) setOrtho}, {@link #setOrtho2D(double, double, double, double) setOrtho2D}, {@link #setLookAt(double, double, double, double, double, double, double, double, double) setLookAt}, {@link #setLookAlong(double, double, double, double, double, double) setLookAlong}, or any of their overloads.
this
Invert this matrix.
If this
matrix represents an {@link #isAffine() affine} transformation, such as translation, rotation, scaling and shearing,
and thus its last row is equal to (0, 0, 0, 1)
, then {@link #invertAffine()} can be used instead of this method.
this
If this
is an arbitrary perspective projection matrix obtained via one of the {@link #frustum(double, double, double, double, double, double) frustum()} methods
or via {@link #setFrustum(double, double, double, double, double, double) setFrustum()},
then this method builds the inverse of this
.
This method can be used to quickly obtain the inverse of a perspective projection matrix.
If this matrix represents a symmetric perspective frustum transformation, as obtained via {@link #perspective(double, double, double, double) perspective()}, then {@link #invertPerspective()} should be used instead.
this
If this
is a perspective projection matrix obtained via one of the {@link #perspective(double, double, double, double) perspective()} methods
or via {@link #setPerspective(double, double, double, double) setPerspective()}, that is, if this
is a symmetrical perspective frustum transformation,
then this method builds the inverse of this
.
This method can be used to quickly obtain the inverse of a perspective projection matrix when being obtained via {@link #perspective(double, double, double, double) perspective()}.
this
Linearly interpolate 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
.
the other matrix
the interpolation factor between 0.0 and 1.0
will hold the result
dest
Apply a rotation transformation to this matrix to make -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!
This is equivalent to calling
{@link #lookAt(Vector3dc, Vector3dc, Vector3dc) lookAt}
with eye = (0, 0, 0)
and center = dir
.
In order to set the matrix to a lookalong transformation without post-multiplying it, use {@link #setLookAlong(Vector3dc, Vector3dc) setLookAlong()}.
the direction in space to look along
the direction of 'up'
will hold the result
dest
Apply a rotation transformation to this matrix to make -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!
This is equivalent to calling
{@link #lookAt(double, double, double, double, double, double, double, double, double) lookAt()}
with eye = (0, 0, 0)
and center = dir
.
In order to set the matrix to a lookalong transformation without post-multiplying it, use {@link #setLookAlong(double, double, double, double, double, double) setLookAlong()}
the x-coordinate of the direction to look along
the y-coordinate of the direction to look along
the z-coordinate of the direction to look along
the x-coordinate of the up vector
the y-coordinate of the up vector
the z-coordinate of the up vector
will hold the result
dest
Apply a "lookat" transformation to this matrix for a right-handed coordinate system,
that aligns -z
with center - eye
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 lookat transformation without post-multiplying it, use {@link #setLookAt(Vector3dc, Vector3dc, Vector3dc)}.
the position of the camera
the point in space to look at
the direction of 'up'
will hold the result
dest
Apply a "lookat" transformation to this matrix for a right-handed coordinate system,
that aligns -z
with center - eye
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 lookat transformation without post-multiplying it, use {@link #setLookAt(double, double, double, double, double, double, double, double, double) setLookAt()}.
the x-coordinate of the eye/camera location
the y-coordinate of the eye/camera location
the z-coordinate of the eye/camera location
the x-coordinate of the point to look at
the y-coordinate of the point to look at
the z-coordinate of the point to look at
the x-coordinate of the up vector
the y-coordinate of the up vector
the z-coordinate of the up vector
will hold the result
dest
Apply a "lookat" transformation to this matrix for a left-handed coordinate system,
that aligns +z
with center - eye
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 lookat transformation without post-multiplying it, use {@link #setLookAtLH(Vector3dc, Vector3dc, Vector3dc)}.
the position of the camera
the point in space to look at
the direction of 'up'
will hold the result
dest
Apply a "lookat" transformation to this matrix for a left-handed coordinate system,
that aligns +z
with center - eye
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 lookat transformation without post-multiplying it, use {@link #setLookAtLH(double, double, double, double, double, double, double, double, double) setLookAtLH()}.
the x-coordinate of the eye/camera location
the y-coordinate of the eye/camera location
the z-coordinate of the eye/camera location
the x-coordinate of the point to look at
the y-coordinate of the point to look at
the z-coordinate of the point to look at
the x-coordinate of the up vector
the y-coordinate of the up vector
the z-coordinate of the up vector
will hold the result
dest
Apply a "lookat" transformation to this matrix for a right-handed coordinate system,
that aligns -z
with center - eye
and store the result in dest
.
This method assumes this
to be a perspective transformation, obtained via
{@link #frustum(double, double, double, double, double, double) frustum()} or {@link #perspective(double, double, double, double) perspective()} or
one of their overloads.
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 lookat transformation without post-multiplying it, use {@link #setLookAt(double, double, double, double, double, double, double, double, double) setLookAt()}.
the x-coordinate of the eye/camera location
the y-coordinate of the eye/camera location
the z-coordinate of the eye/camera location
the x-coordinate of the point to look at
the y-coordinate of the point to look at
the z-coordinate of the point to look at
the x-coordinate of the up vector
the y-coordinate of the up vector
the z-coordinate of the up vector
will hold the result
dest
Apply a "lookat" transformation to this matrix for a left-handed coordinate system,
that aligns +z
with center - eye
and store the result in dest
.
This method assumes this
to be a perspective transformation, obtained via
{@link #frustumLH(double, double, double, double, double, double) frustumLH()} or {@link #perspectiveLH(double, double, double, double) perspectiveLH()} or
one of their overloads.
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 lookat transformation without post-multiplying it, use {@link #setLookAtLH(double, double, double, double, double, double, double, double, double) setLookAtLH()}.
the x-coordinate of the eye/camera location
the y-coordinate of the eye/camera location
the z-coordinate of the eye/camera location
the x-coordinate of the point to look at
the y-coordinate of the point to look at
the z-coordinate of the point to look at
the x-coordinate of the up vector
the y-coordinate of the up vector
the z-coordinate of the up vector
will hold the result
dest
Multiply this matrix by the supplied 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!
this
Multiply this matrix by the matrix with the supplied elements.
If M
is this
matrix and R
the right
matrix whose
elements are supplied via the parameters, the: then 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!
the m00 element of the right matrix
the m01 element of the right matrix
the m02 element of the right matrix
the m03 element of the right matrix
the m10 element of the right matrix
the m11 element of the right matrix
the m12 element of the right matrix
the m13 element of the right matrix
the m20 element of the right matrix
the m21 element of the right matrix
the m22 element of the right matrix
the m23 element of the right matrix
the m30 element of the right matrix
the m31 element of the right matrix
the m32 element of the right matrix
the m33 element of the right matrix
this
Multiply this matrix by the supplied 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!
This method neither assumes nor checks for any matrix properties of this
or right
and will always perform a complete 4x4 matrix multiplication. This method should only be used whenever the
multiplied matrices do not have any properties for which there are optimized multiplication methods available.
this
Multiply this matrix by the 3x3 matrix with the supplied elements expanded to a 4x4 matrix with all other matrix elements set to identity.
If M
is this
matrix and R
the right
matrix whose
elements are supplied via the parameters, the: then 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!
the m00 element of the right matrix
the m01 element of the right matrix
the m02 element of the right matrix
the m10 element of the right matrix
the m11 element of the right matrix
the m12 element of the right matrix
the m20 element of the right matrix
the m21 element of the right matrix
the m22 element of the right matrix
this
Multiply this matrix by the supplied right
matrix, of: both which are assumed to be {@link #isAffine() affine}, store: and the result in this
.
This method assumes that this
matrix and the given right
matrix both represent an {@link #isAffine() affine} transformation
(i.e. their last rows are equal to (0, 0, 0, 1)
)
and can be used to speed up matrix multiplication if the matrices only represent affine transformations, as: such translation, rotation, and: scaling shearing (any: in combination).
This method will not modify either the last row of this
or the last row of right
.
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!
the right operand of the matrix multiplication (last: the row is assumed to be <code>(0, 0, 0, 1)</code>)
this
Multiply this matrix by the supplied right
matrix, is: which assumed to be {@link #isAffine() affine}, store: and the result in this
.
This method assumes that the given right
matrix represents an {@link #isAffine() affine} transformation (i.e. its last row is equal to (0, 0, 0, 1)
)
and can be used to speed up matrix multiplication if the matrix only represents affine transformations, as: such translation, rotation, and: scaling shearing (any: in combination).
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!
the right operand of the matrix multiplication (last: the row is assumed to be <code>(0, 0, 0, 1)</code>)
this
Pre-multiply this matrix by the supplied left
matrix and store the result in this
.
If M
is this
matrix and L
the left
matrix,
then the new matrix will be L * M
. So when transforming a
vector v
with the new matrix by using L * M * v
, the
transformation of this
matrix will be applied first!
this
Pre-multiply this matrix by the supplied left
matrix, of: both which are assumed to be {@link #isAffine() affine}, store: and the result in this
.
This method assumes that this
matrix and the given left
matrix both represent an {@link #isAffine() affine} transformation
(i.e. their last rows are equal to (0, 0, 0, 1)
)
and can be used to speed up matrix multiplication if the matrices only represent affine transformations, as: such translation, rotation, and: scaling shearing (any: in combination).
This method will not modify either the last row of this
or the last row of left
.
If M
is this
matrix and L
the left
matrix,
then the new matrix will be L * M
. So when transforming a
vector v
with the new matrix by using L * M * v
, the
transformation of this
matrix will be applied first!
the left operand of the matrix multiplication (last: the row is assumed to be <code>(0, 0, 0, 1)</code>)
this
Multiply this
orthographic projection matrix by the supplied {@link #isAffine() affine} view
matrix.
If M
is this
matrix and V
the view
matrix,
then the new matrix will be M * V
. So when transforming a
vector v
with the new matrix by using M * V * v
, the
transformation of the view
matrix will be applied first!
this
Multiply this
symmetric perspective projection matrix by the supplied {@link #isAffine() affine} view
matrix.
If P
is this
matrix and V
the view
matrix,
then the new matrix will be P * V
. So when transforming a
vector v
with the new matrix by using P * V * v
, the
transformation of the view
matrix will be applied first!
the {@link #isAffine() affine} matrix to multiply <code>this</code> symmetric perspective projection matrix by
this
Compute a normal matrix from the upper left 3x3 submatrix of this
and store it into the upper left 3x3 submatrix of dest
.
All other values of dest
will be set to {@link #identity() identity}.
The normal matrix of m
is the transpose of the inverse of m
.
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 that case, use {@link #set3x3(Matrix4dc)} to set a given Matrix4d to only the upper left 3x3 submatrix
of a given matrix.
will hold the result
dest
Compute a normal matrix from the upper left 3x3 submatrix of this
and store it into dest
.
The normal matrix of m
is the transpose of the inverse of m
.
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 that case, use {@link Matrix3d#set(Matrix4dc)} to set a given Matrix3d to only the upper left 3x3 submatrix
of this matrix.
will hold the result
dest
Normalize the upper left 3x3 submatrix of this matrix.
The resulting matrix will map unit vectors to unit vectors, though a pair of orthogonal input unit vectors need not be mapped to a pair of orthogonal output vectors if the original matrix was not orthogonal itself (i.e. had skewing).
this
Apply an oblique projection transformation to this matrix with the given values for a
and
b
and store the result in dest
.
If M
is this
matrix and O
the oblique transformation matrix,
then the new matrix will be M * O
. So when transforming a
vector v
with the new matrix by using M * O * v
, the
oblique transformation will be applied first!
The oblique transformation is defined as:
x' = x + a*z y' = y + a*z z' = zor in matrix form:
1 0 a 0 0 1 b 0 0 0 1 0 0 0 0 1
the value for the z factor that applies to x
the value for the z factor that applies to y
will hold the result
dest
Apply an orthographic projection transformation for a right-handed coordinate system
using OpenGL's NDC z range of [-1..+1]
to this matrix and store the result in dest
.
If M
is this
matrix and O
the orthographic projection matrix,
then the new matrix will be M * O
. So when transforming a
vector v
with the new matrix by using M * O * v
, the
orthographic projection transformation will be applied first!
In order to set the matrix to an orthographic projection without post-multiplying it, use {@link #setOrtho(double, double, double, double, double, double) setOrtho()}.
Reference: http://www.songho.ca
the distance from the center to the left frustum edge
the distance from the center to the right frustum edge
the distance from the center to the bottom frustum edge
the distance from the center to the top frustum edge
near clipping plane distance
far clipping plane distance
will hold the result
dest
Apply an orthographic projection transformation for a right-handed coordinate system
using the given NDC z range to this matrix and store the result in dest
.
If M
is this
matrix and O
the orthographic projection matrix,
then the new matrix will be M * O
. So when transforming a
vector v
with the new matrix by using M * O * v
, the
orthographic projection transformation will be applied first!
In order to set the matrix to an orthographic projection without post-multiplying it, use {@link #setOrtho(double, double, double, double, double, double, boolean) setOrtho()}.
Reference: http://www.songho.ca
the distance from the center to the left frustum edge
the distance from the center to the right frustum edge
the distance from the center to the bottom frustum edge
the distance from the center to the top frustum edge
near clipping plane distance
far clipping plane distance
whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>
will hold the result
dest
Apply an orthographic projection transformation for a right-handed coordinate system
to this matrix and store the result in dest
.
This method is equivalent to calling {@link #ortho(double, double, double, double, double, double, Matrix4d) ortho()} with
zNear=-1
and zFar=+1
.
If M
is this
matrix and O
the orthographic projection matrix,
then the new matrix will be M * O
. So when transforming a
vector v
with the new matrix by using M * O * v
, the
orthographic projection transformation will be applied first!
In order to set the matrix to an orthographic projection without post-multiplying it, use {@link #setOrtho2D(double, double, double, double) setOrtho()}.
Reference: http://www.songho.ca
the distance from the center to the left frustum edge
the distance from the center to the right frustum edge
the distance from the center to the bottom frustum edge
the distance from the center to the top frustum edge
will hold the result
dest
Apply an orthographic projection transformation for a left-handed coordinate system to this matrix and store the result in dest
.
This method is equivalent to calling {@link #orthoLH(double, double, double, double, double, double, Matrix4d) orthoLH()} with
zNear=-1
and zFar=+1
.
If M
is this
matrix and O
the orthographic projection matrix,
then the new matrix will be M * O
. So when transforming a
vector v
with the new matrix by using M * O * v
, the
orthographic projection transformation will be applied first!
In order to set the matrix to an orthographic projection without post-multiplying it, use {@link #setOrtho2DLH(double, double, double, double) setOrthoLH()}.
Reference: http://www.songho.ca
the distance from the center to the left frustum edge
the distance from the center to the right frustum edge
the distance from the center to the bottom frustum edge
the distance from the center to the top frustum edge
will hold the result
dest
Apply an orthographic projection transformation for a left-handed coordiante system
using OpenGL's NDC z range of [-1..+1]
to this matrix and store the result in dest
.
If M
is this
matrix and O
the orthographic projection matrix,
then the new matrix will be M * O
. So when transforming a
vector v
with the new matrix by using M * O * v
, the
orthographic projection transformation will be applied first!
In order to set the matrix to an orthographic projection without post-multiplying it, use {@link #setOrthoLH(double, double, double, double, double, double) setOrthoLH()}.
Reference: http://www.songho.ca
the distance from the center to the left frustum edge
the distance from the center to the right frustum edge
the distance from the center to the bottom frustum edge
the distance from the center to the top frustum edge
near clipping plane distance
far clipping plane distance
will hold the result
dest
Apply an orthographic projection transformation for a left-handed coordiante system
using the given NDC z range to this matrix and store the result in dest
.
If M
is this
matrix and O
the orthographic projection matrix,
then the new matrix will be M * O
. So when transforming a
vector v
with the new matrix by using M * O * v
, the
orthographic projection transformation will be applied first!
In order to set the matrix to an orthographic projection without post-multiplying it, use {@link #setOrthoLH(double, double, double, double, double, double, boolean) setOrthoLH()}.
Reference: http://www.songho.ca
the distance from the center to the left frustum edge
the distance from the center to the right frustum edge
the distance from the center to the bottom frustum edge
the distance from the center to the top frustum edge
near clipping plane distance
far clipping plane distance
whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>
will hold the result
dest
Apply a symmetric orthographic projection transformation for a right-handed coordinate system
using OpenGL's NDC z range of [-1..+1]
to this matrix and store the result in dest
.
This method is equivalent to calling {@link #ortho(double, double, double, double, double, double, Matrix4d) ortho()} with
left=-width/2
, right=+width/2
, bottom=-height/2
and top=+height/2
.
If M
is this
matrix and O
the orthographic projection matrix,
then the new matrix will be M * O
. So when transforming a
vector v
with the new matrix by using M * O * v
, the
orthographic projection transformation will be applied first!
In order to set the matrix to a symmetric orthographic projection without post-multiplying it, use {@link #setOrthoSymmetric(double, double, double, double) setOrthoSymmetric()}.
Reference: http://www.songho.ca
the distance between the right and left frustum edges
the distance between the top and bottom frustum edges
near clipping plane distance
far clipping plane distance
will hold the result
dest
Apply a symmetric orthographic projection transformation for a right-handed coordinate system
using the given NDC z range to this matrix and store the result in dest
.
This method is equivalent to calling {@link #ortho(double, double, double, double, double, double, boolean, Matrix4d) ortho()} with
left=-width/2
, right=+width/2
, bottom=-height/2
and top=+height/2
.
If M
is this
matrix and O
the orthographic projection matrix,
then the new matrix will be M * O
. So when transforming a
vector v
with the new matrix by using M * O * v
, the
orthographic projection transformation will be applied first!
In order to set the matrix to a symmetric orthographic projection without post-multiplying it, use {@link #setOrthoSymmetric(double, double, double, double, boolean) setOrthoSymmetric()}.
Reference: http://www.songho.ca
the distance between the right and left frustum edges
the distance between the top and bottom frustum edges
near clipping plane distance
far clipping plane distance
whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>
will hold the result
dest
Apply a symmetric orthographic projection transformation for a left-handed coordinate system
using OpenGL's NDC z range of [-1..+1]
to this matrix and store the result in dest
.
This method is equivalent to calling {@link #orthoLH(double, double, double, double, double, double, Matrix4d) orthoLH()} with
left=-width/2
, right=+width/2
, bottom=-height/2
and top=+height/2
.
If M
is this
matrix and O
the orthographic projection matrix,
then the new matrix will be M * O
. So when transforming a
vector v
with the new matrix by using M * O * v
, the
orthographic projection transformation will be applied first!
In order to set the matrix to a symmetric orthographic projection without post-multiplying it, use {@link #setOrthoSymmetricLH(double, double, double, double) setOrthoSymmetricLH()}.
Reference: http://www.songho.ca
the distance between the right and left frustum edges
the distance between the top and bottom frustum edges
near clipping plane distance
far clipping plane distance
will hold the result
dest
Apply a symmetric orthographic projection transformation for a left-handed coordinate system
using the given NDC z range to this matrix and store the result in dest
.
This method is equivalent to calling {@link #orthoLH(double, double, double, double, double, double, boolean, Matrix4d) orthoLH()} with
left=-width/2
, right=+width/2
, bottom=-height/2
and top=+height/2
.
If M
is this
matrix and O
the orthographic projection matrix,
then the new matrix will be M * O
. So when transforming a
vector v
with the new matrix by using M * O * v
, the
orthographic projection transformation will be applied first!
In order to set the matrix to a symmetric orthographic projection without post-multiplying it, use {@link #setOrthoSymmetricLH(double, double, double, double, boolean) setOrthoSymmetricLH()}.
Reference: http://www.songho.ca
the distance between the right and left frustum edges
the distance between the top and bottom frustum edges
near clipping plane distance
far clipping plane distance
whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>
will hold the result
dest
Apply a symmetric perspective projection frustum transformation for a right-handed coordinate system
using the given NDC z range to this matrix and store the result in dest
.
If M
is this
matrix and P
the perspective projection matrix,
then the new matrix will be M * P
. So when transforming a
vector v
with the new matrix by using M * P * v
,
the perspective projection will be applied first!
In order to set the matrix to a perspective frustum transformation without post-multiplying, use {@link #setPerspective(double, double, double, double, boolean) setPerspective}.
the vertical field of view in radians (must be greater than zero and less than {@link Math#PI PI})
the aspect ratio (i.e. width / height; must be greater than zero)
near clipping plane distance. This value must be greater than zero.
If the special value {@link Double#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity.
In that case, <code>zFar</code> may not also be {@link Double#POSITIVE_INFINITY}.
far clipping plane distance. This value must be greater than zero.
If the special value {@link Double#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity.
In that case, <code>zNear</code> may not also be {@link Double#POSITIVE_INFINITY}.
whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>
will hold the result
dest
Apply a symmetric perspective projection frustum transformation for a left-handed coordinate system
using the given NDC z range to this matrix and store the result in dest
.
If M
is this
matrix and P
the perspective projection matrix,
then the new matrix will be M * P
. So when transforming a
vector v
with the new matrix by using M * P * v
,
the perspective projection will be applied first!
In order to set the matrix to a perspective frustum transformation without post-multiplying, use {@link #setPerspectiveLH(double, double, double, double, boolean) setPerspectiveLH}.
the vertical field of view in radians (must be greater than zero and less than {@link Math#PI PI})
the aspect ratio (i.e. width / height; must be greater than zero)
near clipping plane distance. This value must be greater than zero.
If the special value {@link Double#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity.
In that case, <code>zFar</code> may not also be {@link Double#POSITIVE_INFINITY}.
far clipping plane distance. This value must be greater than zero.
If the special value {@link Double#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity.
In that case, <code>zNear</code> may not also be {@link Double#POSITIVE_INFINITY}.
whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>
will hold the result
dest
Apply an asymmetric off-center perspective projection frustum transformation for a right-handed coordinate system
using the given NDC z range to this matrix and store the result in dest
.
The given angles offAngleX
and offAngleY
are the horizontal and vertical angles between
the line of sight and the line given by the center of the near and far frustum planes. So, when offAngleY
is just fovy/2
then the projection frustum is rotated towards +Y and the bottom frustum plane
is parallel to the XZ-plane.
If M
is this
matrix and P
the perspective projection matrix,
then the new matrix will be M * P
. So when transforming a
vector v
with the new matrix by using M * P * v
,
the perspective projection will be applied first!
In order to set the matrix to a perspective frustum transformation without post-multiplying, use {@link #setPerspectiveOffCenter(double, double, double, double, double, double, boolean) setPerspectiveOffCenter}.
the vertical field of view in radians (must be greater than zero and less than {@link Math#PI PI})
the horizontal angle between the line of sight and the line crossing the center of the near and far frustum planes
the vertical angle between the line of sight and the line crossing the center of the near and far frustum planes
the aspect ratio (i.e. width / height; must be greater than zero)
near clipping plane distance. This value must be greater than zero.
If the special value {@link Double#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity.
In that case, <code>zFar</code> may not also be {@link Double#POSITIVE_INFINITY}.
far clipping plane distance. This value must be greater than zero.
If the special value {@link Double#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity.
In that case, <code>zNear</code> may not also be {@link Double#POSITIVE_INFINITY}.
whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>
will hold the result
dest
Apply a symmetric perspective projection frustum transformation for a right-handed coordinate system
using the given NDC z range to this matrix and store the result in dest
.
If M
is this
matrix and P
the perspective projection matrix,
then the new matrix will be M * P
. So when transforming a
vector v
with the new matrix by using M * P * v
,
the perspective projection will be applied first!
In order to set the matrix to a perspective frustum transformation without post-multiplying, use {@link #setPerspectiveRect(double, double, double, double, boolean) setPerspectiveRect}.
the width of the near frustum plane
the height of the near frustum plane
near clipping plane distance. This value must be greater than zero.
If the special value {@link Double#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity.
In that case, <code>zFar</code> may not also be {@link Double#POSITIVE_INFINITY}.
far clipping plane distance. This value must be greater than zero.
If the special value {@link Double#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity.
In that case, <code>zNear</code> may not also be {@link Double#POSITIVE_INFINITY}.
whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>
will hold the result
dest
Apply a mirror/reflection transformation to this matrix that reflects about the given plane specified via the plane normal and a point on the plane.
If M
is this
matrix and R
the reflection 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
reflection will be applied first!
the x-coordinate of the plane normal
the y-coordinate of the plane normal
the z-coordinate of the plane normal
the x-coordinate of a point on the plane
the y-coordinate of a point on the plane
the z-coordinate of a point on the plane
this
Apply a mirror/reflection transformation to this matrix that reflects about the given plane specified via the plane normal and a point on the plane.
If M
is this
matrix and R
the reflection 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
reflection will be applied first!
this
Apply a mirror/reflection transformation to this matrix that reflects about a plane specified via the plane orientation and a point on the plane.
This method can be used to build a reflection transformation based on the orientation of a mirror object in the scene.
It is assumed that the default mirror plane's normal is (0, 0, 1)
. So, if the given {@link Quaterniondc} is
the identity (does not apply any additional rotation), the reflection plane will be z=0
, offset by the given point
.
If M
is this
matrix and R
the reflection 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
reflection will be applied first!
the plane orientation relative to an implied normal vector of <code>(0, 0, 1)</code>
a point on the plane
this
Apply a mirror/reflection transformation to this matrix that reflects about the given plane
specified via the equation xa + yb + z*c + d = 0
.
The vector (a, b, c)
must be a unit vector.
If M
is this
matrix and R
the reflection 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
reflection will be applied first!
Reference: msdn.microsoft.com
the x factor in the plane equation
the y factor in the plane equation
the z factor in the plane equation
the constant in the plane equation
this
Set this matrix to a mirror/reflection transformation that reflects about the given plane
specified via the equation xa + yb + z*c + d = 0
.
The vector (a, b, c)
must be a unit vector.
Reference: msdn.microsoft.com
the x factor in the plane equation
the y factor in the plane equation
the z factor in the plane equation
the constant in the plane equation
this
Set this matrix to a mirror/reflection transformation that reflects about the given plane specified via the plane normal and a point on the plane.
this
Set this matrix to a mirror/reflection transformation that reflects about a plane specified via the plane orientation and a point on the plane.
This method can be used to build a reflection transformation based on the orientation of a mirror object in the scene.
It is assumed that the default mirror plane's normal is (0, 0, 1)
. So, if the given {@link Quaterniondc} is
the identity (does not apply any additional rotation), the reflection plane will be z=0
, offset by the given point
.
the plane orientation
a point on the plane
this
Set this matrix to a mirror/reflection transformation that reflects about the given plane specified via the plane normal and a point on the plane.
the x-coordinate of the plane normal
the y-coordinate of the plane normal
the z-coordinate of the plane normal
the x-coordinate of a point on the plane
the y-coordinate of a point on the plane
the z-coordinate of a point on the plane
this
Apply a rotation transformation, rotating the given radians about the specified 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 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 {@link #rotation(double, Vector3dc)}.
Reference: http://en.wikipedia.org
the angle in radians
the rotation axis (needs to be {@link Vector3d#normalize() normalized})
will hold the result
dest
Apply rotation to this matrix by rotating the given amount of radians about the given axis specified as x, y and z components.
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!
In order to set the matrix to a rotation matrix without post-multiplying the rotation transformation, use {@link #rotation(double, double, double, double) rotation()}.
the angle is in radians
the x component of the axis
the y component of the axis
the z component of the axis
this
Apply rotation to this {@link #isAffine() affine} matrix by rotating the given amount of radians
about the specified (x, y, z)
axis and store the result in dest
.
This method assumes this
to be {@link #isAffine() affine}.
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!
In order to set the matrix to a rotation matrix without post-multiplying the rotation transformation, use {@link #rotation(double, double, double, double) rotation()}.
Reference: http://en.wikipedia.org
the angle in radians
the x component of the axis
the y component of the axis
the z component of the axis
will hold the result
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.
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 assumes that this
matrix represents an {@link #isAffine() affine} transformation (i.e. its last row is equal to (0, 0, 0, 1)
)
and can be used to speed up matrix multiplication if the matrix only represents affine transformations, such as translation, rotation, scaling and shearing (in any combination).
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)
the angle to rotate about X
the angle to rotate about Y
the angle to rotate about Z
this
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.
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 assumes that this
matrix represents an {@link #isAffine() affine} transformation (i.e. its last row is equal to (0, 0, 0, 1)
)
and can be used to speed up matrix multiplication if the matrix only represents affine transformations, such as translation, rotation, scaling and shearing (in any combination).
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!
the angle to rotate about Y
the angle to rotate about X
the angle to rotate about Z
this
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.
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 assumes that this
matrix represents an {@link #isAffine() affine} transformation (i.e. its last row is equal to (0, 0, 0, 1)
)
and can be used to speed up matrix multiplication if the matrix only represents affine transformations, such as translation, rotation, scaling and shearing (in any combination).
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!
the angle to rotate about Z
the angle to rotate about Y
the angle to rotate about X
this
Apply the rotation transformation of the given {@link Quaterniondc} to this matrix while using (ox, oy, oz)
as the rotation origin.
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!
This method is equivalent to calling: translate(ox, oy, oz).rotate(quat).translate(-ox, -oy, -oz)
Reference: http://en.wikipedia.org
the {@link Quaterniondc}
the x coordinate of the rotation origin
the y coordinate of the rotation origin
the z coordinate of the rotation origin
this
Pre-multiply the rotation - and possibly scaling - transformation of the given {@link Quaterniondc} to this matrix while using (ox, oy, oz)
as the rotation origin.
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!
This method is equivalent to calling: translateLocal(-ox, -oy, -oz).rotateLocal(quat).translateLocal(ox, oy, oz)
Reference: http://en.wikipedia.org
the {@link Quaterniondc}
the x coordinate of the rotation origin
the y coordinate of the rotation origin
the z coordinate of the rotation origin
this
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
.
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 {@link #rotation(double, double, double, double) rotation()}.
Reference: http://en.wikipedia.org
the angle in radians
the x component of the axis
the y component of the axis
the z component of the axis
will hold the result
dest
Pre-multiply a rotation around the X axis to this matrix by rotating the given amount of 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 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 {@link #rotationX(double) rotationX()}.
Reference: http://en.wikipedia.org
the angle in radians to rotate about the X axis
will hold the result
dest
Pre-multiply a rotation around the Y axis to this matrix by rotating the given amount of radians
about the Y 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 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 {@link #rotationY(double) rotationY()}.
Reference: http://en.wikipedia.org
the angle in radians to rotate about the Y axis
will hold the result
dest
Pre-multiply a rotation around the Z axis to this matrix by rotating the given amount of 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 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 {@link #rotationZ(double) rotationZ()}.
Reference: http://en.wikipedia.org
the angle in radians to rotate about the Z axis
will hold the result
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
.
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 {@link #rotationTowards(Vector3dc, Vector3dc) rotationTowards()}.
This method is equivalent to calling: mulAffine(new Matrix4d().lookAt(new Vector3d(), new Vector3d(dir).negate(), up).invertAffine(), dest)
the direction to rotate towards
the up vector
will hold the result
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
.
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 {@link #rotationTowards(double, double, double, double, double, double) rotationTowards()}.
This method is equivalent to calling: mulAffine(new Matrix4d().lookAt(0, 0, 0, -dirX, -dirY, -dirZ, upX, upY, upZ).invertAffine(), dest)
the x-coordinate of the direction to rotate towards
the y-coordinate of the direction to rotate towards
the z-coordinate of the direction to rotate towards
the x-coordinate of the up vector
the y-coordinate of the up vector
the z-coordinate of the up vector
will hold the result
dest
Apply rotation about the Z axis to align the local +X
towards (dirX, dirY)
.
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!
The vector (dirX, dirY)
must be a unit vector.
the x component of the normalized direction
the y component of the normalized direction
this
Apply rotation to this matrix, which is assumed to only contain a translation, by rotating the given amount of radians
about the specified (x, y, z)
axis and store the result in dest
.
This method assumes this
to only contain a translation.
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!
In order to set the matrix to a rotation matrix without post-multiplying the rotation transformation, use {@link #rotation(double, double, double, double) rotation()}.
Reference: http://en.wikipedia.org
the angle in radians
the x component of the axis
the y component of the axis
the z component of the axis
will hold the result
dest
Apply rotation about the X axis to this matrix by rotating the given amount of radians.
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
the angle in radians
this
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.
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)
this
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.
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)
the angle to rotate about X
the angle to rotate about Y
the angle to rotate about Z
this
Apply rotation about the Y axis to this matrix by rotating the given amount of radians.
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
the angle in radians
this
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.
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)
this
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.
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)
the angle to rotate about Y
the angle to rotate about X
the angle to rotate about Z
this
Apply rotation about the Z axis to this matrix by rotating the given amount of radians.
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
the angle in radians
this
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.
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)
this
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.
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)
the angle to rotate about Z
the angle to rotate about Y
the angle to rotate about X
this
Set this matrix to a rotation transformation using the given {@link AxisAngle4}.
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 {@link #rotate(AxisAngle4) rotate()} instead.
Reference: http://en.wikipedia.org
the {@link AxisAngle4} (needs to be {@link AxisAngle4#normalize() normalized})
this
Set this matrix to the rotation - and possibly scaling - transformation of the given {@link Quaterniondc}.
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 {@link #rotate(Quaterniondc) rotate()} instead.
Reference: http://en.wikipedia.org
the {@link Quaterniondc}
this
Set this matrix to a rotation matrix which rotates the given radians about a given 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 angle in radians
the axis to rotate about
this
Set this matrix to a rotation matrix which rotates the given radians about a given 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.
From Wikipedia
the angle in radians
the x-coordinate of the axis to rotate about
the y-coordinate of the axis to rotate about
the z-coordinate of the axis to rotate about
this
Set this matrix to a transformation composed of a rotation of the specified {@link Quaterniondc} while using (ox, oy, oz)
as the rotation origin.
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: translation(ox, oy, oz).rotate(quat).translate(-ox, -oy, -oz)
Reference: http://en.wikipedia.org
the {@link Quaterniondc}
the x coordinate of the rotation origin
the y coordinate of the rotation origin
the z coordinate of the rotation origin
this
Set this matrix to a model transformation for a right-handed coordinate system,
that aligns the local -z
axis with dir
.
In order to apply the rotation transformation to a previous existing transformation, use {@link #rotateTowards(double, double, double, double, double, double) rotateTowards}.
This method is equivalent to calling: setLookAt(new Vector3d(), new Vector3d(dir).negate(), up).invertAffine()
this
Set this matrix to a model transformation for a right-handed coordinate system,
that aligns the local -z
axis with dir
.
In order to apply the rotation transformation to a previous existing transformation, use {@link #rotateTowards(double, double, double, double, double, double) rotateTowards}.
This method is equivalent to calling: setLookAt(0, 0, 0, -dirX, -dirY, -dirZ, upX, upY, upZ).invertAffine()
the x-coordinate of the direction to rotate towards
the y-coordinate of the direction to rotate towards
the z-coordinate of the direction to rotate towards
the x-coordinate of the up vector
the y-coordinate of the up vector
the z-coordinate of the up vector
this
Set this matrix to a rotation transformation about the Z axis to align the local +X
towards (dirX, dirY)
.
The vector (dirX, dirY)
must be a unit vector.
the x component of the normalized direction
the y component of the normalized direction
this
Set this matrix to a rotation transformation 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.
Reference: http://en.wikipedia.org
the angle in radians
this
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.
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)
the angle to rotate about X
the angle to rotate about Y
the angle to rotate about Z
this
Set this matrix to a rotation transformation about the Y 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.
Reference: http://en.wikipedia.org
the angle in radians
this
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.
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)
the angle to rotate about Y
the angle to rotate about X
the angle to rotate about Z
this
Set this matrix to a rotation transformation 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.
Reference: http://en.wikipedia.org
the angle in radians
this
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.
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)
the angle to rotate about Z
the angle to rotate about Y
the angle to rotate about X
this
Apply scaling to this matrix by scaling the base axes by the given xyz.x
,
xyz.y
and xyz.z
factors, respectively.
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!
this
Apply scaling to this matrix by uniformly scaling all base axes by the given 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!
the factor for all components
this
Apply scaling to this
matrix by scaling the base axes by the given x,
y and z factors.
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!
the factor of the x component
the factor of the y component
the factor of the z component
this
Apply scaling to this matrix by scaling the base axes by the given sx,
sy and sz factors while using (ox, oy, oz)
as the scaling origin.
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!
This method is equivalent to calling: translate(ox, oy, oz).scale(sx, sy, sz).translate(-ox, -oy, -oz)
the scaling factor of the x component
the scaling factor of the y component
the scaling factor of the z component
the x coordinate of the scaling origin
the y coordinate of the scaling origin
the z coordinate of the scaling origin
this
Apply scaling to this matrix by scaling all three base axes by the given factor
while using (ox, oy, oz)
as the scaling origin.
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!
This method is equivalent to calling: translate(ox, oy, oz).scale(factor).translate(-ox, -oy, -oz)
the scaling factor for all three axes
the x coordinate of the scaling origin
the y coordinate of the scaling origin
the z coordinate of the scaling origin
this
Pre-multiply scaling to this matrix by scaling the base axes by the given sx,
sy and sz factors while using (ox, oy, oz)
as the scaling origin.
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!
This method is equivalent to calling: new Matrix4d().translate(ox, oy, oz).scale(sx, sy, sz).translate(-ox, -oy, -oz).mul(this, this)
the scaling factor of the x component
the scaling factor of the y component
the scaling factor of the z component
the x coordinate of the scaling origin
the y coordinate of the scaling origin
the z coordinate of the scaling origin
this
Pre-multiply scaling to this matrix by scaling all three base axes by the given factor
while using (ox, oy, oz)
as the scaling origin.
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!
This method is equivalent to calling: new Matrix4d().translate(ox, oy, oz).scale(factor).translate(-ox, -oy, -oz).mul(this, this)
the scaling factor for all three axes
the x coordinate of the scaling origin
the y coordinate of the scaling origin
the z coordinate of the scaling origin
this
Pre-multiply scaling to this matrix by scaling the base axes by the given xyz factor.
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!
the factor of the x, y and z component
this
Pre-multiply scaling to this matrix by scaling the base axes by the given x, y and z factors.
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!
the factor of the x component
the factor of the y component
the factor of the z component
this
Apply scaling to this matrix by scaling the X axis by x
and the Y axis by y
.
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!
the factor of the x component
the factor of the y component
this
Set this matrix to be a simple scale matrix, which scales all axes uniformly by the given 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 {@link #scale(double) scale()} instead.
the scale factor in x, y and z
this
Set this matrix to be a simple scale matrix.
the scale in x
the scale in y
the scale in z
this
Set this matrix to be a simple scale matrix which scales the base axes by
xyz.x
, xyz.y
and xyz.z
, respectively.
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 {@link #scale(Vector3dc) scale()} instead.
the scale in x, y and z, respectively
this
Set this matrix to be equivalent to the rotation - and possibly scaling - specified by the given {@link Quaterniondc}.
This method is equivalent to calling: rotation(q)
Reference: http://www.euclideanspace.com/
the {@link Quaterniondc}
this
Set the values within this matrix to the supplied double values. The matrix will look like this:
m00, m10, m20, m30
m01, m11, m21, m31
m02, m12, m22, m32
m03, m13, m23, m33
the new value of m00
the new value of m01
the new value of m02
the new value of m03
the new value of m10
the new value of m11
the new value of m12
the new value of m13
the new value of m20
the new value of m21
the new value of m22
the new value of m23
the new value of m30
the new value of m31
the new value of m32
the new value of m33
this
Set the values in the matrix using a double array that contains the matrix elements in column-major order.
The results will look like this:
0, 4, 8, 12
1, 5, 9, 13
2, 6, 10, 14
3, 7, 11, 15
the array to read the matrix values from
the offset into the array
this
Set the four columns of this matrix to the supplied vectors, respectively.
the first column
the second column
the third column
the fourth column
this
Store the values of the given matrix m
into this
matrix.
the matrix to copy the values from
this
Set the matrix element at the given column and row to the specified value.
the colum index in <code>[0..3]</code>
the row index in <code>[0..3]</code>
the value
this
Store the values of the given matrix m
into this
matrix
and set the other matrix elements to identity.
the matrix to copy the values from
this
Set this matrix to represent a perspective projection equivalent to the given intrinsic camera calibration parameters.
The resulting matrix will be suited for a right-handed coordinate system using OpenGL's NDC z range of [-1..+1]
.
See: https://en.wikipedia.org/
Reference: http://ksimek.github.io/
specifies the focal length and scale along the X axis
specifies the focal length and scale along the Y axis
the skew coefficient between the X and Y axis (may be <code>0</code>)
the X coordinate of the principal point in image/sensor units
the Y coordinate of the principal point in image/sensor units
the width of the sensor/image image/sensor units
the height of the sensor/image image/sensor units
the distance to the near plane
the distance to the far plane
this
Set this matrix to be an arbitrary perspective projection frustum transformation for a right-handed coordinate system using the given NDC z range.
In order to apply the perspective frustum transformation to an existing transformation, use {@link #frustum(double, double, double, double, double, double, boolean) frustum()}.
Reference: http://www.songho.ca
the distance along the x-axis to the left frustum edge
the distance along the x-axis to the right frustum edge
the distance along the y-axis to the bottom frustum edge
the distance along the y-axis to the top frustum edge
near clipping plane distance. This value must be greater than zero.
If the special value {@link Double#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity.
In that case, <code>zFar</code> may not also be {@link Double#POSITIVE_INFINITY}.
far clipping plane distance. This value must be greater than zero.
If the special value {@link Double#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity.
In that case, <code>zNear</code> may not also be {@link Double#POSITIVE_INFINITY}.
whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>
this
Set this matrix to be an arbitrary perspective projection frustum transformation for a left-handed coordinate system
using OpenGL's NDC z range of [-1..+1]
.
In order to apply the perspective frustum transformation to an existing transformation, use {@link #frustumLH(double, double, double, double, double, double, boolean) frustumLH()}.
Reference: http://www.songho.ca
the distance along the x-axis to the left frustum edge
the distance along the x-axis to the right frustum edge
the distance along the y-axis to the bottom frustum edge
the distance along the y-axis to the top frustum edge
near clipping plane distance. This value must be greater than zero.
If the special value {@link Double#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity.
In that case, <code>zFar</code> may not also be {@link Double#POSITIVE_INFINITY}.
far clipping plane distance. This value must be greater than zero.
If the special value {@link Double#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity.
In that case, <code>zNear</code> may not also be {@link Double#POSITIVE_INFINITY}.
whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>
this
Set this matrix to a rotation transformation to make -z
point along dir
.
This is equivalent to calling
{@link #setLookAt(Vector3dc, Vector3dc, Vector3dc) setLookAt()}
with eye = (0, 0, 0)
and center = dir
.
In order to apply the lookalong transformation to any previous existing transformation, use {@link #lookAlong(Vector3dc, Vector3dc)}.
this
Set this matrix to a rotation transformation to make -z
point along dir
.
This is equivalent to calling
{@link #setLookAt(double, double, double, double, double, double, double, double, double)
setLookAt()} with eye = (0, 0, 0)
and center = dir
.
In order to apply the lookalong transformation to any previous existing transformation, use {@link #lookAlong(double, double, double, double, double, double) lookAlong()}
the x-coordinate of the direction to look along
the y-coordinate of the direction to look along
the z-coordinate of the direction to look along
the x-coordinate of the up vector
the y-coordinate of the up vector
the z-coordinate of the up vector
this
Set this matrix to be a "lookat" transformation for a right-handed coordinate system, that aligns
-z
with center - eye
.
In order to not make use of vectors to specify eye
, center
and up
but use primitives,
like in the GLU function, use {@link #setLookAt(double, double, double, double, double, double, double, double, double) setLookAt()}
instead.
In order to apply the lookat transformation to a previous existing transformation, use {@link #lookAt(Vector3dc, Vector3dc, Vector3dc) lookAt()}.
the position of the camera
the point in space to look at
the direction of 'up'
this
Set this matrix to be a "lookat" transformation for a right-handed coordinate system,
that aligns -z
with center - eye
.
In order to apply the lookat transformation to a previous existing transformation, use {@link #lookAt(double, double, double, double, double, double, double, double, double) lookAt}.
the x-coordinate of the eye/camera location
the y-coordinate of the eye/camera location
the z-coordinate of the eye/camera location
the x-coordinate of the point to look at
the y-coordinate of the point to look at
the z-coordinate of the point to look at
the x-coordinate of the up vector
the y-coordinate of the up vector
the z-coordinate of the up vector
this
Set this matrix to be a "lookat" transformation for a left-handed coordinate system, that aligns
+z
with center - eye
.
In order to not make use of vectors to specify eye
, center
and up
but use primitives,
like in the GLU function, use {@link #setLookAtLH(double, double, double, double, double, double, double, double, double) setLookAtLH()}
instead.
In order to apply the lookat transformation to a previous existing transformation, use {@link #lookAtLH(Vector3dc, Vector3dc, Vector3dc) lookAt()}.
the position of the camera
the point in space to look at
the direction of 'up'
this
Set this matrix to be a "lookat" transformation for a left-handed coordinate system,
that aligns +z
with center - eye
.
In order to apply the lookat transformation to a previous existing transformation, use {@link #lookAtLH(double, double, double, double, double, double, double, double, double) lookAtLH}.
the x-coordinate of the eye/camera location
the y-coordinate of the eye/camera location
the z-coordinate of the eye/camera location
the x-coordinate of the point to look at
the y-coordinate of the point to look at
the z-coordinate of the point to look at
the x-coordinate of the up vector
the y-coordinate of the up vector
the z-coordinate of the up vector
this
Set this matrix to be an orthographic projection transformation for a right-handed coordinate system using the given NDC z range.
In order to apply the orthographic projection to an already existing transformation, use {@link #ortho(double, double, double, double, double, double, boolean) ortho()}.
Reference: http://www.songho.ca
the distance from the center to the left frustum edge
the distance from the center to the right frustum edge
the distance from the center to the bottom frustum edge
the distance from the center to the top frustum edge
near clipping plane distance
far clipping plane distance
whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>
this
Set this matrix to be an orthographic projection transformation for a right-handed coordinate system.
This method is equivalent to calling {@link #setOrtho(double, double, double, double, double, double) setOrtho()} with
zNear=-1
and zFar=+1
.
In order to apply the orthographic projection to an already existing transformation, use {@link #ortho2D(double, double, double, double) ortho2D()}.
Reference: http://www.songho.ca
the distance from the center to the left frustum edge
the distance from the center to the right frustum edge
the distance from the center to the bottom frustum edge
the distance from the center to the top frustum edge
this
Set this matrix to be an orthographic projection transformation for a left-handed coordinate system.
This method is equivalent to calling {@link #setOrtho(double, double, double, double, double, double) setOrthoLH()} with
zNear=-1
and zFar=+1
.
In order to apply the orthographic projection to an already existing transformation, use {@link #ortho2DLH(double, double, double, double) ortho2DLH()}.
Reference: http://www.songho.ca
the distance from the center to the left frustum edge
the distance from the center to the right frustum edge
the distance from the center to the bottom frustum edge
the distance from the center to the top frustum edge
this
Set this matrix to be an orthographic projection transformation for a left-handed coordinate system using the given NDC z range.
In order to apply the orthographic projection to an already existing transformation, use {@link #orthoLH(double, double, double, double, double, double, boolean) orthoLH()}.
Reference: http://www.songho.ca
the distance from the center to the left frustum edge
the distance from the center to the right frustum edge
the distance from the center to the bottom frustum edge
the distance from the center to the top frustum edge
near clipping plane distance
far clipping plane distance
whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>
this
Set this matrix to be a symmetric orthographic projection transformation for a right-handed coordinate system using the given NDC z range.
This method is equivalent to calling {@link #setOrtho(double, double, double, double, double, double, boolean) setOrtho()} with
left=-width/2
, right=+width/2
, bottom=-height/2
and top=+height/2
.
In order to apply the symmetric orthographic projection to an already existing transformation, use {@link #orthoSymmetric(double, double, double, double, boolean) orthoSymmetric()}.
Reference: http://www.songho.ca
the distance between the right and left frustum edges
the distance between the top and bottom frustum edges
near clipping plane distance
far clipping plane distance
whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>
this
Set this matrix to be a symmetric orthographic projection transformation for a left-handed coordinate system using the given NDC z range.
This method is equivalent to calling {@link #setOrtho(double, double, double, double, double, double, boolean) setOrtho()} with
left=-width/2
, right=+width/2
, bottom=-height/2
and top=+height/2
.
In order to apply the symmetric orthographic projection to an already existing transformation, use {@link #orthoSymmetricLH(double, double, double, double, boolean) orthoSymmetricLH()}.
Reference: http://www.songho.ca
the distance between the right and left frustum edges
the distance between the top and bottom frustum edges
near clipping plane distance
far clipping plane distance
whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>
this
Set this matrix to be a symmetric perspective projection frustum transformation for a right-handed coordinate system using the given NDC z range.
In order to apply the perspective projection transformation to an existing transformation, use {@link #perspective(double, double, double, double, boolean) perspective()}.
the vertical field of view in radians (must be greater than zero and less than {@link Math#PI PI})
the aspect ratio (i.e. width / height; must be greater than zero)
near clipping plane distance. This value must be greater than zero.
If the special value {@link Double#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity.
In that case, <code>zFar</code> may not also be {@link Double#POSITIVE_INFINITY}.
far clipping plane distance. This value must be greater than zero.
If the special value {@link Double#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity.
In that case, <code>zNear</code> may not also be {@link Double#POSITIVE_INFINITY}.
whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>
this
Set this matrix to be a symmetric perspective projection frustum transformation for a left-handed coordinate system
using the given NDC z range of [-1..+1]
.
In order to apply the perspective projection transformation to an existing transformation, use {@link #perspectiveLH(double, double, double, double, boolean) perspectiveLH()}.
the vertical field of view in radians (must be greater than zero and less than {@link Math#PI PI})
the aspect ratio (i.e. width / height; must be greater than zero)
near clipping plane distance. This value must be greater than zero.
If the special value {@link Double#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity.
In that case, <code>zFar</code> may not also be {@link Double#POSITIVE_INFINITY}.
far clipping plane distance. This value must be greater than zero.
If the special value {@link Double#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity.
In that case, <code>zNear</code> may not also be {@link Double#POSITIVE_INFINITY}.
whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>
this
Set this matrix to be an asymmetric off-center perspective projection frustum transformation for a right-handed coordinate system using the given NDC z range.
The given angles offAngleX
and offAngleY
are the horizontal and vertical angles between
the line of sight and the line given by the center of the near and far frustum planes. So, when offAngleY
is just fovy/2
then the projection frustum is rotated towards +Y and the bottom frustum plane
is parallel to the XZ-plane.
In order to apply the perspective projection transformation to an existing transformation, use {@link #perspectiveOffCenter(double, double, double, double, double, double) perspectiveOffCenter()}.
the vertical field of view in radians (must be greater than zero and less than {@link Math#PI PI})
the horizontal angle between the line of sight and the line crossing the center of the near and far frustum planes
the vertical angle between the line of sight and the line crossing the center of the near and far frustum planes
the aspect ratio (i.e. width / height; must be greater than zero)
near clipping plane distance. This value must be greater than zero.
If the special value {@link Double#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity.
In that case, <code>zFar</code> may not also be {@link Double#POSITIVE_INFINITY}.
far clipping plane distance. This value must be greater than zero.
If the special value {@link Double#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity.
In that case, <code>zNear</code> may not also be {@link Double#POSITIVE_INFINITY}.
whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>
this
Set this matrix to be a symmetric perspective projection frustum transformation for a right-handed coordinate system using the given NDC z range.
In order to apply the perspective projection transformation to an existing transformation, use {@link #perspectiveRect(double, double, double, double, boolean) perspectiveRect()}.
the width of the near frustum plane
the height of the near frustum plane
near clipping plane distance. This value must be greater than zero.
If the special value {@link Double#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity.
In that case, <code>zFar</code> may not also be {@link Double#POSITIVE_INFINITY}.
far clipping plane distance. This value must be greater than zero.
If the special value {@link Double#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity.
In that case, <code>zNear</code> may not also be {@link Double#POSITIVE_INFINITY}.
whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>
this
Set only the upper left 3x3 submatrix of 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.
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 angle to rotate about X
the angle to rotate about Y
the angle to rotate about Z
this
Set only the upper left 3x3 submatrix of 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.
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 angle to rotate about Y
the angle to rotate about X
the angle to rotate about Z
this
Set only the upper left 3x3 submatrix of 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.
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 angle to rotate about Z
the angle to rotate about Y
the angle to rotate about X
this
Set the matrix element at the given row and column to the specified value.
the row index in <code>[0..3]</code>
the colum index in <code>[0..3]</code>
the value
this
Set only the translation components (m30, m31, m32)
of this matrix to the given values (x, y, z)
.
To build a translation matrix instead, use {@link #translation(double, double, double)}. To apply a translation, use {@link #translate(double, double, double)}.
the units to translate in x
the units to translate in y
the units to translate in z
this
Set only the translation components (m30, m31, m32)
of this matrix to the given values (xyz.x, xyz.y, xyz.z)
.
To build a translation matrix instead, use {@link #translation(Vector3dc)}. To apply a translation, use {@link #translate(Vector3dc)}.
the units to translate in <code>(x, y, z)</code>
this
Apply a projection transformation to this matrix that projects onto the plane specified via the general plane equation
xa + yb + z*c + d = 0
as if casting a shadow from a given light position/direction (lightX, lightY, lightZ, lightW)
.
If lightW
is 0.0
the light is being treated as a directional light; if it is 1.0
it is a point light.
If M
is this
matrix and S
the shadow 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
shadow projection will be applied first!
Reference: ftp.sgi.com
the x-component of the light's vector
the y-component of the light's vector
the z-component of the light's vector
the w-component of the light's vector
the x factor in the plane equation
the y factor in the plane equation
the z factor in the plane equation
the constant in the plane equation
this
This method is equivalent to calling: translate(w-1-2x, h-1-2y, 0).scale(w, h, 1)
If M
is this
matrix and T
the created transformation matrix,
then the new matrix will be M * T
. So when transforming a
vector v
with the new matrix by using M * T * v
, the
created transformation will be applied first!
the tile's x coordinate/index (should be in <code>[0..w)</code>)
the tile's y coordinate/index (should be in <code>[0..h)</code>)
the number of tiles along the x axis
the number of tiles along the y axis
this
Return a string representation of this matrix by formatting the matrix elements with the given {@link NumberFormat}.
the {@link NumberFormat} used to format the matrix values with
the string representation
Apply a translation to this matrix by translating by the given number of
units in x, y and z and store the result in dest
.
If M
is this
matrix and T
the translation
matrix, then the new matrix will be M * T
. So when
transforming a vector v
with the new matrix by using
M * T * v
, the translation will be applied first!
In order to set the matrix to a translation transformation without post-multiplying it, use {@link #translation(Vector3)}.
the number of units in x, y and z by which to translate
will hold the result
dest
Apply a translation to this matrix by translating by the given number of
units in x, y and z and store the result in dest
.
If M
is this
matrix and T
the translation
matrix, then the new matrix will be M * T
. So when
transforming a vector v
with the new matrix by using
M * T * v
, the translation will be applied first!
In order to set the matrix to a translation transformation without post-multiplying it, use {@link #translation(double, double, double)}.
the offset to translate in x
the offset to translate in y
the offset to translate in z
will hold the result
dest
Pre-multiply a translation to this matrix by translating by the given number of
units in x, y and z and store the result in dest
.
If M
is this
matrix and T
the translation
matrix, then the new matrix will be T * M
. So when
transforming a vector v
with the new matrix by using
T * M * v
, the translation will be applied last!
In order to set the matrix to a translation transformation without pre-multiplying it, use {@link #translation(Vector3dc)}.
the number of units in x, y and z by which to translate
will hold the result
dest
Pre-multiply a translation to this matrix by translating by the given number of
units in x, y and z and store the result in dest
.
If M
is this
matrix and T
the translation
matrix, then the new matrix will be T * M
. So when
transforming a vector v
with the new matrix by using
T * M * v
, the translation will be applied last!
In order to set the matrix to a translation transformation without pre-multiplying it, use {@link #translation(double, double, double)}.
the offset to translate in x
the offset to translate in y
the offset to translate in z
will hold the result
dest
Set this matrix to be a simple translation matrix.
The resulting matrix can be multiplied against another transformation matrix to obtain an additional translation.
the offset to translate in x
the offset to translate in y
the offset to translate in z
this
Set this matrix to be a simple translation matrix.
The resulting matrix can be multiplied against another transformation matrix to obtain an additional translation.
the offsets in x, y and z to translate
this
Set this
matrix to T * R
, where T
is a translation by the given (tx, ty, tz)
and
R
is a rotation - and possibly scaling - transformation specified by the quaternion (qx, qy, qz, qw)
.
When transforming a vector by the resulting matrix the rotation - and possibly scaling - transformation will be applied first and then the translation.
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: translation(tx, ty, tz).rotate(quat)
the number of units by which to translate the x-component
the number of units by which to translate the y-component
the number of units by which to translate the z-component
the x-coordinate of the vector part of the quaternion
the y-coordinate of the vector part of the quaternion
the z-coordinate of the vector part of the quaternion
the scalar part of the quaternion
this
Set this
matrix to T * R
, where T
is a translation by the given (tx, ty, tz)
and
R
is a rotation - and possibly scaling - transformation specified by the given quaternion.
When transforming a vector by the resulting matrix the rotation - and possibly scaling - transformation will be applied first and then the translation.
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: translation(tx, ty, tz).rotate(quat)
the number of units by which to translate the x-component
the number of units by which to translate the y-component
the number of units by which to translate the z-component
the quaternion representing a rotation
this
Set this
matrix to T * R * S
, where T
is a translation by the given (tx, ty, tz)
,
R
is a rotation transformation specified by the quaternion (qx, qy, qz, qw)
, and S
is a scaling transformation
which scales the three axes x, y and z by (sx, sy, sz)
.
When transforming a vector by the resulting matrix the scaling transformation will be applied first, then the rotation and at last the translation.
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: translation(tx, ty, tz).rotate(quat).scale(sx, sy, sz)
the number of units by which to translate the x-component
the number of units by which to translate the y-component
the number of units by which to translate the z-component
the x-coordinate of the vector part of the quaternion
the y-coordinate of the vector part of the quaternion
the z-coordinate of the vector part of the quaternion
the scalar part of the quaternion
the scaling factor for the x-axis
the scaling factor for the y-axis
the scaling factor for the z-axis
this
Set this
matrix to T * R * S
, where T
is the given translation
,
R
is a rotation transformation specified by the given quaternion, and S
is a scaling transformation
which scales the axes by scale
.
When transforming a vector by the resulting matrix the scaling transformation will be applied first, then the rotation and at last the translation.
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: translation(translation).rotate(quat).scale(scale)
the translation
the quaternion representing a rotation
the scaling factors
this
Set this
matrix to T * R * S
, where T
is a translation by the given (tx, ty, tz)
,
R
is a rotation transformation specified by the quaternion (qx, qy, qz, qw)
, and S
is a scaling transformation
which scales all three axes by scale
.
When transforming a vector by the resulting matrix the scaling transformation will be applied first, then the rotation and at last the translation.
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: translation(tx, ty, tz).rotate(quat).scale(scale)
the number of units by which to translate the x-component
the number of units by which to translate the y-component
the number of units by which to translate the z-component
the x-coordinate of the vector part of the quaternion
the y-coordinate of the vector part of the quaternion
the z-coordinate of the vector part of the quaternion
the scalar part of the quaternion
the scaling factor for all three axes
this
Set this
matrix to T * R * S
, where T
is the given translation
,
R
is a rotation transformation specified by the given quaternion, and S
is a scaling transformation
which scales all three axes by scale
.
When transforming a vector by the resulting matrix the scaling transformation will be applied first, then the rotation and at last the translation.
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: translation(translation).rotate(quat).scale(scale)
the translation
the quaternion representing a rotation
the scaling factors
this
Set this
matrix to (T * R * S)-1
, where T
is a translation by the given (tx, ty, tz)
,
R
is a rotation transformation specified by the quaternion (qx, qy, qz, qw)
, and S
is a scaling transformation
which scales the three axes x, y and z by (sx, sy, sz)
.
This method is equivalent to calling: translationRotateScale(...).invert()
the number of units by which to translate the x-component
the number of units by which to translate the y-component
the number of units by which to translate the z-component
the x-coordinate of the vector part of the quaternion
the y-coordinate of the vector part of the quaternion
the z-coordinate of the vector part of the quaternion
the scalar part of the quaternion
the scaling factor for the x-axis
the scaling factor for the y-axis
the scaling factor for the z-axis
this
Set this
matrix to (T * R * S)-1
, where T
is the given translation
,
R
is a rotation transformation specified by the given quaternion, and S
is a scaling transformation
which scales the axes by scale
.
This method is equivalent to calling: translationRotateScale(...).invert()
the translation
the quaternion representing a rotation
the scaling factors
this
Set this
matrix to (T * R * S)-1
, where T
is the given translation
,
R
is a rotation transformation specified by the given quaternion, and S
is a scaling transformation
which scales all three axes by scale
.
This method is equivalent to calling: translationRotateScale(...).invert()
the translation
the quaternion representing a rotation
the scaling factors
this
Set this
matrix to T * R * S * M
, where T
is the given translation
,
R
is a rotation - and possibly scaling - transformation specified by the given quaternion, S
is a scaling transformation
which scales the axes by scale
and M
is an {@link #isAffine() affine} matrix.
When transforming a vector by the resulting matrix the transformation described by M
will be applied first, then the scaling, then rotation and
at last the translation.
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: translation(translation).rotate(quat).scale(scale).mulAffine(m)
the translation
the quaternion representing a rotation
the scaling factors
the {@link #isAffine() affine} matrix to multiply by
this
Set this
matrix to T * R * S * M
, where T
is a translation by the given (tx, ty, tz)
,
R
is a rotation - and possibly scaling - transformation specified by the quaternion (qx, qy, qz, qw)
, S
is a scaling transformation
which scales the three axes x, y and z by (sx, sy, sz)
and M
is an {@link #isAffine() affine} matrix.
When transforming a vector by the resulting matrix the transformation described by M
will be applied first, then the scaling, then rotation and
at last the translation.
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: translation(tx, ty, tz).rotate(quat).scale(sx, sy, sz).mulAffine(m)
the number of units by which to translate the x-component
the number of units by which to translate the y-component
the number of units by which to translate the z-component
the x-coordinate of the vector part of the quaternion
the y-coordinate of the vector part of the quaternion
the z-coordinate of the vector part of the quaternion
the scalar part of the quaternion
the scaling factor for the x-axis
the scaling factor for the y-axis
the scaling factor for the z-axis
the {@link #isAffine() affine} matrix to multiply by
this
Set this matrix to a model transformation for a right-handed coordinate system,
that translates to the given pos
and aligns the local -z
axis with dir
.
This method is equivalent to calling: translation(pos).rotateTowards(dir, up)
the position to translate to
the direction to rotate towards
the up vector
this
Set this matrix to a model transformation for a right-handed coordinate system,
that translates to the given (posX, posY, posZ)
and aligns the local -z
axis with (dirX, dirY, dirZ)
.
This method is equivalent to calling: translation(posX, posY, posZ).rotateTowards(dirX, dirY, dirZ, upX, upY, upZ)
the x-coordinate of the position to translate to
the y-coordinate of the position to translate to
the z-coordinate of the position to translate to
the x-coordinate of the direction to rotate towards
the y-coordinate of the direction to rotate towards
the z-coordinate of the direction to rotate towards
the x-coordinate of the up vector
the y-coordinate of the up vector
the z-coordinate of the up vector
this
Set this
matrix to a perspective transformation that maps the trapezoid spanned by the four corner coordinates
(p0x, p0y)
, (p1x, p1y)
, (p2x, p2y)
and (p3x, p3y)
to the unit square [(-1, -1)..(+1, +1)]
.
The corner coordinates are given in counter-clockwise order starting from the left corner on the smaller parallel side of the trapezoid seen when looking at the trapezoid oriented with its shorter parallel edge at the bottom and its longer parallel edge at the top.
Reference: Trapezoidal Shadow Maps (TSM) - Recipe
the x coordinate of the left corner at the shorter edge of the trapezoid
the y coordinate of the left corner at the shorter edge of the trapezoid
the x coordinate of the right corner at the shorter edge of the trapezoid
the y coordinate of the right corner at the shorter edge of the trapezoid
the x coordinate of the right corner at the longer edge of the trapezoid
the y coordinate of the right corner at the longer edge of the trapezoid
the x coordinate of the left corner at the longer edge of the trapezoid
the y coordinate of the left corner at the longer edge of the trapezoid
this
Apply a transformation to this matrix to ensure that the local Y axis (as obtained by {@link #positiveY(Vector3d)})
will be coplanar to the plane spanned by the local Z axis (as obtained by {@link #positiveZ(Vector3d)}) and the
given vector up
.
This effectively ensures that the resulting matrix will be equal to the one obtained from
{@link #setLookAt(Vector3dc, Vector3dc, Vector3dc)} called with the current
local origin of this matrix (as obtained by {@link #originAffine(Vector3d)}), the sum of this position and the
negated local Z axis as well as the given vector up
.
This method must only be called on {@link #isAffine()} matrices.
this
Apply a transformation to this matrix to ensure that the local Y axis (as obtained by {@link #positiveY(Vector3d)})
will be coplanar to the plane spanned by the local Z axis (as obtained by {@link #positiveZ(Vector3d)}) and the
given vector (upX, upY, upZ)
.
This effectively ensures that the resulting matrix will be equal to the one obtained from
{@link #setLookAt(double, double, double, double, double, double, double, double, double)} called with the current
local origin of this matrix (as obtained by {@link #originAffine(Vector3d)}), the sum of this position and the
negated local Z axis as well as the given vector (upX, upY, upZ)
.
This method must only be called on {@link #isAffine()} matrices.
the x coordinate of the up vector
the y coordinate of the up vector
the z coordinate of the up vector
dest
Set all the values within this matrix to 0.
this
Create a view and projection matrix from a given eye
position, a given bottom left corner position p
of the near plane rectangle
and the extents of the near plane rectangle along its local x
and y
axes, and store the resulting matrices
in projDest
and viewDest
.
This method creates a view and perspective projection matrix assuming that there is a pinhole camera at position eye
projecting the scene onto the near plane defined by the rectangle.
All positions and lengths are in the same (world) unit.
the position of the camera
the bottom left corner of the near plane rectangle (will map to the bottom left corner in window coordinates)
the direction and length of the local "bottom/top" X axis/side of the near plane rectangle
the direction and length of the local "left/right" Y axis/side of the near plane rectangle
the distance between the far and near plane (the near plane will be calculated by this method).
If the special value {@link Double#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity.
If the special value {@link Double#NEGATIVE_INFINITY} is used, the near and far planes will be swapped and
the near clipping plane will be at positive infinity.
If a negative value is used (except for {@link Double#NEGATIVE_INFINITY}) the near and far planes will be swapped
whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code>
or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code>
will hold the resulting projection matrix
will hold the resulting view matrix
Generated using TypeDoc
Contains the definition of a 4x4 Matrix of doubles, and associated functions to transform it. The matrix is column-major to match OpenGL's interpretation, and it looks like this:
m00 m10 m20 m30
m01 m11 m21 m31
m02 m12 m22 m32
m03 m13 m23 m33
Richard Greenlees
Kai Burjack