Class SbMatrixd
See SbMatrix
for discussion of storage layout and usage of matrices.
SbMatrix
, SbMatrix3
, SbRotation
, SbRotationd
, SbVec2d
, SbVec2f
, SbVec2i32
, SbVec2s
, SbVec3d
, SbVec3f
, SbVec3i32
, SbVec3s
, SbVec4b
, SbVec4d
, SbVec4f
, SbVec4i32
, SbVec4s
, SbVec4ub
, SbVec4ui32
, SbVec4us
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static class
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturn translation, rotation, scale, and scale orientation components of the matrix.Decomposes the matrix into a translation, rotation, scale, and scale orientation.double
det3()
Returns determinant of upper-left 3x3 submatrix.double
det3
(int r1, int r2, int r3, int c1, int c2, int c3) Returns determinant of 3x3 submatrix composed of given row and column indices (0-3 for each).double
det4()
Returns determinant of entire matrix.boolean
Equality comparison within given tolerance, for each component.boolean
factor()
Factors a matrix m into 5 pieces: m = r s r^ u t, where r^ means transpose of r, and r and u are rotations, s is a scale, and t is a translation.double[]
getValue()
double
getValueAt
(int index) static SbMatrixd
identity()
Returns an identity matrix.inverse()
Returns inverse of matrix.boolean
Returns true if the matrix is invertible.void
Sets matrix to be identity.multDirMatrix
(SbVec3d src) Pre-multiplies the matrix by the given row vector, giving vector result.void
Post-multiplies the matrix by the given matrix (equivalent tomultRight()
method).Pre-multiplies the matrix by given matrix.multLineMatrix
(SbLined src) Multiplies the given line's origin by the matrix, and the line's direction by the rotation portion of the matrix.multMatrixVec
(SbVec3d src) Post-multiplies matrix by given column vector, giving a 3D vector result.Post-multiplies the matrix by given matrix.multVec4Matrix
(SbVec3d src) Pre-multiplies matrix by the given row vector, giving vector result in homogeneous coordinates.multVecMatrix
(SbVec3d src) Pre-multiplies matrix by the given row vector, giving a 3D vector result.void
Scales this matrice by the given vector.void
Sets matrix to rotate by given rotation.void
setScale
(double s) Sets matrix to scale by given uniform factor.void
Sets matrix to scale by given vector.void
setTransform
(SbVec3d t, SbRotationd r, SbVec3d s) Composes the matrix based on a translation, rotation, and scale.void
setTransform
(SbVec3d t, SbRotationd r, SbVec3d s, SbRotationd so) Composes the matrix based on a translation, rotation, scale, and orientation for scale.void
setTransform
(SbVec3d translation, SbRotationd rotation, SbVec3d scaleFactor, SbRotationd scaleOrientation, SbVec3d center) Composes the matrix based on a translation, rotation, scale, orientation for scale, and center.void
Sets matrix to translate by given vector.setValue
(double[] components) setValue
(double[] components, int startIndex) setValue
(double c0, double c1, double c2, double c3, double c4, double c5, double c6, double c7, double c8, double c9, double c10, double c11, double c12, double c13, double c14, double c15) void
Sets values from a single precision matrix.void
void
setValueAt
(int index, double value) Multiplies two matrices, returning a matrix result.Multiply matrix by given vector.static SbMatrixd[]
toArray
(long nativeArray, long length) void
Translates this matrice by the given vector.Returns transpose of matrix.
-
Field Details
-
array
public final double[] array
-
-
Constructor Details
-
SbMatrixd
public SbMatrixd(double[] components) -
SbMatrixd
public SbMatrixd(double c0, double c1, double c2, double c3, double c4, double c5, double c6, double c7, double c8, double c9, double c10, double c11, double c12, double c13, double c14, double c15) -
SbMatrixd
-
SbMatrixd
public SbMatrixd()
-
-
Method Details
-
setValue
-
getValue
public double[] getValue() -
setValue
-
setValue
-
setValue
public SbMatrixd setValue(double c0, double c1, double c2, double c3, double c4, double c5, double c6, double c7, double c8, double c9, double c10, double c11, double c12, double c13, double c14, double c15) -
getValueAt
public double getValueAt(int index) -
setValueAt
public void setValueAt(int index, double value) -
setTransform
Composes the matrix based on a translation, rotation, and scale. A scale orientation value of (0,0,0,1) is used. The center point for scaling and rotation is (0,0,0). -
toArray
-
isInvertible
public boolean isInvertible()Returns true if the matrix is invertible. -
equals
Equality comparison within given tolerance, for each component. -
times
Multiplies two matrices, returning a matrix result. -
multiply
Post-multiplies the matrix by the given matrix (equivalent tomultRight()
method). Matrix is replaced by the resulting matrix. -
equals
-
identity
Returns an identity matrix. -
factor
Factors a matrix m into 5 pieces: m = r s r^ u t, where r^ means transpose of r, and r and u are rotations, s is a scale, and t is a translation. Any projection information is returned in proj. -
setScale
public void setScale(double s) Sets matrix to scale by given uniform factor. -
det4
public double det4()Returns determinant of entire matrix. -
inverse
Returns inverse of matrix. Results are undefined for singular matrices. Uses LU decomposition.
Matrix is not modified. -
scale
Scales this matrice by the given vector. -
translate
Translates this matrice by the given vector. -
setRotate
Sets matrix to rotate by given rotation. -
det3
public double det3()Returns determinant of upper-left 3x3 submatrix. -
decompose
Decomposes the matrix into a translation, rotation, scale, and scale orientation. Any projection information is discarded. The decomposition depends upon choice of center point for rotation and scaling, which is optional as the last parameter. Note that if the center is 0, decompose() is the same asfactor()
where t is translation, u is rotation, s is scaleFactor, and r is scaleOrientation. -
setTransform
Composes the matrix based on a translation, rotation, scale, and orientation for scale. The scaleOrientation chooses the primary axes for the scale. The center point for scaling and rotation is (0,0,0). -
setTransform
public void setTransform(SbVec3d translation, SbRotationd rotation, SbVec3d scaleFactor, SbRotationd scaleOrientation, SbVec3d center) Composes the matrix based on a translation, rotation, scale, orientation for scale, and center. The scaleOrientation chooses the primary axes for the scale. The center is the center point for scaling and rotation. -
setTranslate
Sets matrix to translate by given vector. -
setScale
Sets matrix to scale by given vector. -
det3
public double det3(int r1, int r2, int r3, int c1, int c2, int c3) Returns determinant of 3x3 submatrix composed of given row and column indices (0-3 for each). -
decompose
Return translation, rotation, scale, and scale orientation components of the matrix. -
multVec4Matrix
Pre-multiplies matrix by the given row vector, giving vector result in homogeneous coordinates. Use this method to transform a point (position vector).
UsemultDirMatrix()
to transform a normal (direction vector).- Parameters:
src
- the source vector to transformdst
- the destination vector to retrieve the result
-
multVecMatrix
Pre-multiplies matrix by the given row vector, giving a 3D vector result. The intermediate homogeneous (vec4) value is converted to 3D by dividing the X, Y and Z components by W.Use this method to transform a point (position vector).
UsemultDirMatrix()
to transform a normal (direction vector). -
multDirMatrix
Pre-multiplies the matrix by the given row vector, giving vector result. src is assumed to be a direction vector, so translation part of matrix is ignored.Note: If you need to transform surface points and normal vectors by a matrix, call
multVecMatrix()
for the points and callmultDirMatrix()
for the normals. Generally normals should be transformed by the inverse transpose of the matrix. However note that the inverse transpose is equal to the original matrix if the matrix is orthonormal, i.e. purely rotational with no scaling or shearing. -
times
Multiply matrix by given vector. Return m * v -
multLineMatrix
Multiplies the given line's origin by the matrix, and the line's direction by the rotation portion of the matrix. -
multMatrixVec
Post-multiplies matrix by given column vector, giving a 3D vector result. The intermediate homogeneous (vec4) value is converted to 3D by dividing the X, Y and Z components by W. -
makeIdentity
public void makeIdentity()Sets matrix to be identity. -
setValue
Sets values from a single precision matrix. -
multLeft
Pre-multiplies the matrix by given matrix. Matrix is replaced by the result. -
multRight
Post-multiplies the matrix by given matrix. Matrix is replaced by the result. -
transpose
Returns transpose of matrix. Matrix is not modified.
-