Module org.dyn4j

Class Matrix33


  • public class Matrix33
    extends java.lang.Object
    Represents a 3x3 Matrix.

    Used to solve 3x3 systems of equations.

    Since:
    1.0.0
    Version:
    3.4.0
    Author:
    William Bittle
    • Field Detail

      • m00

        public double m00
        The element at 0,0
      • m01

        public double m01
        The element at 0,1
      • m02

        public double m02
        The element at 0,2
      • m10

        public double m10
        The element at 1,0
      • m11

        public double m11
        The element at 1,1
      • m12

        public double m12
        The element at 1,2
      • m20

        public double m20
        The element at 2,0
      • m21

        public double m21
        The element at 2,1
      • m22

        public double m22
        The element at 2,2
    • Constructor Detail

      • Matrix33

        public Matrix33()
        Default constructor.
      • Matrix33

        public Matrix33​(double m00,
                        double m01,
                        double m02,
                        double m10,
                        double m11,
                        double m12,
                        double m20,
                        double m21,
                        double m22)
        Full constructor.
        Parameters:
        m00 - the element at 0,0
        m01 - the element at 0,1
        m02 - the element at 0,2
        m10 - the element at 1,0
        m11 - the element at 1,1
        m12 - the element at 1,2
        m20 - the element at 2,0
        m21 - the element at 2,1
        m22 - the element at 2,2
      • Matrix33

        public Matrix33​(Matrix33 matrix)
        Copy constructor.
        Parameters:
        matrix - the Matrix33 to copy
    • Method Detail

      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

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

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • multiply

        public Matrix33 multiply​(double scalar)
        Multiplies this Matrix33 by the given scalar and places the result in this Matrix33.
         this = this * scalar
         
        Parameters:
        scalar - the scalar to multiply by
        Returns:
        Matrix33 this matrix
      • product

        public Matrix33 product​(double scalar)
        Multiplies this Matrix33 by the given scalar returning a new Matrix33 containing the result.
         r = this * scalar
         
        Parameters:
        scalar - the scalar to multiply by
        Returns:
        Matrix33 a new matrix containing the result
      • getTranspose

        public Matrix33 getTranspose()
        Returns the the transpose of this Matrix33 in a new Matrix33.
        Returns:
        Matrix33 a new matrix contianing the transpose
      • determinant

        public double determinant()
        Returns the determinant of this Matrix33.
        Returns:
        double
      • getInverse

        public Matrix33 getInverse()
        Returns a new Matrix33 containing the inverse of this Matrix33.
        Returns:
        Matrix33 a new matrix containing the result
      • solve33

        public Vector3 solve33​(Vector3 b)
        Solves the system of linear equations:

        Ax = b Multiply by A-1 on both sides x = A-1b

        Parameters:
        b - the b Vector3
        Returns:
        Vector3 the x vector
      • solve22

        public Vector2 solve22​(Vector2 b)
        Solves the system of linear equations:

        Ax = b Multiply by A-1 on both sides x = A-1b

        Parameters:
        b - the b Vector2
        Returns:
        Vector2 the x vector