Class Matrix3d
- java.lang.Object
-
- org.joml.Matrix3d
-
- All Implemented Interfaces:
Externalizable,Serializable,Matrix3dc
- Direct Known Subclasses:
Matrix3dStack
public class Matrix3d extends Object implements Externalizable, Matrix3dc
Contains the definition of a 3x3 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
m01 m11 m21
m02 m12 m22- Author:
- Richard Greenlees, Kai Burjack
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Matrix3d()Matrix3d(double m00, double m01, double m02, double m10, double m11, double m12, double m20, double m21, double m22)Create a newMatrix3dand initialize its elements with the given values.Matrix3d(DoubleBuffer buffer)Create a newMatrix3dby reading its 9 double components from the givenDoubleBufferat the buffer's current position.Matrix3d(Matrix2dc mat)Matrix3d(Matrix2fc mat)Matrix3d(Matrix3dc mat)Create a newMatrix3dand initialize it with the values from the given matrix.Matrix3d(Matrix3fc mat)Create a newMatrix3dand initialize it with the values from the given matrix.Matrix3d(Matrix4dc mat)Matrix3d(Matrix4fc mat)Matrix3d(Vector3dc col0, Vector3dc col1, Vector3dc col2)Create a newMatrix3dand initialize its three columns using the supplied vectors.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Matrix3dadd(Matrix3dc other)Component-wise addthisandother.Matrix3dadd(Matrix3dc other, Matrix3d dest)Component-wise addthisandotherand store the result indest.Matrix3dcofactor()Compute the cofactor matrix ofthis.Matrix3dcofactor(Matrix3d dest)Compute the cofactor matrix ofthisand store it intodest.doubledeterminant()Return the determinant of this matrix.booleanequals(Object obj)booleanequals(Matrix3dc m, double delta)Compare the matrix elements ofthismatrix with the given matrix using the givendeltaand return whether all of them are equal within a maximum difference ofdelta.double[]get(double[] arr)Store this matrix into the supplied double array in column-major order.double[]get(double[] arr, int offset)Store this matrix into the supplied double array in column-major order at the given offset.float[]get(float[] arr)Store the elements of this matrix as float values in column-major order into the supplied float array.float[]get(float[] arr, int offset)Store the elements of this matrix as float values in column-major order into the supplied float array at the given offset.doubleget(int column, int row)Get the matrix element value at the given column and row.ByteBufferget(int index, ByteBuffer buffer)Store this matrix in column-major order into the suppliedByteBufferstarting at the specified absolute buffer position/index.DoubleBufferget(int index, DoubleBuffer buffer)Store this matrix into the suppliedDoubleBufferstarting at the specified absolute buffer position/index using column-major order.FloatBufferget(int index, FloatBuffer buffer)Store this matrix in column-major order into the suppliedFloatBufferstarting at the specified absolute buffer position/index.ByteBufferget(ByteBuffer buffer)Store this matrix in column-major order into the suppliedByteBufferat the current bufferposition.DoubleBufferget(DoubleBuffer buffer)Store this matrix into the suppliedDoubleBufferat the current bufferpositionusing column-major order.FloatBufferget(FloatBuffer buffer)Store this matrix in column-major order into the suppliedFloatBufferat the current bufferposition.Matrix3dget(Matrix3d dest)Get the current values ofthismatrix and store them intodest.Vector3dgetColumn(int column, Vector3d dest)Get the column at the givencolumnindex, starting with0.Vector3dgetEulerAnglesZYX(Vector3d dest)Extract the Euler angles from the rotation represented bythismatrix and store the extracted Euler angles indest.ByteBuffergetFloats(int index, ByteBuffer buffer)Store the elements of this matrix as float values in column-major order into the suppliedByteBufferstarting at the specified absolute buffer position/index.ByteBuffergetFloats(ByteBuffer buffer)Store the elements of this matrix as float values in column-major order into the suppliedByteBufferat the current bufferposition.QuaterniondgetNormalizedRotation(Quaterniond dest)Get the current values ofthismatrix and store the represented rotation into the givenQuaterniond.QuaternionfgetNormalizedRotation(Quaternionf dest)Get the current values ofthismatrix and store the represented rotation into the givenQuaternionf.AxisAngle4fgetRotation(AxisAngle4f dest)Get the current values ofthismatrix and store the represented rotation into the givenAxisAngle4f.Vector3dgetRow(int row, Vector3d dest)Get the row at the givenrowindex, starting with0.doublegetRowColumn(int row, int column)Get the matrix element value at the given row and column.Vector3dgetScale(Vector3d dest)Get the scaling factors ofthismatrix for the three base axes.QuaterniondgetUnnormalizedRotation(Quaterniond dest)Get the current values ofthismatrix and store the represented rotation into the givenQuaterniond.QuaternionfgetUnnormalizedRotation(Quaternionf dest)Get the current values ofthismatrix and store the represented rotation into the givenQuaternionf.inthashCode()Matrix3didentity()Set this matrix to the identity.Matrix3dinvert()Invert this matrix.Matrix3dinvert(Matrix3d dest)Invertthismatrix and store the result indest.booleanisFinite()Matrix3dlerp(Matrix3dc other, double t)Linearly interpolatethisandotherusing the given interpolation factortand store the result inthis.Matrix3dlerp(Matrix3dc other, double t, Matrix3d dest)Linearly interpolatethisandotherusing the given interpolation factortand store the result indest.Matrix3dlookAlong(double dirX, double dirY, double dirZ, double upX, double upY, double upZ)Apply a rotation transformation to this matrix to make-zpoint alongdir.Matrix3dlookAlong(double dirX, double dirY, double dirZ, double upX, double upY, double upZ, Matrix3d dest)Apply a rotation transformation to this matrix to make-zpoint alongdirand store the result indest.Matrix3dlookAlong(Vector3dc dir, Vector3dc up)Apply a rotation transformation to this matrix to make-zpoint alongdir.Matrix3dlookAlong(Vector3dc dir, Vector3dc up, Matrix3d dest)Apply a rotation transformation to this matrix to make-zpoint alongdirand store the result indest.doublem00()Return the value of the matrix element at column 0 and row 0.Matrix3dm00(double m00)Set the value of the matrix element at column 0 and row 0.doublem01()Return the value of the matrix element at column 0 and row 1.Matrix3dm01(double m01)Set the value of the matrix element at column 0 and row 1.doublem02()Return the value of the matrix element at column 0 and row 2.Matrix3dm02(double m02)Set the value of the matrix element at column 0 and row 2.doublem10()Return the value of the matrix element at column 1 and row 0.Matrix3dm10(double m10)Set the value of the matrix element at column 1 and row 0.doublem11()Return the value of the matrix element at column 1 and row 1.Matrix3dm11(double m11)Set the value of the matrix element at column 1 and row 1.doublem12()Return the value of the matrix element at column 1 and row 2.Matrix3dm12(double m12)Set the value of the matrix element at column 1 and row 2.doublem20()Return the value of the matrix element at column 2 and row 0.Matrix3dm20(double m20)Set the value of the matrix element at column 2 and row 0.doublem21()Return the value of the matrix element at column 2 and row 1.Matrix3dm21(double m21)Set the value of the matrix element at column 2 and row 1.doublem22()Return the value of the matrix element at column 2 and row 2.Matrix3dm22(double m22)Set the value of the matrix element at column 2 and row 2.Matrix3dmul(Matrix3dc right)Multiply this matrix by the supplied matrix.Matrix3dmul(Matrix3dc right, Matrix3d dest)Multiply this matrix by the supplied matrix and store the result indest.Matrix3dmul(Matrix3fc right)Multiply this matrix by the supplied matrix.Matrix3dmul(Matrix3fc right, Matrix3d dest)Multiply this matrix by the supplied matrix and store the result indest.Matrix3dmulComponentWise(Matrix3dc other)Component-wise multiplythisbyother.Matrix3dmulComponentWise(Matrix3dc other, Matrix3d dest)Component-wise multiplythisbyotherand store the result indest.Matrix3dmulLocal(Matrix3dc left)Pre-multiply this matrix by the suppliedleftmatrix and store the result inthis.Matrix3dmulLocal(Matrix3dc left, Matrix3d dest)Pre-multiply this matrix by the suppliedleftmatrix and store the result indest.Matrix3dnormal()Setthismatrix to its own normal matrix.Matrix3dnormal(Matrix3d dest)Compute a normal matrix fromthismatrix and store it intodest.Vector3dnormalizedPositiveX(Vector3d dir)Obtain the direction of+Xbefore the transformation represented bythisorthogonal matrix is applied.Vector3dnormalizedPositiveY(Vector3d dir)Obtain the direction of+Ybefore the transformation represented bythisorthogonal matrix is applied.Vector3dnormalizedPositiveZ(Vector3d dir)Obtain the direction of+Zbefore the transformation represented bythisorthogonal matrix is applied.Matrix3dobliqueZ(double a, double b)Apply an oblique projection transformation to this matrix with the given values foraandb.Matrix3dobliqueZ(double a, double b, Matrix3d dest)Apply an oblique projection transformation to this matrix with the given values foraandband store the result indest.Vector3dpositiveX(Vector3d dir)Obtain the direction of+Xbefore the transformation represented bythismatrix is applied.Vector3dpositiveY(Vector3d dir)Obtain the direction of+Ybefore the transformation represented bythismatrix is applied.Vector3dpositiveZ(Vector3d dir)Obtain the direction of+Zbefore the transformation represented bythismatrix is applied.doublequadraticFormProduct(double x, double y, double z)Compute(x, y, z)^T * this * (x, y, z).doublequadraticFormProduct(Vector3dc v)Computev^T * this * v.doublequadraticFormProduct(Vector3fc v)Computev^T * this * v.voidreadExternal(ObjectInput in)Matrix3dreflect(double nx, double ny, double nz)Apply a mirror/reflection transformation to this matrix that reflects through the given plane specified via the plane normal.Matrix3dreflect(double nx, double ny, double nz, Matrix3d dest)Apply a mirror/reflection transformation to this matrix that reflects through the given plane specified via the plane normal(nx, ny, nz), and store the result indest.Matrix3dreflect(Quaterniondc orientation)Apply a mirror/reflection transformation to this matrix that reflects about a plane specified via the plane orientation.Matrix3dreflect(Quaterniondc orientation, Matrix3d dest)Apply a mirror/reflection transformation to this matrix that reflects through a plane specified via the plane orientation, and store the result indest.Matrix3dreflect(Vector3dc normal)Apply a mirror/reflection transformation to this matrix that reflects through the given plane specified via the plane normal.Matrix3dreflect(Vector3dc normal, Matrix3d dest)Apply a mirror/reflection transformation to this matrix that reflects through the given plane specified via the plane normal, and store the result indest.Matrix3dreflection(double nx, double ny, double nz)Set this matrix to a mirror/reflection transformation that reflects through the given plane specified via the plane normal.Matrix3dreflection(Quaterniondc orientation)Set this matrix to a mirror/reflection transformation that reflects through a plane specified via the plane orientation.Matrix3dreflection(Vector3dc normal)Set this matrix to a mirror/reflection transformation that reflects through the given plane specified via the plane normal.Matrix3drotate(double ang, double x, double y, double z)Apply rotation to this matrix by rotating the given amount of radians about the given axis specified as x, y and z components.Matrix3drotate(double ang, double x, double y, double z, Matrix3d dest)Apply rotation to this matrix by rotating the given amount of radians about the given axis specified as x, y and z components, and store the result indest.Matrix3drotate(double angle, Vector3dc axis)Apply a rotation transformation, rotating the given radians about the specified axis, to this matrix.Matrix3drotate(double angle, Vector3dc axis, Matrix3d dest)Apply a rotation transformation, rotating the given radians about the specified axis and store the result indest.Matrix3drotate(double angle, Vector3fc axis)Apply a rotation transformation, rotating the given radians about the specified axis, to this matrix.Matrix3drotate(double angle, Vector3fc axis, Matrix3d dest)Apply a rotation transformation, rotating the given radians about the specified axis and store the result indest.Matrix3drotate(AxisAngle4d axisAngle)Apply a rotation transformation, rotating about the givenAxisAngle4d, to this matrix.Matrix3drotate(AxisAngle4d axisAngle, Matrix3d dest)Apply a rotation transformation, rotating about the givenAxisAngle4dand store the result indest.Matrix3drotate(AxisAngle4f axisAngle)Apply a rotation transformation, rotating about the givenAxisAngle4f, to this matrix.Matrix3drotate(AxisAngle4f axisAngle, Matrix3d dest)Apply a rotation transformation, rotating about the givenAxisAngle4fand store the result indest.Matrix3drotate(Quaterniondc quat)Apply the rotation - and possibly scaling - transformation of the givenQuaterniondcto this matrix.Matrix3drotate(Quaterniondc quat, Matrix3d dest)Apply the rotation - and possibly scaling - transformation of the givenQuaterniondcto this matrix and store the result indest.Matrix3drotate(Quaternionfc quat)Apply the rotation - and possibly scaling - transformation of the givenQuaternionfcto this matrix.Matrix3drotate(Quaternionfc quat, Matrix3d dest)Apply the rotation - and possibly scaling - transformation of the givenQuaternionfcto this matrix and store the result indest.Matrix3drotateLocal(double ang, double x, double y, double z)Pre-multiply a rotation to this matrix by rotating the given amount of radians about the specified(x, y, z)axis.Matrix3drotateLocal(double ang, double x, double y, double z, Matrix3d dest)Pre-multiply a rotation to this matrix by rotating the given amount of radians about the specified(x, y, z)axis and store the result indest.Matrix3drotateLocal(Quaterniondc quat)Pre-multiply the rotation - and possibly scaling - transformation of the givenQuaterniondcto this matrix.Matrix3drotateLocal(Quaterniondc quat, Matrix3d dest)Pre-multiply the rotation - and possibly scaling - transformation of the givenQuaterniondcto this matrix and store the result indest.Matrix3drotateLocal(Quaternionfc quat)Pre-multiply the rotation - and possibly scaling - transformation of the givenQuaternionfcto this matrix.Matrix3drotateLocal(Quaternionfc quat, Matrix3d dest)Pre-multiply the rotation - and possibly scaling - transformation of the givenQuaternionfcto this matrix and store the result indest.Matrix3drotateLocalX(double ang)Pre-multiply a rotation to this matrix by rotating the given amount of radians about the X axis.Matrix3drotateLocalX(double ang, Matrix3d 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 indest.Matrix3drotateLocalY(double ang)Pre-multiply a rotation to this matrix by rotating the given amount of radians about the Y axis.Matrix3drotateLocalY(double ang, Matrix3d 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 indest.Matrix3drotateLocalZ(double ang)Pre-multiply a rotation to this matrix by rotating the given amount of radians about the Z axis.Matrix3drotateLocalZ(double ang, Matrix3d 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 indest.Matrix3drotateTowards(double dirX, double dirY, double dirZ, double upX, double upY, double upZ)Apply a model transformation to this matrix for a right-handed coordinate system, that aligns the local+Zaxis withdirection.Matrix3drotateTowards(double dirX, double dirY, double dirZ, double upX, double upY, double upZ, Matrix3d dest)Apply a model transformation to this matrix for a right-handed coordinate system, that aligns the local+Zaxis withdirand store the result indest.Matrix3drotateTowards(Vector3dc direction, Vector3dc up)Apply a model transformation to this matrix for a right-handed coordinate system, that aligns the local+Zaxis withdirection.Matrix3drotateTowards(Vector3dc direction, Vector3dc up, Matrix3d dest)Apply a model transformation to this matrix for a right-handed coordinate system, that aligns the local+Zaxis withdirectionand store the result indest.Matrix3drotateX(double ang)Apply rotation about the X axis to this matrix by rotating the given amount of radians.Matrix3drotateX(double ang, Matrix3d dest)Apply rotation about the X axis to this matrix by rotating the given amount of radians and store the result indest.Matrix3drotateXYZ(double angleX, double angleY, double angleZ)Apply rotation ofangleXradians about the X axis, followed by a rotation ofangleYradians about the Y axis and followed by a rotation ofangleZradians about the Z axis.Matrix3drotateXYZ(double angleX, double angleY, double angleZ, Matrix3d dest)Apply rotation ofangleXradians about the X axis, followed by a rotation ofangleYradians about the Y axis and followed by a rotation ofangleZradians about the Z axis and store the result indest.Matrix3drotateY(double ang)Apply rotation about the Y axis to this matrix by rotating the given amount of radians.Matrix3drotateY(double ang, Matrix3d dest)Apply rotation about the Y axis to this matrix by rotating the given amount of radians and store the result indest.Matrix3drotateYXZ(double angleY, double angleX, double angleZ)Apply rotation ofangleYradians about the Y axis, followed by a rotation ofangleXradians about the X axis and followed by a rotation ofangleZradians about the Z axis.Matrix3drotateYXZ(double angleY, double angleX, double angleZ, Matrix3d dest)Apply rotation ofangleYradians about the Y axis, followed by a rotation ofangleXradians about the X axis and followed by a rotation ofangleZradians about the Z axis and store the result indest.Matrix3drotateYXZ(Vector3d angles)Apply rotation ofangles.yradians about the Y axis, followed by a rotation ofangles.xradians about the X axis and followed by a rotation ofangles.zradians about the Z axis.Matrix3drotateZ(double ang)Apply rotation about the Z axis to this matrix by rotating the given amount of radians.Matrix3drotateZ(double ang, Matrix3d dest)Apply rotation about the Z axis to this matrix by rotating the given amount of radians and store the result indest.Matrix3drotateZYX(double angleZ, double angleY, double angleX)Apply rotation ofangleZradians about the Z axis, followed by a rotation ofangleYradians about the Y axis and followed by a rotation ofangleXradians about the X axis.Matrix3drotateZYX(double angleZ, double angleY, double angleX, Matrix3d dest)Apply rotation ofangleZradians about the Z axis, followed by a rotation ofangleYradians about the Y axis and followed by a rotation ofangleXradians about the X axis and store the result indest.Matrix3drotation(double angle, double x, double y, double z)Set this matrix to a rotation matrix which rotates the given radians about a given axis.Matrix3drotation(double angle, Vector3dc axis)Set this matrix to a rotation matrix which rotates the given radians about a given axis.Matrix3drotation(double angle, Vector3fc axis)Set this matrix to a rotation matrix which rotates the given radians about a given axis.Matrix3drotation(AxisAngle4d axisAngle)Set this matrix to a rotation transformation using the givenAxisAngle4d.Matrix3drotation(AxisAngle4f axisAngle)Set this matrix to a rotation transformation using the givenAxisAngle4f.Matrix3drotation(Quaterniondc quat)Set this matrix to the rotation - and possibly scaling - transformation of the givenQuaterniondc.Matrix3drotation(Quaternionfc quat)Set this matrix to the rotation - and possibly scaling - transformation of the givenQuaternionfc.Matrix3drotationTowards(double dirX, double dirY, double dirZ, double upX, double upY, double upZ)Set this matrix to a model transformation for a right-handed coordinate system, that aligns the local-zaxis withcenter - eye.Matrix3drotationTowards(Vector3dc dir, Vector3dc up)Set this matrix to a model transformation for a right-handed coordinate system, that aligns the local-zaxis withcenter - eye.Matrix3drotationX(double ang)Set this matrix to a rotation transformation about the X axis.Matrix3drotationXYZ(double angleX, double angleY, double angleZ)Set this matrix to a rotation ofangleXradians about the X axis, followed by a rotation ofangleYradians about the Y axis and followed by a rotation ofangleZradians about the Z axis.Matrix3drotationY(double ang)Set this matrix to a rotation transformation about the Y axis.Matrix3drotationYXZ(double angleY, double angleX, double angleZ)Set this matrix to a rotation ofangleYradians about the Y axis, followed by a rotation ofangleXradians about the X axis and followed by a rotation ofangleZradians about the Z axis.Matrix3drotationZ(double ang)Set this matrix to a rotation transformation about the Z axis.Matrix3drotationZYX(double angleZ, double angleY, double angleX)Set this matrix to a rotation ofangleZradians about the Z axis, followed by a rotation ofangleYradians about the Y axis and followed by a rotation ofangleXradians about the X axis.Matrix3dscale(double xyz)Apply scaling to this matrix by uniformly scaling all base axes by the givenxyzfactor.Matrix3dscale(double x, double y, double z)Apply scaling to this matrix by scaling the base axes by the given x, y and z factors.Matrix3dscale(double x, double y, double z, Matrix3d dest)Apply scaling to this matrix by scaling the base axes by the given x, y and z factors and store the result indest.Matrix3dscale(double xyz, Matrix3d dest)Apply scaling to this matrix by uniformly scaling all base axes by the givenxyzfactor and store the result indest.Matrix3dscale(Vector3dc xyz)Apply scaling to this matrix by scaling the base axes by the givenxyz.x,xyz.yandxyz.zfactors, respectively.Matrix3dscale(Vector3dc xyz, Matrix3d dest)Apply scaling tothismatrix by scaling the base axes by the givenxyz.x,xyz.yandxyz.zfactors, respectively and store the result indest.Matrix3dscaleLocal(double x, double y, double z)Pre-multiply scaling to this matrix by scaling the base axes by the given x, y and z factors.Matrix3dscaleLocal(double x, double y, double z, Matrix3d dest)Pre-multiply scaling tothismatrix by scaling the base axes by the given x, y and z factors and store the result indest.Matrix3dscaling(double factor)Set this matrix to be a simple scale matrix, which scales all axes uniformly by the given factor.Matrix3dscaling(double x, double y, double z)Set this matrix to be a simple scale matrix.Matrix3dscaling(Vector3dc xyz)Set this matrix to be a simple scale matrix which scales the base axes byxyz.x,xyz.yandxyz.zrespectively.Matrix3dset(double[] m)Set the values in this matrix based on the supplied double array.Matrix3dset(double m00, double m01, double m02, double m10, double m11, double m12, double m20, double m21, double m22)Set the values within this matrix to the supplied double values.Matrix3dset(float[] m)Set the values in this matrix based on the supplied double array.Matrix3dset(int column, int row, double value)Set the matrix element at the given column and row to the specified value.Matrix3dset(ByteBuffer buffer)Set the values of this matrix by reading 9 double values from the givenByteBufferin column-major order, starting at its current position.Matrix3dset(DoubleBuffer buffer)Set the values of this matrix by reading 9 double values from the givenDoubleBufferin column-major order, starting at its current position.Matrix3dset(FloatBuffer buffer)Set the values of this matrix by reading 9 float values from the givenFloatBufferin column-major order, starting at its current position.Matrix3dset(AxisAngle4d axisAngle)Set this matrix to be equivalent to the rotation specified by the givenAxisAngle4d.Matrix3dset(AxisAngle4f axisAngle)Set this matrix to be equivalent to the rotation specified by the givenAxisAngle4f.Matrix3dset(Matrix2dc mat)Matrix3dset(Matrix2fc mat)Matrix3dset(Matrix3dc m)Set the values in this matrix to the ones in m.Matrix3dset(Matrix3fc m)Set the values in this matrix to the ones in m.Matrix3dset(Matrix4dc mat)Set the elements of this matrix to the upper left 3x3 of the givenMatrix4dc.Matrix3dset(Matrix4fc mat)Set the elements of this matrix to the upper left 3x3 of the givenMatrix4fc.Matrix3dset(Matrix4x3dc m)Set the elements of this matrix to the left 3x3 submatrix ofm.Matrix3dset(Quaterniondc q)Set this matrix to a rotation - and possibly scaling - equivalent to the given quaternion.Matrix3dset(Quaternionfc q)Set this matrix to a rotation - and possibly scaling - equivalent to the given quaternion.Matrix3dset(Vector3dc col0, Vector3dc col1, Vector3dc col2)Set the three columns of this matrix to the supplied vectors, respectively.Matrix3dsetColumn(int column, double x, double y, double z)Set the column at the givencolumnindex, starting with0.Matrix3dsetColumn(int column, Vector3dc src)Set the column at the givencolumnindex, starting with0.Matrix3dsetFloats(ByteBuffer buffer)Set the values of this matrix by reading 9 float values from the givenByteBufferin column-major order, starting at its current position.Matrix3dsetLookAlong(double dirX, double dirY, double dirZ, double upX, double upY, double upZ)Set this matrix to a rotation transformation to make-zpoint alongdir.Matrix3dsetLookAlong(Vector3dc dir, Vector3dc up)Set this matrix to a rotation transformation to make-zpoint alongdir.Matrix3dsetRow(int row, double x, double y, double z)Set the row at the givenrowindex, starting with0.Matrix3dsetRow(int row, Vector3dc src)Set the row at the givenrowindex, starting with0.Matrix3dsetRowColumn(int row, int column, double value)Set the matrix element at the given row and column to the specified value.Matrix3dsetSkewSymmetric(double a, double b, double c)Set this matrix to a skew-symmetric matrix using the following layout:Matrix3dsetTransposed(Matrix3dc m)Store the values of the transpose of the given matrixmintothismatrix.Matrix3dsetTransposed(Matrix3fc m)Store the values of the transpose of the given matrixmintothismatrix.Matrix3dsub(Matrix3dc subtrahend)Component-wise subtractsubtrahendfromthis.Matrix3dsub(Matrix3dc subtrahend, Matrix3d dest)Component-wise subtractsubtrahendfromthisand store the result indest.Matrix3dswap(Matrix3d other)Exchange the values ofthismatrix with the givenothermatrix.StringtoString()Return a string representation of this matrix.StringtoString(NumberFormat formatter)Return a string representation of this matrix by formatting the matrix elements with the givenNumberFormat.Vector3dtransform(double x, double y, double z, Vector3d dest)Transform the vector(x, y, z)by this matrix and store the result indest.Vector3dtransform(Vector3d v)Transform the given vector by this matrix.Vector3dtransform(Vector3dc v, Vector3d dest)Transform the given vector by this matrix and store the result indest.Vector3ftransform(Vector3f v)Transform the given vector by this matrix.Vector3ftransform(Vector3fc v, Vector3f dest)Transform the given vector by this matrix and store the result indest.Vector3dtransformTranspose(double x, double y, double z, Vector3d dest)Transform the vector(x, y, z)by the transpose of this matrix and store the result indest.Vector3dtransformTranspose(Vector3d v)Transform the given vector by the transpose of this matrix.Vector3dtransformTranspose(Vector3dc v, Vector3d dest)Transform the given vector by the transpose of this matrix and store the result indest.Matrix3dtranspose()Transpose this matrix.Matrix3dtranspose(Matrix3d dest)Transposethismatrix and store the result indest.voidwriteExternal(ObjectOutput out)Matrix3dzero()Set all the values within this matrix to 0.
-
-
-
Constructor Detail
-
Matrix3d
public Matrix3d()
-
Matrix3d
public Matrix3d(Matrix2dc mat)
Create a newMatrix3dby setting its uppper left 2x2 submatrix to the values of the givenMatrix2dcand the rest to identity.- Parameters:
mat- theMatrix2dc
-
Matrix3d
public Matrix3d(Matrix2fc mat)
Create a newMatrix3dby setting its uppper left 2x2 submatrix to the values of the givenMatrix2fcand the rest to identity.- Parameters:
mat- theMatrix2fc
-
Matrix3d
public Matrix3d(Matrix3dc mat)
Create a newMatrix3dand initialize it with the values from the given matrix.- Parameters:
mat- the matrix to initialize this matrix with
-
Matrix3d
public Matrix3d(Matrix3fc mat)
Create a newMatrix3dand initialize it with the values from the given matrix.- Parameters:
mat- the matrix to initialize this matrix with
-
Matrix3d
public Matrix3d(double m00, double m01, double m02, double m10, double m11, double m12, double m20, double m21, double m22)Create a newMatrix3dand initialize its elements with the given values.- Parameters:
m00- the value of m00m01- the value of m01m02- the value of m02m10- the value of m10m11- the value of m11m12- the value of m12m20- the value of m20m21- the value of m21m22- the value of m22
-
Matrix3d
public Matrix3d(DoubleBuffer buffer)
Create a newMatrix3dby reading its 9 double components from the givenDoubleBufferat the buffer's current position.That DoubleBuffer is expected to hold the values in column-major order.
The buffer's position will not be changed by this method.
- Parameters:
buffer- theDoubleBufferto read the matrix values from
-
-
Method Detail
-
m00
public double m00()
Description copied from interface:Matrix3dcReturn the value of the matrix element at column 0 and row 0.
-
m01
public double m01()
Description copied from interface:Matrix3dcReturn the value of the matrix element at column 0 and row 1.
-
m02
public double m02()
Description copied from interface:Matrix3dcReturn the value of the matrix element at column 0 and row 2.
-
m10
public double m10()
Description copied from interface:Matrix3dcReturn the value of the matrix element at column 1 and row 0.
-
m11
public double m11()
Description copied from interface:Matrix3dcReturn the value of the matrix element at column 1 and row 1.
-
m12
public double m12()
Description copied from interface:Matrix3dcReturn the value of the matrix element at column 1 and row 2.
-
m20
public double m20()
Description copied from interface:Matrix3dcReturn the value of the matrix element at column 2 and row 0.
-
m21
public double m21()
Description copied from interface:Matrix3dcReturn the value of the matrix element at column 2 and row 1.
-
m22
public double m22()
Description copied from interface:Matrix3dcReturn the value of the matrix element at column 2 and row 2.
-
m00
public Matrix3d m00(double m00)
Set the value of the matrix element at column 0 and row 0.- Parameters:
m00- the new value- Returns:
- this
-
m01
public Matrix3d m01(double m01)
Set the value of the matrix element at column 0 and row 1.- Parameters:
m01- the new value- Returns:
- this
-
m02
public Matrix3d m02(double m02)
Set the value of the matrix element at column 0 and row 2.- Parameters:
m02- the new value- Returns:
- this
-
m10
public Matrix3d m10(double m10)
Set the value of the matrix element at column 1 and row 0.- Parameters:
m10- the new value- Returns:
- this
-
m11
public Matrix3d m11(double m11)
Set the value of the matrix element at column 1 and row 1.- Parameters:
m11- the new value- Returns:
- this
-
m12
public Matrix3d m12(double m12)
Set the value of the matrix element at column 1 and row 2.- Parameters:
m12- the new value- Returns:
- this
-
m20
public Matrix3d m20(double m20)
Set the value of the matrix element at column 2 and row 0.- Parameters:
m20- the new value- Returns:
- this
-
m21
public Matrix3d m21(double m21)
Set the value of the matrix element at column 2 and row 1.- Parameters:
m21- the new value- Returns:
- this
-
m22
public Matrix3d m22(double m22)
Set the value of the matrix element at column 2 and row 2.- Parameters:
m22- the new value- Returns:
- this
-
set
public Matrix3d set(Matrix3dc m)
Set the values in this matrix to the ones in m.- Parameters:
m- the matrix whose values will be copied- Returns:
- this
-
setTransposed
public Matrix3d setTransposed(Matrix3dc m)
Store the values of the transpose of the given matrixmintothismatrix.- Parameters:
m- the matrix to copy the transposed values from- Returns:
- this
-
set
public Matrix3d set(Matrix3fc m)
Set the values in this matrix to the ones in m.- Parameters:
m- the matrix whose values will be copied- Returns:
- this
-
setTransposed
public Matrix3d setTransposed(Matrix3fc m)
Store the values of the transpose of the given matrixmintothismatrix.- Parameters:
m- the matrix to copy the transposed values from- Returns:
- this
-
set
public Matrix3d set(Matrix4x3dc m)
Set the elements of this matrix to the left 3x3 submatrix ofm.- Parameters:
m- the matrix to copy the elements from- Returns:
- this
-
set
public Matrix3d set(Matrix4fc mat)
Set the elements of this matrix to the upper left 3x3 of the givenMatrix4fc.- Parameters:
mat- theMatrix4fcto copy the values from- Returns:
- this
-
set
public Matrix3d set(Matrix4dc mat)
Set the elements of this matrix to the upper left 3x3 of the givenMatrix4dc.- Parameters:
mat- theMatrix4dcto copy the values from- Returns:
- this
-
set
public Matrix3d set(Matrix2fc mat)
- Parameters:
mat- theMatrix2fc- Returns:
- this
- See Also:
Matrix3d(Matrix2fc)
-
set
public Matrix3d set(Matrix2dc mat)
- Parameters:
mat- theMatrix2dc- Returns:
- this
- See Also:
Matrix3d(Matrix2dc)
-
set
public Matrix3d set(AxisAngle4f axisAngle)
Set this matrix to be equivalent to the rotation specified by the givenAxisAngle4f.- Parameters:
axisAngle- theAxisAngle4f- Returns:
- this
-
set
public Matrix3d set(AxisAngle4d axisAngle)
Set this matrix to be equivalent to the rotation specified by the givenAxisAngle4d.- Parameters:
axisAngle- theAxisAngle4d- Returns:
- this
-
set
public Matrix3d set(Quaternionfc q)
Set this matrix to a rotation - and possibly scaling - equivalent to the given quaternion.This method is equivalent to calling:
rotation(q)Reference: http://www.euclideanspace.com/
- Parameters:
q- the quaternion- Returns:
- this
- See Also:
rotation(Quaternionfc)
-
set
public Matrix3d set(Quaterniondc q)
Set this matrix to a rotation - and possibly scaling - equivalent to the given quaternion.This method is equivalent to calling:
rotation(q)Reference: http://www.euclideanspace.com/
- Parameters:
q- the quaternion- Returns:
- this
- See Also:
rotation(Quaterniondc)
-
mul
public Matrix3d mul(Matrix3dc right)
Multiply this matrix by the supplied matrix. This matrix will be the left one.If
Misthismatrix andRtherightmatrix, then the new matrix will beM * R. So when transforming a vectorvwith the new matrix by usingM * R * v, the transformation of the right matrix will be applied first!- Parameters:
right- the right operand- Returns:
- this
-
mul
public Matrix3d mul(Matrix3dc right, Matrix3d dest)
Description copied from interface:Matrix3dcMultiply this matrix by the supplied matrix and store the result indest. This matrix will be the left one.If
Misthismatrix andRtherightmatrix, then the new matrix will beM * R. So when transforming a vectorvwith the new matrix by usingM * R * v, the transformation of the right matrix will be applied first!
-
mulLocal
public Matrix3d mulLocal(Matrix3dc left)
Pre-multiply this matrix by the suppliedleftmatrix and store the result inthis.If
Misthismatrix andLtheleftmatrix, then the new matrix will beL * M. So when transforming a vectorvwith the new matrix by usingL * M * v, the transformation ofthismatrix will be applied first!- Parameters:
left- the left operand of the matrix multiplication- Returns:
- this
-
mulLocal
public Matrix3d mulLocal(Matrix3dc left, Matrix3d dest)
Description copied from interface:Matrix3dcPre-multiply this matrix by the suppliedleftmatrix and store the result indest.If
Misthismatrix andLtheleftmatrix, then the new matrix will beL * M. So when transforming a vectorvwith the new matrix by usingL * M * v, the transformation ofthismatrix will be applied first!
-
mul
public Matrix3d mul(Matrix3fc right)
Multiply this matrix by the supplied matrix. This matrix will be the left one.If
Misthismatrix andRtherightmatrix, then the new matrix will beM * R. So when transforming a vectorvwith the new matrix by usingM * R * v, the transformation of the right matrix will be applied first!- Parameters:
right- the right operand- Returns:
- this
-
mul
public Matrix3d mul(Matrix3fc right, Matrix3d dest)
Description copied from interface:Matrix3dcMultiply this matrix by the supplied matrix and store the result indest. This matrix will be the left one.If
Misthismatrix andRtherightmatrix, then the new matrix will beM * R. So when transforming a vectorvwith the new matrix by usingM * R * v, the transformation of the right matrix will be applied first!
-
set
public Matrix3d set(double m00, double m01, double m02, double m10, double m11, double m12, double m20, double m21, double m22)
Set the values within this matrix to the supplied double values. The result looks like this:m00, m10, m20
m01, m11, m21
m02, m12, m22- Parameters:
m00- the new value of m00m01- the new value of m01m02- the new value of m02m10- the new value of m10m11- the new value of m11m12- the new value of m12m20- the new value of m20m21- the new value of m21m22- the new value of m22- Returns:
- this
-
set
public Matrix3d set(double[] m)
Set the values in this matrix based on the supplied double array. The result looks like this:0, 3, 6
1, 4, 7
2, 5, 8
Only uses the first 9 values, all others are ignored.
- Parameters:
m- the array to read the matrix values from- Returns:
- this
-
set
public Matrix3d set(float[] m)
Set the values in this matrix based on the supplied double array. The result looks like this:0, 3, 6
1, 4, 7
2, 5, 8
Only uses the first 9 values, all others are ignored
- Parameters:
m- the array to read the matrix values from- Returns:
- this
-
determinant
public double determinant()
Description copied from interface:Matrix3dcReturn the determinant of this matrix.- Specified by:
determinantin interfaceMatrix3dc- Returns:
- the determinant
-
invert
public Matrix3d invert()
Invert this matrix.- Returns:
- this
-
invert
public Matrix3d invert(Matrix3d dest)
Description copied from interface:Matrix3dcInvertthismatrix and store the result indest.
-
transpose
public Matrix3d transpose()
Transpose this matrix.- Returns:
- this
-
transpose
public Matrix3d transpose(Matrix3d dest)
Description copied from interface:Matrix3dcTransposethismatrix and store the result indest.
-
toString
public String toString()
Return a string representation of this matrix.This method creates a new
DecimalFormaton every invocation with the format string "0.000E0;-".
-
toString
public String toString(NumberFormat formatter)
Return a string representation of this matrix by formatting the matrix elements with the givenNumberFormat.- Parameters:
formatter- theNumberFormatused to format the matrix values with- Returns:
- the string representation
-
get
public Matrix3d get(Matrix3d dest)
Get the current values ofthismatrix and store them intodest.This is the reverse method of
set(Matrix3dc)and allows to obtain intermediate calculation results when chaining multiple transformations.- Specified by:
getin interfaceMatrix3dc- Parameters:
dest- the destination matrix- Returns:
- the passed in destination
- See Also:
set(Matrix3dc)
-
getRotation
public AxisAngle4f getRotation(AxisAngle4f dest)
Description copied from interface:Matrix3dcGet the current values ofthismatrix and store the represented rotation into the givenAxisAngle4f.- Specified by:
getRotationin interfaceMatrix3dc- Parameters:
dest- the destinationAxisAngle4f- Returns:
- the passed in destination
- See Also:
AxisAngle4f.set(Matrix3dc)
-
getUnnormalizedRotation
public Quaternionf getUnnormalizedRotation(Quaternionf dest)
Description copied from interface:Matrix3dcGet the current values ofthismatrix and store the represented rotation into the givenQuaternionf.This method assumes that the three column vectors of this matrix are not normalized and thus allows to ignore any additional scaling factor that is applied to the matrix.
- Specified by:
getUnnormalizedRotationin interfaceMatrix3dc- Parameters:
dest- the destinationQuaternionf- Returns:
- the passed in destination
- See Also:
Quaternionf.setFromUnnormalized(Matrix3dc)
-
getNormalizedRotation
public Quaternionf getNormalizedRotation(Quaternionf dest)
Description copied from interface:Matrix3dcGet the current values ofthismatrix and store the represented rotation into the givenQuaternionf.This method assumes that the three column vectors of this matrix are normalized.
- Specified by:
getNormalizedRotationin interfaceMatrix3dc- Parameters:
dest- the destinationQuaternionf- Returns:
- the passed in destination
- See Also:
Quaternionf.setFromNormalized(Matrix3dc)
-
getUnnormalizedRotation
public Quaterniond getUnnormalizedRotation(Quaterniond dest)
Description copied from interface:Matrix3dcGet the current values ofthismatrix and store the represented rotation into the givenQuaterniond.This method assumes that the three column vectors of this matrix are not normalized and thus allows to ignore any additional scaling factor that is applied to the matrix.
- Specified by:
getUnnormalizedRotationin interfaceMatrix3dc- Parameters:
dest- the destinationQuaterniond- Returns:
- the passed in destination
- See Also:
Quaterniond.setFromUnnormalized(Matrix3dc)
-
getNormalizedRotation
public Quaterniond getNormalizedRotation(Quaterniond dest)
Description copied from interface:Matrix3dcGet the current values ofthismatrix and store the represented rotation into the givenQuaterniond.This method assumes that the three column vectors of this matrix are normalized.
- Specified by:
getNormalizedRotationin interfaceMatrix3dc- Parameters:
dest- the destinationQuaterniond- Returns:
- the passed in destination
- See Also:
Quaterniond.setFromNormalized(Matrix3dc)
-
get
public DoubleBuffer get(DoubleBuffer buffer)
Description copied from interface:Matrix3dcStore this matrix into the suppliedDoubleBufferat the current bufferpositionusing column-major order.This method will not increment the position of the given DoubleBuffer.
In order to specify the offset into the DoubleBuffer} at which the matrix is stored, use
Matrix3dc.get(int, DoubleBuffer), taking the absolute position as parameter.- Specified by:
getin interfaceMatrix3dc- Parameters:
buffer- will receive the values of this matrix in column-major order at its current position- Returns:
- the passed in buffer
- See Also:
Matrix3dc.get(int, DoubleBuffer)
-
get
public DoubleBuffer get(int index, DoubleBuffer buffer)
Description copied from interface:Matrix3dcStore this matrix into the suppliedDoubleBufferstarting at the specified absolute buffer position/index using column-major order.This method will not increment the position of the given
DoubleBuffer.- Specified by:
getin interfaceMatrix3dc- Parameters:
index- the absolute position into theDoubleBufferbuffer- will receive the values of this matrix in column-major order- Returns:
- the passed in buffer
-
get
public FloatBuffer get(FloatBuffer buffer)
Description copied from interface:Matrix3dcStore this matrix in column-major order into the suppliedFloatBufferat the current bufferposition.This method will not increment the position of the given FloatBuffer.
In order to specify the offset into the FloatBuffer at which the matrix is stored, use
Matrix3dc.get(int, FloatBuffer), taking the absolute position as parameter.Please note that due to this matrix storing double values those values will potentially lose precision when they are converted to float values before being put into the given FloatBuffer.
- Specified by:
getin interfaceMatrix3dc- Parameters:
buffer- will receive the values of this matrix in column-major order at its current position- Returns:
- the passed in buffer
- See Also:
Matrix3dc.get(int, FloatBuffer)
-
get
public FloatBuffer get(int index, FloatBuffer buffer)
Description copied from interface:Matrix3dcStore this matrix in column-major order into the suppliedFloatBufferstarting at the specified absolute buffer position/index.This method will not increment the position of the given FloatBuffer.
Please note that due to this matrix storing double values those values will potentially lose precision when they are converted to float values before being put into the given FloatBuffer.
-
get
public ByteBuffer get(ByteBuffer buffer)
Description copied from interface:Matrix3dcStore this matrix in column-major order into the suppliedByteBufferat the current bufferposition.This method will not increment the position of the given ByteBuffer.
In order to specify the offset into the ByteBuffer at which the matrix is stored, use
Matrix3dc.get(int, ByteBuffer), taking the absolute position as parameter.- Specified by:
getin interfaceMatrix3dc- Parameters:
buffer- will receive the values of this matrix in column-major order at its current position- Returns:
- the passed in buffer
- See Also:
Matrix3dc.get(int, ByteBuffer)
-
get
public ByteBuffer get(int index, ByteBuffer buffer)
Description copied from interface:Matrix3dcStore this matrix in column-major order into the suppliedByteBufferstarting at the specified absolute buffer position/index.This method will not increment the position of the given ByteBuffer.
-
getFloats
public ByteBuffer getFloats(ByteBuffer buffer)
Description copied from interface:Matrix3dcStore the elements of this matrix as float values in column-major order into the suppliedByteBufferat the current bufferposition.This method will not increment the position of the given ByteBuffer.
Please note that due to this matrix storing double values those values will potentially lose precision when they are converted to float values before being put into the given ByteBuffer.
In order to specify the offset into the ByteBuffer at which the matrix is stored, use
Matrix3dc.getFloats(int, ByteBuffer), taking the absolute position as parameter.- Specified by:
getFloatsin interfaceMatrix3dc- Parameters:
buffer- will receive the elements of this matrix as float values in column-major order at its current position- Returns:
- the passed in buffer
- See Also:
Matrix3dc.getFloats(int, ByteBuffer)
-
getFloats
public ByteBuffer getFloats(int index, ByteBuffer buffer)
Description copied from interface:Matrix3dcStore the elements of this matrix as float values in column-major order into the suppliedByteBufferstarting at the specified absolute buffer position/index.This method will not increment the position of the given ByteBuffer.
Please note that due to this matrix storing double values those values will potentially lose precision when they are converted to float values before being put into the given ByteBuffer.
-
get
public double[] get(double[] arr, int offset)Description copied from interface:Matrix3dcStore this matrix into the supplied double array in column-major order at the given offset.
-
get
public double[] get(double[] arr)
Description copied from interface:Matrix3dcStore this matrix into the supplied double array in column-major order.In order to specify an explicit offset into the array, use the method
Matrix3dc.get(double[], int).- Specified by:
getin interfaceMatrix3dc- Parameters:
arr- the array to write the matrix values into- Returns:
- the passed in array
- See Also:
Matrix3dc.get(double[], int)
-
get
public float[] get(float[] arr, int offset)Description copied from interface:Matrix3dcStore the elements of this matrix as float values in column-major order into the supplied float array at the given offset.Please note that due to this matrix storing double values those values will potentially lose precision when they are converted to float values before being put into the given float array.
-
get
public float[] get(float[] arr)
Description copied from interface:Matrix3dcStore the elements of this matrix as float values in column-major order into the supplied float array.Please note that due to this matrix storing double values those values will potentially lose precision when they are converted to float values before being put into the given float array.
In order to specify an explicit offset into the array, use the method
Matrix3dc.get(float[], int).- Specified by:
getin interfaceMatrix3dc- Parameters:
arr- the array to write the matrix values into- Returns:
- the passed in array
- See Also:
Matrix3dc.get(float[], int)
-
set
public Matrix3d set(DoubleBuffer buffer)
Set the values of this matrix by reading 9 double values from the givenDoubleBufferin column-major order, starting at its current position.The DoubleBuffer is expected to contain the values in column-major order.
The position of the DoubleBuffer will not be changed by this method.
- Parameters:
buffer- the DoubleBuffer to read the matrix values from in column-major order- Returns:
- this
-
set
public Matrix3d set(FloatBuffer buffer)
Set the values of this matrix by reading 9 float values from the givenFloatBufferin column-major order, starting at its current position.The FloatBuffer is expected to contain the values in column-major order.
The position of the FloatBuffer will not be changed by this method.
- Parameters:
buffer- the FloatBuffer to read the matrix values from in column-major order- Returns:
- this
-
set
public Matrix3d set(ByteBuffer buffer)
Set the values of this matrix by reading 9 double values from the givenByteBufferin column-major order, starting at its current position.The ByteBuffer is expected to contain the values in column-major order.
The position of the ByteBuffer will not be changed by this method.
- Parameters:
buffer- the ByteBuffer to read the matrix values from in column-major order- Returns:
- this
-
setFloats
public Matrix3d setFloats(ByteBuffer buffer)
Set the values of this matrix by reading 9 float values from the givenByteBufferin column-major order, starting at its current position.The ByteBuffer is expected to contain the values in column-major order.
The position of the ByteBuffer will not be changed by this method.
- Parameters:
buffer- the ByteBuffer to read the matrix values from in column-major order- Returns:
- this
-
set
public Matrix3d set(Vector3dc col0, Vector3dc col1, Vector3dc col2)
Set the three columns of this matrix to the supplied vectors, respectively.- Parameters:
col0- the first columncol1- the second columncol2- the third column- Returns:
- this
-
zero
public Matrix3d zero()
Set all the values within this matrix to 0.- Returns:
- this
-
identity
public Matrix3d identity()
Set this matrix to the identity.- Returns:
- this
-
scaling
public Matrix3d scaling(double factor)
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
scale()instead.- Parameters:
factor- the scale factor in x, y and z- Returns:
- this
- See Also:
scale(double)
-
scaling
public Matrix3d scaling(double x, double y, double z)
Set this matrix to be a simple scale matrix.- Parameters:
x- the scale in xy- the scale in yz- the scale in z- Returns:
- this
-
scaling
public Matrix3d scaling(Vector3dc xyz)
Set this matrix to be a simple scale matrix which scales the base axes byxyz.x,xyz.yandxyz.zrespectively.The resulting matrix can be multiplied against another transformation matrix to obtain an additional scaling.
In order to post-multiply a scaling transformation directly to a matrix use
scale()instead.- Parameters:
xyz- the scale in x, y and z respectively- Returns:
- this
- See Also:
scale(Vector3dc)
-
scale
public Matrix3d scale(Vector3dc xyz, Matrix3d dest)
Description copied from interface:Matrix3dcApply scaling tothismatrix by scaling the base axes by the givenxyz.x,xyz.yandxyz.zfactors, respectively and store the result indest.If
Misthismatrix andSthe scaling matrix, then the new matrix will beM * S. So when transforming a vectorvwith the new matrix by usingM * S * v, the scaling will be applied first!
-
scale
public Matrix3d scale(Vector3dc xyz)
Apply scaling to this matrix by scaling the base axes by the givenxyz.x,xyz.yandxyz.zfactors, respectively.If
Misthismatrix andSthe scaling matrix, then the new matrix will beM * S. So when transforming a vectorvwith the new matrix by usingM * S * v, the scaling will be applied first!- Parameters:
xyz- the factors of the x, y and z component, respectively- Returns:
- this
-
scale
public Matrix3d scale(double x, double y, double z, Matrix3d dest)
Description copied from interface:Matrix3dcApply scaling to this matrix by scaling the base axes by the given x, y and z factors and store the result indest.If
Misthismatrix andSthe scaling matrix, then the new matrix will beM * S. So when transforming a vectorvwith the new matrix by usingM * S * v, the scaling will be applied first!
-
scale
public Matrix3d scale(double x, double y, double z)
Apply scaling to this matrix by scaling the base axes by the given x, y and z factors.If
Misthismatrix andSthe scaling matrix, then the new matrix will beM * S. So when transforming a vectorvwith the new matrix by usingM * S * v, the scaling will be applied first!- Parameters:
x- the factor of the x componenty- the factor of the y componentz- the factor of the z component- Returns:
- this
-
scale
public Matrix3d scale(double xyz, Matrix3d dest)
Description copied from interface:Matrix3dcApply scaling to this matrix by uniformly scaling all base axes by the givenxyzfactor and store the result indest.If
Misthismatrix andSthe scaling matrix, then the new matrix will beM * S. So when transforming a vectorvwith the new matrix by usingM * S * v, the scaling will be applied first!- Specified by:
scalein interfaceMatrix3dc- Parameters:
xyz- the factor for all componentsdest- will hold the result- Returns:
- dest
- See Also:
Matrix3dc.scale(double, double, double, Matrix3d)
-
scale
public Matrix3d scale(double xyz)
Apply scaling to this matrix by uniformly scaling all base axes by the givenxyzfactor.If
Misthismatrix andSthe scaling matrix, then the new matrix will beM * S. So when transforming a vectorvwith the new matrix by usingM * S * v, the scaling will be applied first!- Parameters:
xyz- the factor for all components- Returns:
- this
- See Also:
scale(double, double, double)
-
scaleLocal
public Matrix3d scaleLocal(double x, double y, double z, Matrix3d dest)
Description copied from interface:Matrix3dcPre-multiply scaling tothismatrix by scaling the base axes by the given x, y and z factors and store the result indest.If
Misthismatrix andSthe scaling matrix, then the new matrix will beS * M. So when transforming a vectorvwith the new matrix by usingS * M * v, the scaling will be applied last!- Specified by:
scaleLocalin interfaceMatrix3dc- Parameters:
x- the factor of the x componenty- the factor of the y componentz- the factor of the z componentdest- will hold the result- Returns:
- dest
-
scaleLocal
public Matrix3d scaleLocal(double x, double y, double z)
Pre-multiply scaling to this matrix by scaling the base axes by the given x, y and z factors.If
Misthismatrix andSthe scaling matrix, then the new matrix will beS * M. So when transforming a vectorvwith the new matrix by usingS * M * v, the scaling will be applied last!- Parameters:
x- the factor of the x componenty- the factor of the y componentz- the factor of the z component- Returns:
- this
-
rotation
public Matrix3d rotation(double angle, Vector3dc axis)
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.
The resulting matrix can be multiplied against another transformation matrix to obtain an additional rotation.
In order to post-multiply a rotation transformation directly to a matrix, use
rotate()instead.- Parameters:
angle- the angle in radiansaxis- the axis to rotate about (needs to benormalized)- Returns:
- this
- See Also:
rotate(double, Vector3dc)
-
rotation
public Matrix3d rotation(double angle, Vector3fc axis)
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.
The resulting matrix can be multiplied against another transformation matrix to obtain an additional rotation.
In order to post-multiply a rotation transformation directly to a matrix, use
rotate()instead.- Parameters:
angle- the angle in radiansaxis- the axis to rotate about (needs to benormalized)- Returns:
- this
- See Also:
rotate(double, Vector3fc)
-
rotation
public Matrix3d rotation(AxisAngle4f axisAngle)
Set this matrix to a rotation transformation using the givenAxisAngle4f.When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.
The resulting matrix can be multiplied against another transformation matrix to obtain an additional rotation.
In order to apply the rotation transformation to an existing transformation, use
rotate()instead.Reference: http://en.wikipedia.org
- Parameters:
axisAngle- theAxisAngle4f(needs to benormalized)- Returns:
- this
- See Also:
rotate(AxisAngle4f)
-
rotation
public Matrix3d rotation(AxisAngle4d axisAngle)
Set this matrix to a rotation transformation using the givenAxisAngle4d.When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.
The resulting matrix can be multiplied against another transformation matrix to obtain an additional rotation.
In order to apply the rotation transformation to an existing transformation, use
rotate()instead.Reference: http://en.wikipedia.org
- Parameters:
axisAngle- theAxisAngle4d(needs to benormalized)- Returns:
- this
- See Also:
rotate(AxisAngle4d)
-
rotation
public Matrix3d rotation(double angle, double x, double y, double z)
Set this matrix to a rotation matrix which rotates the given radians about a given axis.The axis described by the three components needs to be a unit vector.
When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.
The resulting matrix can be multiplied against another transformation matrix to obtain an additional rotation.
In order to apply the rotation transformation to an existing transformation, use
rotate()instead.Reference: http://en.wikipedia.org
- Parameters:
angle- the angle in radiansx- the x-component of the rotation axisy- the y-component of the rotation axisz- the z-component of the rotation axis- Returns:
- this
- See Also:
rotate(double, double, double, double)
-
rotationX
public Matrix3d rotationX(double ang)
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
- Parameters:
ang- the angle in radians- Returns:
- this
-
rotationY
public Matrix3d rotationY(double ang)
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
- Parameters:
ang- the angle in radians- Returns:
- this
-
rotationZ
public Matrix3d rotationZ(double ang)
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
- Parameters:
ang- the angle in radians- Returns:
- this
-
rotationXYZ
public Matrix3d rotationXYZ(double angleX, double angleY, double angleZ)
Set this matrix to a rotation ofangleXradians about the X axis, followed by a rotation ofangleYradians about the Y axis and followed by a rotation ofangleZradians 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)- Parameters:
angleX- the angle to rotate about XangleY- the angle to rotate about YangleZ- the angle to rotate about Z- Returns:
- this
-
rotationZYX
public Matrix3d rotationZYX(double angleZ, double angleY, double angleX)
Set this matrix to a rotation ofangleZradians about the Z axis, followed by a rotation ofangleYradians about the Y axis and followed by a rotation ofangleXradians 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)- Parameters:
angleZ- the angle to rotate about ZangleY- the angle to rotate about YangleX- the angle to rotate about X- Returns:
- this
-
rotationYXZ
public Matrix3d rotationYXZ(double angleY, double angleX, double angleZ)
Set this matrix to a rotation ofangleYradians about the Y axis, followed by a rotation ofangleXradians about the X axis and followed by a rotation ofangleZradians 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)- Parameters:
angleY- the angle to rotate about YangleX- the angle to rotate about XangleZ- the angle to rotate about Z- Returns:
- this
-
rotation
public Matrix3d rotation(Quaterniondc quat)
Set this matrix to the rotation - and possibly scaling - transformation of the givenQuaterniondc.When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.
The resulting matrix can be multiplied against another transformation matrix to obtain an additional rotation.
In order to apply the rotation transformation to an existing transformation, use
rotate()instead.Reference: http://en.wikipedia.org
- Parameters:
quat- theQuaterniondc- Returns:
- this
- See Also:
rotate(Quaterniondc)
-
rotation
public Matrix3d rotation(Quaternionfc quat)
Set this matrix to the rotation - and possibly scaling - transformation of the givenQuaternionfc.When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.
The resulting matrix can be multiplied against another transformation matrix to obtain an additional rotation.
In order to apply the rotation transformation to an existing transformation, use
rotate()instead.Reference: http://en.wikipedia.org
- Parameters:
quat- theQuaternionfc- Returns:
- this
- See Also:
rotate(Quaternionfc)
-
transform
public Vector3d transform(Vector3d v)
Description copied from interface:Matrix3dcTransform the given vector by this matrix.
-
transform
public Vector3d transform(Vector3dc v, Vector3d dest)
Description copied from interface:Matrix3dcTransform the given vector by this matrix and store the result indest.
-
transform
public Vector3f transform(Vector3f v)
Description copied from interface:Matrix3dcTransform the given vector by this matrix.
-
transform
public Vector3f transform(Vector3fc v, Vector3f dest)
Description copied from interface:Matrix3dcTransform the given vector by this matrix and store the result indest.
-
transform
public Vector3d transform(double x, double y, double z, Vector3d dest)
Description copied from interface:Matrix3dcTransform the vector(x, y, z)by this matrix and store the result indest.
-
transformTranspose
public Vector3d transformTranspose(Vector3d v)
Description copied from interface:Matrix3dcTransform the given vector by the transpose of this matrix.- Specified by:
transformTransposein interfaceMatrix3dc- Parameters:
v- the vector to transform- Returns:
- v
-
transformTranspose
public Vector3d transformTranspose(Vector3dc v, Vector3d dest)
Description copied from interface:Matrix3dcTransform the given vector by the transpose of this matrix and store the result indest.- Specified by:
transformTransposein interfaceMatrix3dc- Parameters:
v- the vector to transformdest- will hold the result- Returns:
- dest
-
transformTranspose
public Vector3d transformTranspose(double x, double y, double z, Vector3d dest)
Description copied from interface:Matrix3dcTransform the vector(x, y, z)by the transpose of this matrix and store the result indest.- Specified by:
transformTransposein interfaceMatrix3dc- Parameters:
x- the x coordinate of the vector to transformy- the y coordinate of the vector to transformz- the z coordinate of the vector to transformdest- will hold the result- Returns:
- dest
-
writeExternal
public void writeExternal(ObjectOutput out) throws IOException
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
readExternal
public void readExternal(ObjectInput in) throws IOException
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOException
-
rotateX
public Matrix3d rotateX(double ang, Matrix3d dest)
Description copied from interface:Matrix3dcApply rotation about the X axis to this matrix by rotating the given amount of radians and store the result indest.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
Misthismatrix andRthe rotation matrix, then the new matrix will beM * R. So when transforming a vectorvwith the new matrix by usingM * R * v, the rotation will be applied first!Reference: http://en.wikipedia.org
-
rotateX
public Matrix3d rotateX(double ang)
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
Misthismatrix andRthe rotation matrix, then the new matrix will beM * R. So when transforming a vectorvwith the new matrix by usingM * R * v, the rotation will be applied first!Reference: http://en.wikipedia.org
- Parameters:
ang- the angle in radians- Returns:
- this
-
rotateY
public Matrix3d rotateY(double ang, Matrix3d dest)
Description copied from interface:Matrix3dcApply rotation about the Y axis to this matrix by rotating the given amount of radians and store the result indest.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
Misthismatrix andRthe rotation matrix, then the new matrix will beM * R. So when transforming a vectorvwith the new matrix by usingM * R * v, the rotation will be applied first!Reference: http://en.wikipedia.org
-
rotateY
public Matrix3d rotateY(double ang)
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
Misthismatrix andRthe rotation matrix, then the new matrix will beM * R. So when transforming a vectorvwith the new matrix by usingM * R * v, the rotation will be applied first!Reference: http://en.wikipedia.org
- Parameters:
ang- the angle in radians- Returns:
- this
-
rotateZ
public Matrix3d rotateZ(double ang, Matrix3d dest)
Description copied from interface:Matrix3dcApply rotation about the Z axis to this matrix by rotating the given amount of radians and store the result indest.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
Misthismatrix andRthe rotation matrix, then the new matrix will beM * R. So when transforming a vectorvwith the new matrix by usingM * R * v, the rotation will be applied first!Reference: http://en.wikipedia.org
-
rotateZ
public Matrix3d rotateZ(double ang)
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
Misthismatrix andRthe rotation matrix, then the new matrix will beM * R. So when transforming a vectorvwith the new matrix by usingM * R * v, the rotation will be applied first!Reference: http://en.wikipedia.org
- Parameters:
ang- the angle in radians- Returns:
- this
-
rotateXYZ
public Matrix3d rotateXYZ(double angleX, double angleY, double angleZ)
Apply rotation ofangleXradians about the X axis, followed by a rotation ofangleYradians about the Y axis and followed by a rotation ofangleZradians 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
Misthismatrix andRthe rotation matrix, then the new matrix will beM * R. So when transforming a vectorvwith the new matrix by usingM * R * v, the rotation will be applied first!This method is equivalent to calling:
rotateX(angleX).rotateY(angleY).rotateZ(angleZ)- Parameters:
angleX- the angle to rotate about XangleY- the angle to rotate about YangleZ- the angle to rotate about Z- Returns:
- this
-
rotateXYZ
public Matrix3d rotateXYZ(double angleX, double angleY, double angleZ, Matrix3d dest)
Description copied from interface:Matrix3dcApply rotation ofangleXradians about the X axis, followed by a rotation ofangleYradians about the Y axis and followed by a rotation ofangleZradians about the Z axis and store the result indest.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
Misthismatrix andRthe rotation matrix, then the new matrix will beM * R. So when transforming a vectorvwith the new matrix by usingM * R * v, the rotation will be applied first!This method is equivalent to calling:
rotateX(angleX, dest).rotateY(angleY).rotateZ(angleZ)
-
rotateZYX
public Matrix3d rotateZYX(double angleZ, double angleY, double angleX)
Apply rotation ofangleZradians about the Z axis, followed by a rotation ofangleYradians about the Y axis and followed by a rotation ofangleXradians 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
Misthismatrix andRthe rotation matrix, then the new matrix will beM * R. So when transforming a vectorvwith the new matrix by usingM * R * v, the rotation will be applied first!This method is equivalent to calling:
rotateZ(angleZ).rotateY(angleY).rotateX(angleX)- Parameters:
angleZ- the angle to rotate about ZangleY- the angle to rotate about YangleX- the angle to rotate about X- Returns:
- this
-
rotateZYX
public Matrix3d rotateZYX(double angleZ, double angleY, double angleX, Matrix3d dest)
Description copied from interface:Matrix3dcApply rotation ofangleZradians about the Z axis, followed by a rotation ofangleYradians about the Y axis and followed by a rotation ofangleXradians about the X axis and store the result indest.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
Misthismatrix andRthe rotation matrix, then the new matrix will beM * R. So when transforming a vectorvwith the new matrix by usingM * R * v, the rotation will be applied first!This method is equivalent to calling:
rotateZ(angleZ, dest).rotateY(angleY).rotateX(angleX)
-
rotateYXZ
public Matrix3d rotateYXZ(Vector3d angles)
Apply rotation ofangles.yradians about the Y axis, followed by a rotation ofangles.xradians about the X axis and followed by a rotation ofangles.zradians 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
Misthismatrix andRthe rotation matrix, then the new matrix will beM * R. So when transforming a vectorvwith the new matrix by usingM * R * v, the rotation will be applied first!This method is equivalent to calling:
rotateY(angles.y).rotateX(angles.x).rotateZ(angles.z)- Parameters:
angles- the Euler angles- Returns:
- this
-
rotateYXZ
public Matrix3d rotateYXZ(double angleY, double angleX, double angleZ)
Apply rotation ofangleYradians about the Y axis, followed by a rotation ofangleXradians about the X axis and followed by a rotation ofangleZradians 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
Misthismatrix andRthe rotation matrix, then the new matrix will beM * R. So when transforming a vectorvwith the new matrix by usingM * R * v, the rotation will be applied first!This method is equivalent to calling:
rotateY(angleY).rotateX(angleX).rotateZ(angleZ)- Parameters:
angleY- the angle to rotate about YangleX- the angle to rotate about XangleZ- the angle to rotate about Z- Returns:
- this
-
rotateYXZ
public Matrix3d rotateYXZ(double angleY, double angleX, double angleZ, Matrix3d dest)
Description copied from interface:Matrix3dcApply rotation ofangleYradians about the Y axis, followed by a rotation ofangleXradians about the X axis and followed by a rotation ofangleZradians about the Z axis and store the result indest.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
Misthismatrix andRthe rotation matrix, then the new matrix will beM * R. So when transforming a vectorvwith the new matrix by usingM * R * v, the rotation will be applied first!This method is equivalent to calling:
rotateY(angleY, dest).rotateX(angleX).rotateZ(angleZ)
-
rotate
public Matrix3d rotate(double ang, double x, double y, double z)
Apply rotation to this matrix by rotating the given amount of radians about the given axis specified as x, y and z components.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
Misthismatrix andRthe rotation matrix, then the new matrix will beM * R. So when transforming a vectorvwith the new matrix by usingM * R * v, the rotation will be applied first!Reference: http://en.wikipedia.org
- Parameters:
ang- the angle in radiansx- the x component of the axisy- the y component of the axisz- the z component of the axis- Returns:
- this
-
rotate
public Matrix3d rotate(double ang, double x, double y, double z, Matrix3d dest)
Description copied from interface:Matrix3dcApply rotation to this matrix by rotating the given amount of radians about the given axis specified as x, y and z components, and store the result indest.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
Misthismatrix andRthe rotation matrix, then the new matrix will beM * R. So when transforming a vectorvwith the new matrix by usingM * R * v, the rotation will be applied first!Reference: http://en.wikipedia.org
-
rotateLocal
public Matrix3d rotateLocal(double ang, double x, double y, double z, Matrix3d dest)
Pre-multiply a rotation to this matrix by rotating the given amount of radians about the specified(x, y, z)axis and store the result indest.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
Misthismatrix andRthe rotation matrix, then the new matrix will beR * M. So when transforming a vectorvwith the new matrix by usingR * M * v, the rotation will be applied last!In order to set the matrix to a rotation matrix without pre-multiplying the rotation transformation, use
rotation().Reference: http://en.wikipedia.org
- Specified by:
rotateLocalin interfaceMatrix3dc- Parameters:
ang- the angle in radiansx- the x component of the axisy- the y component of the axisz- the z component of the axisdest- will hold the result- Returns:
- dest
- See Also:
rotation(double, double, double, double)
-
rotateLocal
public Matrix3d rotateLocal(double ang, double x, double y, double z)
Pre-multiply a rotation to this matrix by rotating the given amount of radians about the specified(x, y, z)axis.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
Misthismatrix andRthe rotation matrix, then the new matrix will beR * M. So when transforming a vectorvwith the new matrix by usingR * M * v, the rotation will be applied last!In order to set the matrix to a rotation matrix without pre-multiplying the rotation transformation, use
rotation().Reference: http://en.wikipedia.org
- Parameters:
ang- the angle in radiansx- the x component of the axisy- the y component of the axisz- the z component of the axis- Returns:
- this
- See Also:
rotation(double, double, double, double)
-
rotateLocalX
public Matrix3d rotateLocalX(double ang, Matrix3d 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 indest.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
Misthismatrix andRthe rotation matrix, then the new matrix will beR * M. So when transforming a vectorvwith the new matrix by usingR * 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
rotationX().Reference: http://en.wikipedia.org
- Specified by:
rotateLocalXin interfaceMatrix3dc- Parameters:
ang- the angle in radians to rotate about the X axisdest- will hold the result- Returns:
- dest
- See Also:
rotationX(double)
-
rotateLocalX
public Matrix3d rotateLocalX(double ang)
Pre-multiply a rotation to this matrix by rotating the given amount of 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
Misthismatrix andRthe rotation matrix, then the new matrix will beR * M. So when transforming a vectorvwith the new matrix by usingR * 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
rotationX().Reference: http://en.wikipedia.org
- Parameters:
ang- the angle in radians to rotate about the X axis- Returns:
- this
- See Also:
rotationX(double)
-
rotateLocalY
public Matrix3d rotateLocalY(double ang, Matrix3d 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 indest.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
Misthismatrix andRthe rotation matrix, then the new matrix will beR * M. So when transforming a vectorvwith the new matrix by usingR * 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
rotationY().Reference: http://en.wikipedia.org
- Specified by:
rotateLocalYin interfaceMatrix3dc- Parameters:
ang- the angle in radians to rotate about the Y axisdest- will hold the result- Returns:
- dest
- See Also:
rotationY(double)
-
rotateLocalY
public Matrix3d rotateLocalY(double ang)
Pre-multiply a rotation to this matrix by rotating the given amount of radians 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.
If
Misthismatrix andRthe rotation matrix, then the new matrix will beR * M. So when transforming a vectorvwith the new matrix by usingR * 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
rotationY().Reference: http://en.wikipedia.org
- Parameters:
ang- the angle in radians to rotate about the Y axis- Returns:
- this
- See Also:
rotationY(double)
-
rotateLocalZ
public Matrix3d rotateLocalZ(double ang, Matrix3d 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 indest.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
Misthismatrix andRthe rotation matrix, then the new matrix will beR * M. So when transforming a vectorvwith the new matrix by usingR * 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
rotationZ().Reference: http://en.wikipedia.org
- Specified by:
rotateLocalZin interfaceMatrix3dc- Parameters:
ang- the angle in radians to rotate about the Z axisdest- will hold the result- Returns:
- dest
- See Also:
rotationZ(double)
-
rotateLocalZ
public Matrix3d rotateLocalZ(double ang)
Pre-multiply a rotation to this matrix by rotating the given amount of 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
Misthismatrix andRthe rotation matrix, then the new matrix will beR * M. So when transforming a vectorvwith the new matrix by usingR * 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
rotationY().Reference: http://en.wikipedia.org
- Parameters:
ang- the angle in radians to rotate about the Z axis- Returns:
- this
- See Also:
rotationY(double)
-
rotateLocal
public Matrix3d rotateLocal(Quaterniondc quat, Matrix3d dest)
Pre-multiply the rotation - and possibly scaling - transformation of the givenQuaterniondcto this matrix and store the result indest.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
Misthismatrix andQthe rotation matrix obtained from the given quaternion, then the new matrix will beQ * M. So when transforming a vectorvwith the new matrix by usingQ * M * v, the quaternion rotation will be applied last!In order to set the matrix to a rotation transformation without pre-multiplying, use
rotation(Quaterniondc).Reference: http://en.wikipedia.org
- Specified by:
rotateLocalin interfaceMatrix3dc- Parameters:
quat- theQuaterniondcdest- will hold the result- Returns:
- dest
- See Also:
rotation(Quaterniondc)
-
rotateLocal
public Matrix3d rotateLocal(Quaterniondc quat)
Pre-multiply the rotation - and possibly scaling - transformation of the givenQuaterniondcto this matrix.When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.
If
Misthismatrix andQthe rotation matrix obtained from the given quaternion, then the new matrix will beQ * M. So when transforming a vectorvwith the new matrix by usingQ * M * v, the quaternion rotation will be applied last!In order to set the matrix to a rotation transformation without pre-multiplying, use
rotation(Quaterniondc).Reference: http://en.wikipedia.org
- Parameters:
quat- theQuaterniondc- Returns:
- this
- See Also:
rotation(Quaterniondc)
-
rotateLocal
public Matrix3d rotateLocal(Quaternionfc quat, Matrix3d dest)
Pre-multiply the rotation - and possibly scaling - transformation of the givenQuaternionfcto this matrix and store the result indest.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
Misthismatrix andQthe rotation matrix obtained from the given quaternion, then the new matrix will beQ * M. So when transforming a vectorvwith the new matrix by usingQ * M * v, the quaternion rotation will be applied last!In order to set the matrix to a rotation transformation without pre-multiplying, use
rotation(Quaternionfc).Reference: http://en.wikipedia.org
- Specified by:
rotateLocalin interfaceMatrix3dc- Parameters:
quat- theQuaternionfcdest- will hold the result- Returns:
- dest
- See Also:
rotation(Quaternionfc)
-
rotateLocal
public Matrix3d rotateLocal(Quaternionfc quat)
Pre-multiply the rotation - and possibly scaling - transformation of the givenQuaternionfcto this matrix.When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.
If
Misthismatrix andQthe rotation matrix obtained from the given quaternion, then the new matrix will beQ * M. So when transforming a vectorvwith the new matrix by usingQ * M * v, the quaternion rotation will be applied last!In order to set the matrix to a rotation transformation without pre-multiplying, use
rotation(Quaternionfc).Reference: http://en.wikipedia.org
- Parameters:
quat- theQuaternionfc- Returns:
- this
- See Also:
rotation(Quaternionfc)
-
rotate
public Matrix3d rotate(Quaterniondc quat)
Apply the rotation - and possibly scaling - transformation of the givenQuaterniondcto this matrix.When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.
If
Misthismatrix andQthe rotation matrix obtained from the given quaternion, then the new matrix will beM * Q. So when transforming a vectorvwith the new matrix by usingM * Q * v, the quaternion rotation will be applied first!In order to set the matrix to a rotation transformation without post-multiplying, use
rotation(Quaterniondc).Reference: http://en.wikipedia.org
- Parameters:
quat- theQuaterniondc- Returns:
- this
- See Also:
rotation(Quaterniondc)
-
rotate
public Matrix3d rotate(Quaterniondc quat, Matrix3d dest)
Apply the rotation - and possibly scaling - transformation of the givenQuaterniondcto this matrix and store the result indest.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
Misthismatrix andQthe rotation matrix obtained from the given quaternion, then the new matrix will beM * Q. So when transforming a vectorvwith the new matrix by usingM * Q * v, the quaternion rotation will be applied first!In order to set the matrix to a rotation transformation without post-multiplying, use
rotation(Quaterniondc).Reference: http://en.wikipedia.org
- Specified by:
rotatein interfaceMatrix3dc- Parameters:
quat- theQuaterniondcdest- will hold the result- Returns:
- dest
- See Also:
rotation(Quaterniondc)
-
rotate
public Matrix3d rotate(Quaternionfc quat)
Apply the rotation - and possibly scaling - transformation of the givenQuaternionfcto this matrix.When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.
If
Misthismatrix andQthe rotation matrix obtained from the given quaternion, then the new matrix will beM * Q. So when transforming a vectorvwith the new matrix by usingM * Q * v, the quaternion rotation will be applied first!In order to set the matrix to a rotation transformation without post-multiplying, use
rotation(Quaternionfc).Reference: http://en.wikipedia.org
- Parameters:
quat- theQuaternionfc- Returns:
- this
- See Also:
rotation(Quaternionfc)
-
rotate
public Matrix3d rotate(Quaternionfc quat, Matrix3d dest)
Apply the rotation - and possibly scaling - transformation of the givenQuaternionfcto this matrix and store the result indest.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
Misthismatrix andQthe rotation matrix obtained from the given quaternion, then the new matrix will beM * Q. So when transforming a vectorvwith the new matrix by usingM * Q * v, the quaternion rotation will be applied first!In order to set the matrix to a rotation transformation without post-multiplying, use
rotation(Quaternionfc).Reference: http://en.wikipedia.org
- Specified by:
rotatein interfaceMatrix3dc- Parameters:
quat- theQuaternionfcdest- will hold the result- Returns:
- dest
- See Also:
rotation(Quaternionfc)
-
rotate
public Matrix3d rotate(AxisAngle4f axisAngle)
Apply a rotation transformation, rotating about the givenAxisAngle4f, to this matrix.When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.
If
Misthismatrix andAthe rotation matrix obtained from the givenAxisAngle4f, then the new matrix will beM * A. So when transforming a vectorvwith the new matrix by usingM * A * v, theAxisAngle4frotation will be applied first!In order to set the matrix to a rotation transformation without post-multiplying, use
rotation(AxisAngle4f).Reference: http://en.wikipedia.org
- Parameters:
axisAngle- theAxisAngle4f(needs to benormalized)- Returns:
- this
- See Also:
rotate(double, double, double, double),rotation(AxisAngle4f)
-
rotate
public Matrix3d rotate(AxisAngle4f axisAngle, Matrix3d dest)
Apply a rotation transformation, rotating about the givenAxisAngle4fand store the result indest.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
Misthismatrix andAthe rotation matrix obtained from the givenAxisAngle4f, then the new matrix will beM * A. So when transforming a vectorvwith the new matrix by usingM * A * v, theAxisAngle4frotation will be applied first!In order to set the matrix to a rotation transformation without post-multiplying, use
rotation(AxisAngle4f).Reference: http://en.wikipedia.org
- Specified by:
rotatein interfaceMatrix3dc- Parameters:
axisAngle- theAxisAngle4f(needs to benormalized)dest- will hold the result- Returns:
- dest
- See Also:
rotate(double, double, double, double),rotation(AxisAngle4f)
-
rotate
public Matrix3d rotate(AxisAngle4d axisAngle)
Apply a rotation transformation, rotating about the givenAxisAngle4d, to this matrix.When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.
If
Misthismatrix andAthe rotation matrix obtained from the givenAxisAngle4d, then the new matrix will beM * A. So when transforming a vectorvwith the new matrix by usingM * A * v, theAxisAngle4drotation will be applied first!In order to set the matrix to a rotation transformation without post-multiplying, use
rotation(AxisAngle4d).Reference: http://en.wikipedia.org
- Parameters:
axisAngle- theAxisAngle4d(needs to benormalized)- Returns:
- this
- See Also:
rotate(double, double, double, double),rotation(AxisAngle4d)
-
rotate
public Matrix3d rotate(AxisAngle4d axisAngle, Matrix3d dest)
Apply a rotation transformation, rotating about the givenAxisAngle4dand store the result indest.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
Misthismatrix andAthe rotation matrix obtained from the givenAxisAngle4d, then the new matrix will beM * A. So when transforming a vectorvwith the new matrix by usingM * A * v, theAxisAngle4drotation will be applied first!In order to set the matrix to a rotation transformation without post-multiplying, use
rotation(AxisAngle4d).Reference: http://en.wikipedia.org
- Specified by:
rotatein interfaceMatrix3dc- Parameters:
axisAngle- theAxisAngle4d(needs to benormalized)dest- will hold the result- Returns:
- dest
- See Also:
rotate(double, double, double, double),rotation(AxisAngle4d)
-
rotate
public Matrix3d rotate(double angle, Vector3dc axis)
Apply a rotation transformation, rotating the given radians about the specified axis, to this matrix.The axis described by the
axisvector 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
Misthismatrix andAthe rotation matrix obtained from the given angle and axis, then the new matrix will beM * A. So when transforming a vectorvwith the new matrix by usingM * A * v, the axis-angle rotation will be applied first!In order to set the matrix to a rotation transformation without post-multiplying, use
rotation(double, Vector3dc).Reference: http://en.wikipedia.org
- Parameters:
angle- the angle in radiansaxis- the rotation axis (needs to benormalized)- Returns:
- this
- See Also:
rotate(double, double, double, double),rotation(double, Vector3dc)
-
rotate
public Matrix3d rotate(double angle, Vector3dc axis, Matrix3d dest)
Apply a rotation transformation, rotating the given radians about the specified axis and store the result indest.The axis described by the
axisvector 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
Misthismatrix andAthe rotation matrix obtained from the given axis and angle, then the new matrix will beM * A. So when transforming a vectorvwith the new matrix by usingM * A * v, the axis-angle rotation will be applied first!In order to set the matrix to a rotation transformation without post-multiplying, use
rotation(double, Vector3dc).Reference: http://en.wikipedia.org
- Specified by:
rotatein interfaceMatrix3dc- Parameters:
angle- the angle in radiansaxis- the rotation axis (needs to benormalized)dest- will hold the result- Returns:
- dest
- See Also:
rotate(double, double, double, double),rotation(double, Vector3dc)
-
rotate
public Matrix3d rotate(double angle, Vector3fc axis)
Apply a rotation transformation, rotating the given radians about the specified axis, to this matrix.The axis described by the
axisvector 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
Misthismatrix andAthe rotation matrix obtained from the given angle and axis, then the new matrix will beM * A. So when transforming a vectorvwith the new matrix by usingM * A * v, the axis-angle rotation will be applied first!In order to set the matrix to a rotation transformation without post-multiplying, use
rotation(double, Vector3fc).Reference: http://en.wikipedia.org
- Parameters:
angle- the angle in radiansaxis- the rotation axis (needs to benormalized)- Returns:
- this
- See Also:
rotate(double, double, double, double),rotation(double, Vector3fc)
-
rotate
public Matrix3d rotate(double angle, Vector3fc axis, Matrix3d dest)
Apply a rotation transformation, rotating the given radians about the specified axis and store the result indest.The axis described by the
axisvector 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
Misthismatrix andAthe rotation matrix obtained from the given axis and angle, then the new matrix will beM * A. So when transforming a vectorvwith the new matrix by usingM * A * v, the axis-angle rotation will be applied first!In order to set the matrix to a rotation transformation without post-multiplying, use
rotation(double, Vector3fc).Reference: http://en.wikipedia.org
- Specified by:
rotatein interfaceMatrix3dc- Parameters:
angle- the angle in radiansaxis- the rotation axis (needs to benormalized)dest- will hold the result- Returns:
- dest
- See Also:
rotate(double, double, double, double),rotation(double, Vector3fc)
-
getRow
public Vector3d getRow(int row, Vector3d dest) throws IndexOutOfBoundsException
Description copied from interface:Matrix3dcGet the row at the givenrowindex, starting with0.- Specified by:
getRowin interfaceMatrix3dc- Parameters:
row- the row index in[0..2]dest- will hold the row components- Returns:
- the passed in destination
- Throws:
IndexOutOfBoundsException- ifrowis not in[0..2]
-
setRow
public Matrix3d setRow(int row, Vector3dc src) throws IndexOutOfBoundsException
Set the row at the givenrowindex, starting with0.- Parameters:
row- the row index in[0..2]src- the row components to set- Returns:
- this
- Throws:
IndexOutOfBoundsException- ifrowis not in[0..2]
-
setRow
public Matrix3d setRow(int row, double x, double y, double z) throws IndexOutOfBoundsException
Set the row at the givenrowindex, starting with0.- Parameters:
row- the column index in[0..2]x- the first element in the rowy- the second element in the rowz- the third element in the row- Returns:
- this
- Throws:
IndexOutOfBoundsException- ifrowis not in[0..2]
-
getColumn
public Vector3d getColumn(int column, Vector3d dest) throws IndexOutOfBoundsException
Description copied from interface:Matrix3dcGet the column at the givencolumnindex, starting with0.- Specified by:
getColumnin interfaceMatrix3dc- Parameters:
column- the column index in[0..2]dest- will hold the column components- Returns:
- the passed in destination
- Throws:
IndexOutOfBoundsException- ifcolumnis not in[0..2]
-
setColumn
public Matrix3d setColumn(int column, Vector3dc src) throws IndexOutOfBoundsException
Set the column at the givencolumnindex, starting with0.- Parameters:
column- the column index in[0..2]src- the column components to set- Returns:
- this
- Throws:
IndexOutOfBoundsException- ifcolumnis not in[0..2]
-
setColumn
public Matrix3d setColumn(int column, double x, double y, double z) throws IndexOutOfBoundsException
Set the column at the givencolumnindex, starting with0.- Parameters:
column- the column index in[0..2]x- the first element in the columny- the second element in the columnz- the third element in the column- Returns:
- this
- Throws:
IndexOutOfBoundsException- ifcolumnis not in[0..2]
-
get
public double get(int column, int row)Description copied from interface:Matrix3dcGet the matrix element value at the given column and row.
-
set
public Matrix3d set(int column, int row, double value)
Set the matrix element at the given column and row to the specified value.- Parameters:
column- the colum index in[0..2]row- the row index in[0..2]value- the value- Returns:
- this
-
getRowColumn
public double getRowColumn(int row, int column)Description copied from interface:Matrix3dcGet the matrix element value at the given row and column.- Specified by:
getRowColumnin interfaceMatrix3dc- Parameters:
row- the colum index in[0..2]column- the row index in[0..2]- Returns:
- the element value
-
setRowColumn
public Matrix3d setRowColumn(int row, int column, double value)
Set the matrix element at the given row and column to the specified value.- Parameters:
row- the row index in[0..2]column- the colum index in[0..2]value- the value- Returns:
- this
-
normal
public Matrix3d normal()
Setthismatrix to its own normal matrix.The normal matrix of
mis the transpose of the inverse ofm.Please note that, if
thisis an orthogonal matrix or a matrix whose columns are orthogonal vectors, then this method need not be invoked, since in that casethisitself is its normal matrix. In this case, useset(Matrix3dc)to set a given Matrix3f to this matrix.- Returns:
- this
- See Also:
set(Matrix3dc)
-
normal
public Matrix3d normal(Matrix3d dest)
Compute a normal matrix fromthismatrix and store it intodest.The normal matrix of
mis the transpose of the inverse ofm.Please note that, if
thisis an orthogonal matrix or a matrix whose columns are orthogonal vectors, then this method need not be invoked, since in that casethisitself is its normal matrix. In this case, useset(Matrix3dc)to set a given Matrix3d to this matrix.- Specified by:
normalin interfaceMatrix3dc- Parameters:
dest- will hold the result- Returns:
- dest
- See Also:
set(Matrix3dc)
-
cofactor
public Matrix3d cofactor()
Compute the cofactor matrix ofthis.The cofactor matrix can be used instead of
normal()to transform normals when the orientation of the normals with respect to the surface should be preserved.- Returns:
- this
-
cofactor
public Matrix3d cofactor(Matrix3d dest)
Compute the cofactor matrix ofthisand store it intodest.The cofactor matrix can be used instead of
normal(Matrix3d)to transform normals when the orientation of the normals with respect to the surface should be preserved.
-
lookAlong
public Matrix3d lookAlong(Vector3dc dir, Vector3dc up)
Apply a rotation transformation to this matrix to make-zpoint alongdir.If
Misthismatrix andLthe lookalong rotation matrix, then the new matrix will beM * L. So when transforming a vectorvwith the new matrix by usingM * L * v, the lookalong rotation transformation will be applied first!In order to set the matrix to a lookalong transformation without post-multiplying it, use
setLookAlong().- Parameters:
dir- the direction in space to look alongup- the direction of 'up'- Returns:
- this
- See Also:
lookAlong(double, double, double, double, double, double),setLookAlong(Vector3dc, Vector3dc)
-
lookAlong
public Matrix3d lookAlong(Vector3dc dir, Vector3dc up, Matrix3d dest)
Apply a rotation transformation to this matrix to make-zpoint alongdirand store the result indest.If
Misthismatrix andLthe lookalong rotation matrix, then the new matrix will beM * L. So when transforming a vectorvwith the new matrix by usingM * L * v, the lookalong rotation transformation will be applied first!In order to set the matrix to a lookalong transformation without post-multiplying it, use
setLookAlong().- Specified by:
lookAlongin interfaceMatrix3dc- Parameters:
dir- the direction in space to look alongup- the direction of 'up'dest- will hold the result- Returns:
- dest
- See Also:
lookAlong(double, double, double, double, double, double),setLookAlong(Vector3dc, Vector3dc)
-
lookAlong
public Matrix3d lookAlong(double dirX, double dirY, double dirZ, double upX, double upY, double upZ, Matrix3d dest)
Apply a rotation transformation to this matrix to make-zpoint alongdirand store the result indest.If
Misthismatrix andLthe lookalong rotation matrix, then the new matrix will beM * L. So when transforming a vectorvwith the new matrix by usingM * L * v, the lookalong rotation transformation will be applied first!In order to set the matrix to a lookalong transformation without post-multiplying it, use
setLookAlong()- Specified by:
lookAlongin interfaceMatrix3dc- Parameters:
dirX- the x-coordinate of the direction to look alongdirY- the y-coordinate of the direction to look alongdirZ- the z-coordinate of the direction to look alongupX- the x-coordinate of the up vectorupY- the y-coordinate of the up vectorupZ- the z-coordinate of the up vectordest- will hold the result- Returns:
- dest
- See Also:
setLookAlong(double, double, double, double, double, double)
-
lookAlong
public Matrix3d lookAlong(double dirX, double dirY, double dirZ, double upX, double upY, double upZ)
Apply a rotation transformation to this matrix to make-zpoint alongdir.If
Misthismatrix andLthe lookalong rotation matrix, then the new matrix will beM * L. So when transforming a vectorvwith the new matrix by usingM * L * v, the lookalong rotation transformation will be applied first!In order to set the matrix to a lookalong transformation without post-multiplying it, use
setLookAlong()- Parameters:
dirX- the x-coordinate of the direction to look alongdirY- the y-coordinate of the direction to look alongdirZ- the z-coordinate of the direction to look alongupX- the x-coordinate of the up vectorupY- the y-coordinate of the up vectorupZ- the z-coordinate of the up vector- Returns:
- this
- See Also:
setLookAlong(double, double, double, double, double, double)
-
setLookAlong
public Matrix3d setLookAlong(Vector3dc dir, Vector3dc up)
Set this matrix to a rotation transformation to make-zpoint alongdir.In order to apply the lookalong transformation to any previous existing transformation, use
lookAlong(Vector3dc, Vector3dc).- Parameters:
dir- the direction in space to look alongup- the direction of 'up'- Returns:
- this
- See Also:
setLookAlong(Vector3dc, Vector3dc),lookAlong(Vector3dc, Vector3dc)
-
setLookAlong
public Matrix3d setLookAlong(double dirX, double dirY, double dirZ, double upX, double upY, double upZ)
Set this matrix to a rotation transformation to make-zpoint alongdir.In order to apply the lookalong transformation to any previous existing transformation, use
lookAlong()- Parameters:
dirX- the x-coordinate of the direction to look alongdirY- the y-coordinate of the direction to look alongdirZ- the z-coordinate of the direction to look alongupX- the x-coordinate of the up vectorupY- the y-coordinate of the up vectorupZ- the z-coordinate of the up vector- Returns:
- this
- See Also:
setLookAlong(double, double, double, double, double, double),lookAlong(double, double, double, double, double, double)
-
getScale
public Vector3d getScale(Vector3d dest)
Description copied from interface:Matrix3dcGet the scaling factors ofthismatrix for the three base axes.
-
positiveZ
public Vector3d positiveZ(Vector3d dir)
Description copied from interface:Matrix3dcObtain the direction of+Zbefore the transformation represented bythismatrix is applied.This method is equivalent to the following code:
Matrix3d inv = new Matrix3d(this).invert(); inv.transform(dir.set(0, 0, 1)).normalize();
Ifthisis already an orthogonal matrix, then consider usingMatrix3dc.normalizedPositiveZ(Vector3d)instead.Reference: http://www.euclideanspace.com
-
normalizedPositiveZ
public Vector3d normalizedPositiveZ(Vector3d dir)
Description copied from interface:Matrix3dcObtain the direction of+Zbefore the transformation represented bythisorthogonal matrix is applied. This method only produces correct results ifthisis an orthogonal matrix.This method is equivalent to the following code:
Matrix3d inv = new Matrix3d(this).transpose(); inv.transform(dir.set(0, 0, 1));
Reference: http://www.euclideanspace.com
- Specified by:
normalizedPositiveZin interfaceMatrix3dc- Parameters:
dir- will hold the direction of+Z- Returns:
- dir
-
positiveX
public Vector3d positiveX(Vector3d dir)
Description copied from interface:Matrix3dcObtain the direction of+Xbefore the transformation represented bythismatrix is applied.This method is equivalent to the following code:
Matrix3d inv = new Matrix3d(this).invert(); inv.transform(dir.set(1, 0, 0)).normalize();
Ifthisis already an orthogonal matrix, then consider usingMatrix3dc.normalizedPositiveX(Vector3d)instead.Reference: http://www.euclideanspace.com
-
normalizedPositiveX
public Vector3d normalizedPositiveX(Vector3d dir)
Description copied from interface:Matrix3dcObtain the direction of+Xbefore the transformation represented bythisorthogonal matrix is applied. This method only produces correct results ifthisis an orthogonal matrix.This method is equivalent to the following code:
Matrix3d inv = new Matrix3d(this).transpose(); inv.transform(dir.set(1, 0, 0));
Reference: http://www.euclideanspace.com
- Specified by:
normalizedPositiveXin interfaceMatrix3dc- Parameters:
dir- will hold the direction of+X- Returns:
- dir
-
positiveY
public Vector3d positiveY(Vector3d dir)
Description copied from interface:Matrix3dcObtain the direction of+Ybefore the transformation represented bythismatrix is applied.This method is equivalent to the following code:
Matrix3d inv = new Matrix3d(this).invert(); inv.transform(dir.set(0, 1, 0)).normalize();
Ifthisis already an orthogonal matrix, then consider usingMatrix3dc.normalizedPositiveY(Vector3d)instead.Reference: http://www.euclideanspace.com
-
normalizedPositiveY
public Vector3d normalizedPositiveY(Vector3d dir)
Description copied from interface:Matrix3dcObtain the direction of+Ybefore the transformation represented bythisorthogonal matrix is applied. This method only produces correct results ifthisis an orthogonal matrix.This method is equivalent to the following code:
Matrix3d inv = new Matrix3d(this).transpose(); inv.transform(dir.set(0, 1, 0));
Reference: http://www.euclideanspace.com
- Specified by:
normalizedPositiveYin interfaceMatrix3dc- Parameters:
dir- will hold the direction of+Y- Returns:
- dir
-
equals
public boolean equals(Matrix3dc m, double delta)
Description copied from interface:Matrix3dcCompare the matrix elements ofthismatrix with the given matrix using the givendeltaand return whether all of them are equal within a maximum difference ofdelta.Please note that this method is not used by any data structure such as
ArrayListHashSetorHashMapand their operations, such asArrayList.contains(Object)orHashSet.remove(Object), since those data structures only use theObject.equals(Object)andObject.hashCode()methods.
-
swap
public Matrix3d swap(Matrix3d other)
Exchange the values ofthismatrix with the givenothermatrix.- Parameters:
other- the other matrix to exchange the values with- Returns:
- this
-
add
public Matrix3d add(Matrix3dc other)
Component-wise addthisandother.- Parameters:
other- the other addend- Returns:
- this
-
add
public Matrix3d add(Matrix3dc other, Matrix3d dest)
Description copied from interface:Matrix3dcComponent-wise addthisandotherand store the result indest.
-
sub
public Matrix3d sub(Matrix3dc subtrahend)
Component-wise subtractsubtrahendfromthis.- Parameters:
subtrahend- the subtrahend- Returns:
- this
-
sub
public Matrix3d sub(Matrix3dc subtrahend, Matrix3d dest)
Description copied from interface:Matrix3dcComponent-wise subtractsubtrahendfromthisand store the result indest.
-
mulComponentWise
public Matrix3d mulComponentWise(Matrix3dc other)
Component-wise multiplythisbyother.- Parameters:
other- the other matrix- Returns:
- this
-
mulComponentWise
public Matrix3d mulComponentWise(Matrix3dc other, Matrix3d dest)
Description copied from interface:Matrix3dcComponent-wise multiplythisbyotherand store the result indest.- Specified by:
mulComponentWisein interfaceMatrix3dc- Parameters:
other- the other matrixdest- will hold the result- Returns:
- dest
-
setSkewSymmetric
public Matrix3d setSkewSymmetric(double a, double b, double c)
Set this matrix to a skew-symmetric matrix using the following layout:0, a, -b -a, 0, c b, -c, 0
Reference: https://en.wikipedia.org- Parameters:
a- the value used for the matrix elements m01 and m10b- the value used for the matrix elements m02 and m20c- the value used for the matrix elements m12 and m21- Returns:
- this
-
lerp
public Matrix3d lerp(Matrix3dc other, double t)
Linearly interpolatethisandotherusing the given interpolation factortand store the result inthis.If
tis0.0then the result isthis. If the interpolation factor is1.0then the result isother.- Parameters:
other- the other matrixt- the interpolation factor between 0.0 and 1.0- Returns:
- this
-
lerp
public Matrix3d lerp(Matrix3dc other, double t, Matrix3d dest)
Description copied from interface:Matrix3dcLinearly interpolatethisandotherusing the given interpolation factortand store the result indest.If
tis0.0then the result isthis. If the interpolation factor is1.0then the result isother.
-
rotateTowards
public Matrix3d rotateTowards(Vector3dc direction, Vector3dc up, Matrix3d dest)
Apply a model transformation to this matrix for a right-handed coordinate system, that aligns the local+Zaxis withdirectionand store the result indest.If
Misthismatrix andLthe lookat matrix, then the new matrix will beM * L. So when transforming a vectorvwith the new matrix by usingM * L * v, the lookat transformation will be applied first!In order to set the matrix to a rotation transformation without post-multiplying it, use
rotationTowards().This method is equivalent to calling:
mul(new Matrix3d().lookAlong(new Vector3d(dir).negate(), up).invert(), dest)- Specified by:
rotateTowardsin interfaceMatrix3dc- Parameters:
direction- the direction to rotate towardsup- the model's up vectordest- will hold the result- Returns:
- dest
- See Also:
rotateTowards(double, double, double, double, double, double, Matrix3d),rotationTowards(Vector3dc, Vector3dc)
-
rotateTowards
public Matrix3d rotateTowards(Vector3dc direction, Vector3dc up)
Apply a model transformation to this matrix for a right-handed coordinate system, that aligns the local+Zaxis withdirection.If
Misthismatrix andLthe lookat matrix, then the new matrix will beM * L. So when transforming a vectorvwith the new matrix by usingM * L * v, the lookat transformation will be applied first!In order to set the matrix to a rotation transformation without post-multiplying it, use
rotationTowards().This method is equivalent to calling:
mul(new Matrix3d().lookAlong(new Vector3d(dir).negate(), up).invert())- Parameters:
direction- the direction to orient towardsup- the up vector- Returns:
- this
- See Also:
rotateTowards(double, double, double, double, double, double),rotationTowards(Vector3dc, Vector3dc)
-
rotateTowards
public Matrix3d rotateTowards(double dirX, double dirY, double dirZ, double upX, double upY, double upZ)
Apply a model transformation to this matrix for a right-handed coordinate system, that aligns the local+Zaxis withdirection.If
Misthismatrix andLthe lookat matrix, then the new matrix will beM * L. So when transforming a vectorvwith the new matrix by usingM * L * v, the lookat transformation will be applied first!In order to set the matrix to a rotation transformation without post-multiplying it, use
rotationTowards().This method is equivalent to calling:
mul(new Matrix3d().lookAlong(-dirX, -dirY, -dirZ, upX, upY, upZ).invert())- Parameters:
dirX- the x-coordinate of the direction to rotate towardsdirY- the y-coordinate of the direction to rotate towardsdirZ- the z-coordinate of the direction to rotate towardsupX- the x-coordinate of the up vectorupY- the y-coordinate of the up vectorupZ- the z-coordinate of the up vector- Returns:
- this
- See Also:
rotateTowards(Vector3dc, Vector3dc),rotationTowards(double, double, double, double, double, double)
-
rotateTowards
public Matrix3d rotateTowards(double dirX, double dirY, double dirZ, double upX, double upY, double upZ, Matrix3d dest)
Apply a model transformation to this matrix for a right-handed coordinate system, that aligns the local+Zaxis withdirand store the result indest.If
Misthismatrix andLthe lookat matrix, then the new matrix will beM * L. So when transforming a vectorvwith the new matrix by usingM * L * v, the lookat transformation will be applied first!In order to set the matrix to a rotation transformation without post-multiplying it, use
rotationTowards().This method is equivalent to calling:
mul(new Matrix3d().lookAlong(-dirX, -dirY, -dirZ, upX, upY, upZ).invert(), dest)- Specified by:
rotateTowardsin interfaceMatrix3dc- Parameters:
dirX- the x-coordinate of the direction to rotate towardsdirY- the y-coordinate of the direction to rotate towardsdirZ- the z-coordinate of the direction to rotate towardsupX- the x-coordinate of the up vectorupY- the y-coordinate of the up vectorupZ- the z-coordinate of the up vectordest- will hold the result- Returns:
- dest
- See Also:
rotateTowards(Vector3dc, Vector3dc),rotationTowards(double, double, double, double, double, double)
-
rotationTowards
public Matrix3d rotationTowards(Vector3dc dir, Vector3dc up)
Set this matrix to a model transformation for a right-handed coordinate system, that aligns the local-zaxis withcenter - eye.In order to apply the rotation transformation to a previous existing transformation, use
rotateTowards.This method is equivalent to calling:
setLookAlong(new Vector3d(dir).negate(), up).invert()- Parameters:
dir- the direction to orient the local -z axis towardsup- the up vector- Returns:
- this
- See Also:
rotationTowards(Vector3dc, Vector3dc),rotateTowards(double, double, double, double, double, double)
-
rotationTowards
public Matrix3d rotationTowards(double dirX, double dirY, double dirZ, double upX, double upY, double upZ)
Set this matrix to a model transformation for a right-handed coordinate system, that aligns the local-zaxis withcenter - eye.In order to apply the rotation transformation to a previous existing transformation, use
rotateTowards.This method is equivalent to calling:
setLookAlong(-dirX, -dirY, -dirZ, upX, upY, upZ).invert()- Parameters:
dirX- the x-coordinate of the direction to rotate towardsdirY- the y-coordinate of the direction to rotate towardsdirZ- the z-coordinate of the direction to rotate towardsupX- the x-coordinate of the up vectorupY- the y-coordinate of the up vectorupZ- the z-coordinate of the up vector- Returns:
- this
- See Also:
rotateTowards(Vector3dc, Vector3dc),rotationTowards(double, double, double, double, double, double)
-
getEulerAnglesZYX
public Vector3d getEulerAnglesZYX(Vector3d dest)
Extract the Euler angles from the rotation represented bythismatrix and store the extracted Euler angles indest.This method assumes that
thismatrix only represents a rotation without scaling.Note that the returned Euler angles must be applied in the order
Z * Y * Xto obtain the identical matrix. This means that callingrotateZYX(double, double, double)using the obtained Euler angles will yield the same rotation as the original matrix from which the Euler angles were obtained, so in the below code the matrixm2should be identical tom(disregarding possible floating-point inaccuracies).Matrix3d m = ...; // <- matrix only representing rotation Matrix3d n = new Matrix3d(); n.rotateZYX(m.getEulerAnglesZYX(new Vector3d()));
Reference: http://nghiaho.com/
- Specified by:
getEulerAnglesZYXin interfaceMatrix3dc- Parameters:
dest- will hold the extracted Euler angles- Returns:
- dest
-
obliqueZ
public Matrix3d obliqueZ(double a, double b)
Apply an oblique projection transformation to this matrix with the given values foraandb.If
Misthismatrix andOthe oblique transformation matrix, then the new matrix will beM * O. So when transforming a vectorvwith the new matrix by usingM * O * v, the oblique transformation will be applied first!The oblique transformation is defined as:
x' = x + a*z y' = y + a*z z' = z
or in matrix form:1 0 a 0 1 b 0 0 1
- Parameters:
a- the value for the z factor that applies to xb- the value for the z factor that applies to y- Returns:
- this
-
obliqueZ
public Matrix3d obliqueZ(double a, double b, Matrix3d dest)
Apply an oblique projection transformation to this matrix with the given values foraandband store the result indest.If
Misthismatrix andOthe oblique transformation matrix, then the new matrix will beM * O. So when transforming a vectorvwith the new matrix by usingM * O * v, the oblique transformation will be applied first!The oblique transformation is defined as:
x' = x + a*z y' = y + a*z z' = z
or in matrix form:1 0 a 0 1 b 0 0 1
-
reflect
public Matrix3d reflect(double nx, double ny, double nz, Matrix3d dest)
Description copied from interface:Matrix3dcApply a mirror/reflection transformation to this matrix that reflects through the given plane specified via the plane normal(nx, ny, nz), and store the result indest.If
Misthismatrix andRthe reflection matrix, then the new matrix will beM * R. So when transforming a vectorvwith the new matrix by usingM * R * v, the reflection will be applied first!
-
reflect
public Matrix3d reflect(double nx, double ny, double nz)
Apply a mirror/reflection transformation to this matrix that reflects through the given plane specified via the plane normal.If
Misthismatrix andRthe reflection matrix, then the new matrix will beM * R. So when transforming a vectorvwith the new matrix by usingM * R * v, the reflection will be applied first!- Parameters:
nx- the x-coordinate of the plane normalny- the y-coordinate of the plane normalnz- the z-coordinate of the plane normal- Returns:
- this
-
reflect
public Matrix3d reflect(Vector3dc normal)
Apply a mirror/reflection transformation to this matrix that reflects through the given plane specified via the plane normal.If
Misthismatrix andRthe reflection matrix, then the new matrix will beM * R. So when transforming a vectorvwith the new matrix by usingM * R * v, the reflection will be applied first!- Parameters:
normal- the plane normal- Returns:
- this
-
reflect
public Matrix3d reflect(Quaterniondc orientation)
Apply a mirror/reflection transformation to this matrix that reflects about a plane specified via the plane orientation.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 givenQuaterniondcis the identity (does not apply any additional rotation), the reflection plane will bez=0.If
Misthismatrix andRthe reflection matrix, then the new matrix will beM * R. So when transforming a vectorvwith the new matrix by usingM * R * v, the reflection will be applied first!- Parameters:
orientation- the plane orientation- Returns:
- this
-
reflect
public Matrix3d reflect(Quaterniondc orientation, Matrix3d dest)
Description copied from interface:Matrix3dcApply a mirror/reflection transformation to this matrix that reflects through a plane specified via the plane orientation, and store the result indest.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 givenQuaterniondcis the identity (does not apply any additional rotation), the reflection plane will bez=0.If
Misthismatrix andRthe reflection matrix, then the new matrix will beM * R. So when transforming a vectorvwith the new matrix by usingM * R * v, the reflection will be applied first!
-
reflect
public Matrix3d reflect(Vector3dc normal, Matrix3d dest)
Description copied from interface:Matrix3dcApply a mirror/reflection transformation to this matrix that reflects through the given plane specified via the plane normal, and store the result indest.If
Misthismatrix andRthe reflection matrix, then the new matrix will beM * R. So when transforming a vectorvwith the new matrix by usingM * R * v, the reflection will be applied first!
-
reflection
public Matrix3d reflection(double nx, double ny, double nz)
Set this matrix to a mirror/reflection transformation that reflects through the given plane specified via the plane normal.- Parameters:
nx- the x-coordinate of the plane normalny- the y-coordinate of the plane normalnz- the z-coordinate of the plane normal- Returns:
- this
-
reflection
public Matrix3d reflection(Vector3dc normal)
Set this matrix to a mirror/reflection transformation that reflects through the given plane specified via the plane normal.- Parameters:
normal- the plane normal- Returns:
- this
-
reflection
public Matrix3d reflection(Quaterniondc orientation)
Set this matrix to a mirror/reflection transformation that reflects through a plane specified via the plane orientation.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 givenQuaterniondcis the identity (does not apply any additional rotation), the reflection plane will bez=0, offset by the givenpoint.- Parameters:
orientation- the plane orientation- Returns:
- this
-
isFinite
public boolean isFinite()
Description copied from interface:Matrix3dc
-
quadraticFormProduct
public double quadraticFormProduct(double x, double y, double z)Description copied from interface:Matrix3dcCompute(x, y, z)^T * this * (x, y, z).- Specified by:
quadraticFormProductin interfaceMatrix3dc- Parameters:
x- the x coordinate of the vector to multiplyy- the y coordinate of the vector to multiplyz- the z coordinate of the vector to multiply- Returns:
- the result
-
quadraticFormProduct
public double quadraticFormProduct(Vector3dc v)
Description copied from interface:Matrix3dcComputev^T * this * v.- Specified by:
quadraticFormProductin interfaceMatrix3dc- Parameters:
v- the vector to multiply- Returns:
- the result
-
quadraticFormProduct
public double quadraticFormProduct(Vector3fc v)
Description copied from interface:Matrix3dcComputev^T * this * v.- Specified by:
quadraticFormProductin interfaceMatrix3dc- Parameters:
v- the vector to multiply- Returns:
- the result
-
-