Class SbMatrixd

    • Field Detail

      • array

        public final double[] array
    • Constructor Detail

      • 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

        public SbMatrixd​(SbMatrixd copyFrom)
      • SbMatrixd

        public SbMatrixd​(double[] components)
      • SbMatrixd

        public SbMatrixd()
    • Method Detail

      • setValue

        public SbMatrixd setValue​(double[] components)
      • getValue

        public double[] getValue()
      • setValue

        public void setValue​(SbMatrixd copyFrom)
      • setValue

        public SbMatrixd setValue​(double[] components,
                                  int startIndex)
      • 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)
      • setValueAt

        public void setValueAt​(int index,
                               double value)
      • getValueAt

        public double getValueAt​(int index)
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • translate

        public void translate​(SbVec3d translation)
        Translates this matrice by the given vector.
      • equals

        public boolean equals​(SbMatrixd m,
                              double tolerance)
        Equality comparison within given tolerance, for each component.
      • identity

        public static SbMatrixd identity()
        Returns an identity matrix.
      • multiply

        public void multiply​(SbMatrixd m)
        Post-multiplies the matrix by the given matrix (equivalent to multRight() method). Matrix is replaced by the resulting matrix.
      • toArray

        public static SbMatrixd[] toArray​(long nativeArray,
                                          long length)
      • isInvertible

        public boolean isInvertible()
        Returns true if the matrix is invertible.
      • times

        public SbMatrixd times​(SbMatrixd m2)
        Multiplies two matrices, returning a matrix result.
      • 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.
      • setTransform

        public void setTransform​(SbVec3d t,
                                 SbRotationd r,
                                 SbVec3d s)
        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).
      • setTransform

        public void setTransform​(SbVec3d t,
                                 SbRotationd r,
                                 SbVec3d s,
                                 SbRotationd so)
        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).
      • scale

        public void scale​(SbVec3d scaleFactor)
        Scales this matrice by the given vector.
      • setScale

        public void setScale​(SbVec3d s)
        Sets matrix to scale by given vector.
      • setTranslate

        public void setTranslate​(SbVec3d t)
        Sets matrix to translate by given vector.
      • det4

        public double det4()
        Returns determinant of entire matrix.
      • det3

        public double det3()
        Returns determinant of upper-left 3x3 submatrix.
      • 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

        public SbMatrixd.Decomposition decompose()
        Return translation, rotation, scale, and scale orientation components of the matrix.
      • inverse

        public SbMatrixd inverse()
        Returns inverse of matrix. Results are undefined for singular matrices. Uses LU decomposition.
        Matrix is not modified.
      • decompose

        public SbMatrixd.Decomposition decompose​(SbVec3d center)
        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 as factor() where t is translation, u is rotation, s is scaleFactor, and r is scaleOrientation.
      • factor

        public SbMatrixd.Factorization 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.
      • multDirMatrix

        public SbVec3d multDirMatrix​(SbVec3d src)
        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 call multDirMatrix() 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.

      • multVecMatrix

        public SbVec3d multVecMatrix​(SbVec3d src)
        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).
        Use multDirMatrix() to transform a normal (direction vector).

      • multMatrixVec

        public SbVec3d multMatrixVec​(SbVec3d src)
        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.
      • multLineMatrix

        public SbLined multLineMatrix​(SbLined src)
        Multiplies the given line's origin by the matrix, and the line's direction by the rotation portion of the matrix.
      • times

        public SbVec4d times​(SbVec4d v)
        Multiply matrix by given vector. Return m * v
      • setRotate

        public void setRotate​(SbRotationd q)
        Sets matrix to rotate by given rotation.
      • transpose

        public SbMatrixd transpose()
        Returns transpose of matrix. Matrix is not modified.
      • setScale

        public void setScale​(double s)
        Sets matrix to scale by given uniform factor.
      • multRight

        public SbMatrixd multRight​(SbMatrixd m)
        Post-multiplies the matrix by given matrix. Matrix is replaced by the result.
      • setValue

        public void setValue​(SbMatrix m)
        Sets values from a single precision matrix.
      • multLeft

        public SbMatrixd multLeft​(SbMatrixd m)
        Pre-multiplies the matrix by given matrix. Matrix is replaced by the result.
      • makeIdentity

        public void makeIdentity()
        Sets matrix to be identity.