Package org.joml

Class Matrix3x2d

  • All Implemented Interfaces:
    java.io.Externalizable, java.io.Serializable, java.lang.Cloneable, Matrix3x2dc
    Direct Known Subclasses:
    Matrix3x2dStack

    public class Matrix3x2d
    extends java.lang.Object
    implements Matrix3x2dc, java.lang.Cloneable, java.io.Externalizable
    Contains the definition of a 3x2 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

    Author:
    Kai Burjack
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      double m00  
      double m01  
      double m10  
      double m11  
      double m20  
      double m21  
    • Constructor Summary

      Constructors 
      Constructor Description
      Matrix3x2d()
      Create a new Matrix3x2d and set it to identity.
      Matrix3x2d​(double m00, double m01, double m10, double m11, double m20, double m21)
      Create a new 3x2 matrix using the supplied double values.
      Matrix3x2d​(java.nio.DoubleBuffer buffer)
      Create a new Matrix3x2d by reading its 6 double components from the given DoubleBuffer at the buffer's current position.
      Matrix3x2d​(Matrix2dc mat)
      Create a new Matrix3x2d by setting its left 2x2 submatrix to the values of the given Matrix2dc and the rest to identity.
      Matrix3x2d​(Matrix2fc mat)
      Create a new Matrix3x2d by setting its left 2x2 submatrix to the values of the given Matrix2fc and the rest to identity.
      Matrix3x2d​(Matrix3x2dc mat)
      Create a new Matrix3x2d and make it a copy of the given matrix.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object clone()  
      double determinant()
      Return the determinant of this matrix.
      boolean equals​(java.lang.Object obj)  
      boolean equals​(Matrix3x2dc m, double delta)
      Compare the matrix elements of this matrix with the given matrix using the given delta and return whether all of them are equal within a maximum difference of delta.
      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.
      java.nio.ByteBuffer get​(int index, java.nio.ByteBuffer buffer)
      Store this matrix in column-major order into the supplied ByteBuffer starting at the specified absolute buffer position/index.
      java.nio.DoubleBuffer get​(int index, java.nio.DoubleBuffer buffer)
      Store this matrix in column-major order into the supplied DoubleBuffer starting at the specified absolute buffer position/index.
      java.nio.ByteBuffer get​(java.nio.ByteBuffer buffer)
      Store this matrix in column-major order into the supplied ByteBuffer at the current buffer position.
      java.nio.DoubleBuffer get​(java.nio.DoubleBuffer buffer)
      Store this matrix in column-major order into the supplied DoubleBuffer at the current buffer position.
      Matrix3x2d get​(Matrix3x2d dest)
      Get the current values of this matrix and store them into dest.
      double[] get3x3​(double[] arr)
      Store this matrix as an equivalent 3x3 matrix in column-major order into the supplied float array.
      double[] get3x3​(double[] arr, int offset)
      Store this matrix as an equivalent 3x3 matrix in column-major order into the supplied float array at the given offset.
      java.nio.ByteBuffer get3x3​(int index, java.nio.ByteBuffer buffer)
      Store this matrix as an equivalent 3x3 matrix in column-major order into the supplied ByteBuffer starting at the specified absolute buffer position/index.
      java.nio.DoubleBuffer get3x3​(int index, java.nio.DoubleBuffer buffer)
      Store this matrix as an equivalent 3x3 matrix in column-major order into the supplied DoubleBuffer starting at the specified absolute buffer position/index.
      java.nio.ByteBuffer get3x3​(java.nio.ByteBuffer buffer)
      Store this matrix as an equivalent 3x3 matrix in column-major order into the supplied ByteBuffer at the current buffer position.
      java.nio.DoubleBuffer get3x3​(java.nio.DoubleBuffer buffer)
      Store this matrix as an equivalent 4x4 matrix in column-major order into the supplied DoubleBuffer at the current buffer position.
      double[] get4x4​(double[] arr)
      Store this matrix as an equivalent 4x4 matrix in column-major order into the supplied float array.
      double[] get4x4​(double[] arr, int offset)
      Store this matrix as an equivalent 4x4 matrix in column-major order into the supplied float array at the given offset.
      java.nio.ByteBuffer get4x4​(int index, java.nio.ByteBuffer buffer)
      Store this matrix as an equivalent 4x4 matrix in column-major order into the supplied ByteBuffer starting at the specified absolute buffer position/index.
      java.nio.DoubleBuffer get4x4​(int index, java.nio.DoubleBuffer buffer)
      Store this matrix as an equivalent 4x4 matrix in column-major order into the supplied DoubleBuffer starting at the specified absolute buffer position/index.
      java.nio.ByteBuffer get4x4​(java.nio.ByteBuffer buffer)
      Store this matrix as an equivalent 4x4 matrix in column-major order into the supplied ByteBuffer at the current buffer position.
      java.nio.DoubleBuffer get4x4​(java.nio.DoubleBuffer buffer)
      Store this matrix as an equivalent 4x4 matrix in column-major order into the supplied DoubleBuffer at the current buffer position.
      Matrix3x2dc getToAddress​(long address)
      Store this matrix in column-major order at the given off-heap address.
      java.nio.ByteBuffer getTransposed​(int index, java.nio.ByteBuffer buffer)
      Store this matrix in row-major order into the supplied ByteBuffer starting at the specified absolute buffer position/index.
      java.nio.DoubleBuffer getTransposed​(int index, java.nio.DoubleBuffer buffer)
      Store this matrix in row-major order into the supplied DoubleBuffer starting at the specified absolute buffer position/index.
      java.nio.FloatBuffer getTransposed​(int index, java.nio.FloatBuffer buffer)
      Store this matrix in row-major order into the supplied FloatBuffer starting at the specified absolute buffer position/index.
      java.nio.ByteBuffer getTransposed​(java.nio.ByteBuffer buffer)
      Store this matrix in row-major order into the supplied ByteBuffer at the current buffer position.
      java.nio.DoubleBuffer getTransposed​(java.nio.DoubleBuffer buffer)
      Store this matrix in row-major order into the supplied DoubleBuffer at the current buffer position.
      java.nio.FloatBuffer getTransposed​(java.nio.FloatBuffer buffer)
      Store this matrix in row-major order into the supplied FloatBuffer at the current buffer position.
      java.nio.ByteBuffer getTransposedFloats​(int index, java.nio.ByteBuffer buffer)
      Store this matrix in row-major order into the supplied ByteBuffer starting at the specified absolute buffer position/index.
      java.nio.ByteBuffer getTransposedFloats​(java.nio.ByteBuffer buffer)
      Store this matrix as float values in row-major order into the supplied ByteBuffer at the current buffer position.
      int hashCode()  
      Matrix3x2d identity()
      Set this matrix to the identity.
      Matrix3x2d invert()
      Invert this matrix by assuming a third row in this matrix of (0, 0, 1).
      Matrix3x2d invert​(Matrix3x2d dest)
      Invert the this matrix by assuming a third row in this matrix of (0, 0, 1) and store the result in dest.
      boolean isFinite()
      Determine whether all matrix elements are finite floating-point values, that is, they are not NaN and not infinity.
      double m00()
      Return the value of the matrix element at column 0 and row 0.
      double m01()
      Return the value of the matrix element at column 0 and row 1.
      double m10()
      Return the value of the matrix element at column 1 and row 0.
      double m11()
      Return the value of the matrix element at column 1 and row 1.
      double m20()
      Return the value of the matrix element at column 2 and row 0.
      double m21()
      Return the value of the matrix element at column 2 and row 1.
      Matrix3x2d mul​(Matrix3x2dc right)
      Multiply this matrix by the supplied right matrix by assuming a third row in both matrices of (0, 0, 1).
      Matrix3x2d mul​(Matrix3x2dc right, Matrix3x2d dest)
      Multiply this matrix by the supplied right matrix by assuming a third row in both matrices of (0, 0, 1) and store the result in dest.
      Matrix3x2d mulLocal​(Matrix3x2dc left)
      Pre-multiply this matrix by the supplied left matrix and store the result in this.
      Matrix3x2d mulLocal​(Matrix3x2dc left, Matrix3x2d dest)
      Pre-multiply this matrix by the supplied left matrix and store the result in dest.
      Vector2d normalizedPositiveX​(Vector2d dir)
      Obtain the direction of +X before the transformation represented by this orthogonal matrix is applied.
      Vector2d normalizedPositiveY​(Vector2d dir)
      Obtain the direction of +Y before the transformation represented by this orthogonal matrix is applied.
      Vector2d origin​(Vector2d origin)
      Obtain the position that gets transformed to the origin by this matrix.
      Vector2d positiveX​(Vector2d dir)
      Obtain the direction of +X before the transformation represented by this matrix is applied.
      Vector2d positiveY​(Vector2d dir)
      Obtain the direction of +Y before the transformation represented by this matrix is applied.
      void readExternal​(java.io.ObjectInput in)  
      Matrix3x2d rotate​(double ang)
      Apply a rotation transformation to this matrix by rotating the given amount of radians.
      Matrix3x2d rotate​(double ang, Matrix3x2d dest)
      Apply a rotation transformation to this matrix by rotating the given amount of radians and store the result in dest.
      Matrix3x2d rotateAbout​(double ang, double x, double y)
      Apply a rotation transformation to this matrix by rotating the given amount of radians about the specified rotation center (x, y).
      Matrix3x2d rotateAbout​(double ang, double x, double y, Matrix3x2d dest)
      Apply a rotation transformation to this matrix by rotating the given amount of radians about the specified rotation center (x, y) and store the result in dest.
      Matrix3x2d rotateLocal​(double ang)
      Pre-multiply a rotation to this matrix by rotating the given amount of radians.
      Matrix3x2d rotateLocal​(double ang, Matrix3x2d dest)
      Pre-multiply a rotation to this matrix by rotating the given amount of radians and store the result in dest.
      Matrix3x2d rotateTo​(Vector2dc fromDir, Vector2dc toDir)
      Apply a rotation transformation to this matrix that rotates the given normalized fromDir direction vector to point along the normalized toDir.
      Matrix3x2d rotateTo​(Vector2dc fromDir, Vector2dc toDir, Matrix3x2d dest)
      Apply a rotation transformation to this matrix that rotates the given normalized fromDir direction vector to point along the normalized toDir, and store the result in dest.
      Matrix3x2d rotation​(double angle)
      Set this matrix to a rotation matrix which rotates the given radians.
      Matrix3x2d scale​(double xy)
      Apply scaling to this matrix by uniformly scaling the two base axes by the given xyz factor.
      Matrix3x2d scale​(double x, double y)
      Apply scaling to this matrix by scaling the base axes by the given x and y factors.
      Matrix3x2d scale​(double x, double y, Matrix3x2d dest)
      Apply scaling to this matrix by scaling the unit axes by the given x and y and store the result in dest.
      Matrix3x2d scale​(double xy, Matrix3x2d dest)
      Apply scaling to this matrix by uniformly scaling the two base axes by the given xy factor and store the result in dest.
      Matrix3x2d scale​(Vector2dc xy)
      Apply scaling to this matrix by scaling the base axes by the given xy factors.
      Matrix3x2d scale​(Vector2dc xy, Matrix3x2d dest)
      Apply scaling to this matrix by scaling the base axes by the given xy factors and store the result in dest.
      Matrix3x2d scale​(Vector2fc xy)
      Apply scaling to this matrix by scaling the base axes by the given xy factors.
      Matrix3x2d scale​(Vector2fc xy, Matrix3x2d dest)
      Apply scaling to this matrix by scaling the base axes by the given xy factors and store the result in dest.
      Matrix3x2d scaleAround​(double factor, double ox, double oy)
      Apply scaling to this matrix by scaling the base axes by the given factor while using (ox, oy) as the scaling origin.
      Matrix3x2d scaleAround​(double sx, double sy, double ox, double oy)
      Apply scaling to this matrix by scaling the base axes by the given sx and sy factors while using (ox, oy) as the scaling origin.
      Matrix3x2d scaleAround​(double sx, double sy, double ox, double oy, Matrix3x2d dest)
      Apply scaling to this matrix by scaling the base axes by the given sx and sy factors while using (ox, oy) as the scaling origin, and store the result in dest.
      Matrix3x2d scaleAround​(double factor, double ox, double oy, Matrix3x2d dest)
      Apply scaling to this matrix by scaling the base axes by the given factor while using (ox, oy) as the scaling origin, and store the result in dest.
      Matrix3x2d scaleAroundLocal​(double factor, double ox, double oy)
      Pre-multiply scaling to this matrix by scaling the base axes by the given factor while using (ox, oy) as the scaling origin.
      Matrix3x2d scaleAroundLocal​(double sx, double sy, double sz, double ox, double oy, double oz)
      Pre-multiply scaling to this matrix by scaling the base axes by the given sx and sy factors while using (ox, oy) as the scaling origin.
      Matrix3x2d scaleAroundLocal​(double sx, double sy, double ox, double oy, Matrix3x2d dest)
      Pre-multiply scaling to this matrix by scaling the base axes by the given sx and sy factors while using the given (ox, oy) as the scaling origin, and store the result in dest.
      Matrix3x2d scaleAroundLocal​(double factor, double ox, double oy, Matrix3x2d dest)
      Pre-multiply scaling to this matrix by scaling the base axes by the given factor while using (ox, oy) as the scaling origin, and store the result in dest.
      Matrix3x2d scaleLocal​(double xy)
      Pre-multiply scaling to this matrix by scaling the base axes by the given xy factor.
      Matrix3x2d scaleLocal​(double x, double y)
      Pre-multiply scaling to this matrix by scaling the base axes by the given x and y factors.
      Matrix3x2d scaleLocal​(double x, double y, Matrix3x2d dest)
      Pre-multiply scaling to this matrix by scaling the base axes by the given x and y factors and store the result in dest.
      Matrix3x2d scaleLocal​(double xy, Matrix3x2d dest)
      Pre-multiply scaling to this matrix by scaling the two base axes by the given xy factor, and store the result in dest.
      Matrix3x2d scaling​(double factor)
      Set this matrix to be a simple scale matrix, which scales the two base axes uniformly by the given factor.
      Matrix3x2d scaling​(double x, double y)
      Set this matrix to be a simple scale matrix.
      Matrix3x2d set​(double[] m)
      Set the values in this matrix based on the supplied double array.
      Matrix3x2d set​(double m00, double m01, double m10, double m11, double m20, double m21)
      Set the values within this matrix to the supplied double values.
      Matrix3x2d set​(int index, java.nio.ByteBuffer buffer)
      Set the values of this matrix by reading 6 double values from the given ByteBuffer in column-major order, starting at the specified absolute buffer position/index.
      Matrix3x2d set​(int index, java.nio.DoubleBuffer buffer)
      Set the values of this matrix by reading 6 double values from the given DoubleBuffer in column-major order, starting at the specified absolute buffer position/index.
      Matrix3x2d set​(java.nio.ByteBuffer buffer)
      Set the values of this matrix by reading 6 double values from the given ByteBuffer in column-major order, starting at its current position.
      Matrix3x2d set​(java.nio.DoubleBuffer buffer)
      Set the values of this matrix by reading 6 double values from the given DoubleBuffer in column-major order, starting at its current position.
      Matrix3x2d set​(Matrix2dc m)
      Set the left 2x2 submatrix of this Matrix3x2d to the given Matrix2dc and don't change the other elements.
      Matrix3x2d set​(Matrix2fc m)
      Set the left 2x2 submatrix of this Matrix3x2d to the given Matrix2fc and don't change the other elements.
      Matrix3x2d set​(Matrix3x2dc m)
      Set the elements of this matrix to the ones in m.
      Matrix3x2d setFromAddress​(long address)
      Set the values of this matrix by reading 6 double values from off-heap memory in column-major order, starting at the given address.
      Matrix3x2d setTranslation​(double x, double y)
      Set only the translation components of this matrix (m20, m21) to the given values (x, y).
      Matrix3x2d setTranslation​(Vector2dc offset)
      Set only the translation components of this matrix (m20, m21) to the given values (offset.x, offset.y).
      Matrix3x2d setView​(double left, double right, double bottom, double top)
      Set this matrix to define a "view" transformation that maps the given (left, bottom) and (right, top) corners to (-1, -1) and (1, 1) respectively.
      Matrix3x2d span​(Vector2d corner, Vector2d xDir, Vector2d yDir)
      Compute the extents of the coordinate system before this transformation was applied and store the resulting corner coordinates in corner and the span vectors in xDir and yDir.
      boolean testAar​(double minX, double minY, double maxX, double maxY)
      Test whether the given axis-aligned rectangle is partly or completely within or outside of the frustum defined by this matrix.
      boolean testCircle​(double x, double y, double r)
      Test whether the given circle is partly or completely within or outside of the frustum defined by this matrix.
      boolean testPoint​(double x, double y)
      Test whether the given point (x, y) is within the frustum defined by this matrix.
      java.lang.String toString()
      Return a string representation of this matrix.
      java.lang.String toString​(java.text.NumberFormat formatter)
      Return a string representation of this matrix by formatting the matrix elements with the given NumberFormat.
      Vector3d transform​(double x, double y, double z, Vector3d dest)
      Transform/multiply the given vector (x, y, z) by this matrix and store the result in dest.
      Vector3d transform​(Vector3d v)
      Transform/multiply the given vector by this matrix by assuming a third row in this matrix of (0, 0, 1) and store the result in that vector.
      Vector3d transform​(Vector3dc v, Vector3d dest)
      Transform/multiply the given vector by this matrix by assuming a third row in this matrix of (0, 0, 1) and store the result in dest.
      Vector2d transformDirection​(double x, double y, Vector2d dest)
      Transform/multiply the given 2D-vector (x, y), as if it was a 3D-vector with z=0, by this matrix and store the result in dest.
      Vector2d transformDirection​(Vector2d v)
      Transform/multiply the given 2D-vector, as if it was a 3D-vector with z=0, by this matrix and store the result in that vector.
      Vector2d transformDirection​(Vector2dc v, Vector2d dest)
      Transform/multiply the given 2D-vector, as if it was a 3D-vector with z=0, by this matrix and store the result in dest.
      Vector2d transformPosition​(double x, double y, Vector2d dest)
      Transform/multiply the given 2D-vector (x, y), as if it was a 3D-vector with z=1, by this matrix and store the result in dest.
      Vector2d transformPosition​(Vector2d v)
      Transform/multiply the given 2D-vector, as if it was a 3D-vector with z=1, by this matrix and store the result in that vector.
      Vector2d transformPosition​(Vector2dc v, Vector2d dest)
      Transform/multiply the given 2D-vector, as if it was a 3D-vector with z=1, by this matrix and store the result in dest.
      Matrix3x2d translate​(double x, double y)
      Apply a translation to this matrix by translating by the given number of units in x and y.
      Matrix3x2d translate​(double x, double y, Matrix3x2d dest)
      Apply a translation to this matrix by translating by the given number of units in x and y and store the result in dest.
      Matrix3x2d translate​(Vector2dc offset)
      Apply a translation to this matrix by translating by the given number of units in x and y.
      Matrix3x2d translate​(Vector2dc offset, Matrix3x2d dest)
      Apply a translation to this matrix by translating by the given number of units in x and y, and store the result in dest.
      Matrix3x2d translateLocal​(double x, double y)
      Pre-multiply a translation to this matrix by translating by the given number of units in x and y.
      Matrix3x2d translateLocal​(double x, double y, Matrix3x2d dest)
      Pre-multiply a translation to this matrix by translating by the given number of units in x and y and store the result in dest.
      Matrix3x2d translateLocal​(Vector2dc offset)
      Pre-multiply a translation to this matrix by translating by the given number of units in x and y.
      Matrix3x2d translateLocal​(Vector2dc offset, Matrix3x2d dest)
      Pre-multiply a translation to this matrix by translating by the given number of units in x and y and store the result in dest.
      Matrix3x2d translation​(double x, double y)
      Set this matrix to be a simple translation matrix in a two-dimensional coordinate system.
      Matrix3x2d translation​(Vector2dc offset)
      Set this matrix to be a simple translation matrix in a two-dimensional coordinate system.
      Vector2d unproject​(double winX, double winY, int[] viewport, Vector2d dest)
      Unproject the given window coordinates (winX, winY) by this matrix using the specified viewport.
      Vector2d unprojectInv​(double winX, double winY, int[] viewport, Vector2d dest)
      Unproject the given window coordinates (winX, winY) by this matrix using the specified viewport.
      Matrix3x2d view​(double left, double right, double bottom, double top)
      Apply a "view" transformation to this matrix that maps the given (left, bottom) and (right, top) corners to (-1, -1) and (1, 1) respectively.
      Matrix3x2d view​(double left, double right, double bottom, double top, Matrix3x2d dest)
      Apply a "view" transformation to this matrix that maps the given (left, bottom) and (right, top) corners to (-1, -1) and (1, 1) respectively and store the result in dest.
      double[] viewArea​(double[] area)
      Obtain the extents of the view transformation of this matrix and store it in area.
      void writeExternal​(java.io.ObjectOutput out)  
      Matrix3x2d zero()
      Set all values within this matrix to zero.
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • m00

        public double m00
      • m01

        public double m01
      • m10

        public double m10
      • m11

        public double m11
      • m20

        public double m20
      • m21

        public double m21
    • Constructor Detail

      • Matrix3x2d

        public Matrix3x2d​(Matrix2dc mat)
        Create a new Matrix3x2d by setting its left 2x2 submatrix to the values of the given Matrix2dc and the rest to identity.
        Parameters:
        mat - the Matrix2dc
      • Matrix3x2d

        public Matrix3x2d​(Matrix2fc mat)
        Create a new Matrix3x2d by setting its left 2x2 submatrix to the values of the given Matrix2fc and the rest to identity.
        Parameters:
        mat - the Matrix2fc
      • Matrix3x2d

        public Matrix3x2d​(Matrix3x2dc mat)
        Create a new Matrix3x2d and make it a copy of the given matrix.
        Parameters:
        mat - the Matrix3x2dc to copy the values from
      • Matrix3x2d

        public Matrix3x2d​(double m00,
                          double m01,
                          double m10,
                          double m11,
                          double m20,
                          double m21)
        Create a new 3x2 matrix using the supplied double values. The order of the parameter is column-major, so the first two parameters specify the two elements of the first column.
        Parameters:
        m00 - the value of m00
        m01 - the value of m01
        m10 - the value of m10
        m11 - the value of m11
        m20 - the value of m20
        m21 - the value of m21
      • Matrix3x2d

        public Matrix3x2d​(java.nio.DoubleBuffer buffer)
        Create a new Matrix3x2d by reading its 6 double components from the given DoubleBuffer at 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 - the DoubleBuffer to read the matrix values from
    • Method Detail

      • m00

        public double m00()
        Description copied from interface: Matrix3x2dc
        Return the value of the matrix element at column 0 and row 0.
        Specified by:
        m00 in interface Matrix3x2dc
        Returns:
        the value of the matrix element
      • m01

        public double m01()
        Description copied from interface: Matrix3x2dc
        Return the value of the matrix element at column 0 and row 1.
        Specified by:
        m01 in interface Matrix3x2dc
        Returns:
        the value of the matrix element
      • m10

        public double m10()
        Description copied from interface: Matrix3x2dc
        Return the value of the matrix element at column 1 and row 0.
        Specified by:
        m10 in interface Matrix3x2dc
        Returns:
        the value of the matrix element
      • m11

        public double m11()
        Description copied from interface: Matrix3x2dc
        Return the value of the matrix element at column 1 and row 1.
        Specified by:
        m11 in interface Matrix3x2dc
        Returns:
        the value of the matrix element
      • m20

        public double m20()
        Description copied from interface: Matrix3x2dc
        Return the value of the matrix element at column 2 and row 0.
        Specified by:
        m20 in interface Matrix3x2dc
        Returns:
        the value of the matrix element
      • m21

        public double m21()
        Description copied from interface: Matrix3x2dc
        Return the value of the matrix element at column 2 and row 1.
        Specified by:
        m21 in interface Matrix3x2dc
        Returns:
        the value of the matrix element
      • set

        public Matrix3x2d set​(Matrix3x2dc m)
        Set the elements of this matrix to the ones in m.
        Parameters:
        m - the matrix to copy the elements from
        Returns:
        this
      • set

        public Matrix3x2d set​(Matrix2dc m)
        Set the left 2x2 submatrix of this Matrix3x2d to the given Matrix2dc and don't change the other elements.
        Parameters:
        m - the 2x2 matrix
        Returns:
        this
      • set

        public Matrix3x2d set​(Matrix2fc m)
        Set the left 2x2 submatrix of this Matrix3x2d to the given Matrix2fc and don't change the other elements.
        Parameters:
        m - the 2x2 matrix
        Returns:
        this
      • mul

        public Matrix3x2d mul​(Matrix3x2dc right)
        Multiply this matrix by the supplied right matrix by assuming a third row in both matrices of (0, 0, 1).

        If M is this matrix and R the right matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v, the transformation of the right matrix will be applied first!

        Parameters:
        right - the right operand of the matrix multiplication
        Returns:
        this
      • mul

        public Matrix3x2d mul​(Matrix3x2dc right,
                              Matrix3x2d dest)
        Multiply this matrix by the supplied right matrix by assuming a third row in both matrices of (0, 0, 1) and store the result in dest.

        If M is this matrix and R the right matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v, the transformation of the right matrix will be applied first!

        Specified by:
        mul in interface Matrix3x2dc
        Parameters:
        right - the right operand of the matrix multiplication
        dest - will hold the result
        Returns:
        dest
      • mulLocal

        public Matrix3x2d mulLocal​(Matrix3x2dc left)
        Pre-multiply this matrix by the supplied left matrix and store the result in this.

        If M is this matrix and L the left matrix, then the new matrix will be L * M. So when transforming a vector v with the new matrix by using L * M * v, the transformation of this matrix will be applied first!

        Parameters:
        left - the left operand of the matrix multiplication
        Returns:
        this
      • mulLocal

        public Matrix3x2d mulLocal​(Matrix3x2dc left,
                                   Matrix3x2d dest)
        Description copied from interface: Matrix3x2dc
        Pre-multiply this matrix by the supplied left matrix and store the result in dest.

        If M is this matrix and L the left matrix, then the new matrix will be L * M. So when transforming a vector v with the new matrix by using L * M * v, the transformation of this matrix will be applied first!

        Specified by:
        mulLocal in interface Matrix3x2dc
        Parameters:
        left - the left operand of the matrix multiplication
        dest - the destination matrix, which will hold the result
        Returns:
        dest
      • set

        public Matrix3x2d set​(double m00,
                              double m01,
                              double m10,
                              double m11,
                              double m20,
                              double m21)
        Set the values within this matrix to the supplied double values. The result looks like this:

        m00, m10, m20
        m01, m11, m21

        Parameters:
        m00 - the new value of m00
        m01 - the new value of m01
        m10 - the new value of m10
        m11 - the new value of m11
        m20 - the new value of m20
        m21 - the new value of m21
        Returns:
        this
      • set

        public Matrix3x2d set​(double[] m)
        Set the values in this matrix based on the supplied double array. The result looks like this:

        0, 2, 4
        1, 3, 5
        This method only uses the first 6 values, all others are ignored.

        Parameters:
        m - the array to read the matrix values from
        Returns:
        this
      • determinant

        public double determinant()
        Return the determinant of this matrix.
        Specified by:
        determinant in interface Matrix3x2dc
        Returns:
        the determinant
      • invert

        public Matrix3x2d invert()
        Invert this matrix by assuming a third row in this matrix of (0, 0, 1).
        Returns:
        this
      • invert

        public Matrix3x2d invert​(Matrix3x2d dest)
        Invert the this matrix by assuming a third row in this matrix of (0, 0, 1) and store the result in dest.
        Specified by:
        invert in interface Matrix3x2dc
        Parameters:
        dest - will hold the result
        Returns:
        dest
      • translation

        public Matrix3x2d translation​(double x,
                                      double y)
        Set this matrix to be a simple translation matrix in a two-dimensional coordinate system.

        The resulting matrix can be multiplied against another transformation matrix to obtain an additional translation.

        In order to apply a translation via to an already existing transformation matrix, use translate() instead.

        Parameters:
        x - the units to translate in x
        y - the units to translate in y
        Returns:
        this
        See Also:
        translate(double, double)
      • translation

        public Matrix3x2d translation​(Vector2dc offset)
        Set this matrix to be a simple translation matrix in a two-dimensional coordinate system.

        The resulting matrix can be multiplied against another transformation matrix to obtain an additional translation.

        In order to apply a translation via to an already existing transformation matrix, use translate() instead.

        Parameters:
        offset - the translation
        Returns:
        this
        See Also:
        translate(Vector2dc)
      • translate

        public Matrix3x2d translate​(double x,
                                    double y,
                                    Matrix3x2d dest)
        Apply a translation to this matrix by translating by the given number of units in x and y and store the result in dest.

        If M is this matrix and T the translation matrix, then the new matrix will be M * T. So when transforming a vector v with the new matrix by using M * T * v, the translation will be applied first!

        In order to set the matrix to a translation transformation without post-multiplying it, use translation(double, double).

        Specified by:
        translate in interface Matrix3x2dc
        Parameters:
        x - the offset to translate in x
        y - the offset to translate in y
        dest - will hold the result
        Returns:
        dest
        See Also:
        translation(double, double)
      • translate

        public Matrix3x2d translate​(double x,
                                    double y)
        Apply a translation to this matrix by translating by the given number of units in x and y.

        If M is this matrix and T the translation matrix, then the new matrix will be M * T. So when transforming a vector v with the new matrix by using M * T * v, the translation will be applied first!

        In order to set the matrix to a translation transformation without post-multiplying it, use translation(double, double).

        Parameters:
        x - the offset to translate in x
        y - the offset to translate in y
        Returns:
        this
        See Also:
        translation(double, double)
      • translate

        public Matrix3x2d translate​(Vector2dc offset,
                                    Matrix3x2d dest)
        Apply a translation to this matrix by translating by the given number of units in x and y, and store the result in dest.

        If M is this matrix and T the translation matrix, then the new matrix will be M * T. So when transforming a vector v with the new matrix by using M * T * v, the translation will be applied first!

        In order to set the matrix to a translation transformation without post-multiplying it, use translation(Vector2dc).

        Specified by:
        translate in interface Matrix3x2dc
        Parameters:
        offset - the offset to translate
        dest - will hold the result
        Returns:
        dest
        See Also:
        translation(Vector2dc)
      • translate

        public Matrix3x2d translate​(Vector2dc offset)
        Apply a translation to this matrix by translating by the given number of units in x and y.

        If M is this matrix and T the translation matrix, then the new matrix will be M * T. So when transforming a vector v with the new matrix by using M * T * v, the translation will be applied first!

        In order to set the matrix to a translation transformation without post-multiplying it, use translation(Vector2dc).

        Parameters:
        offset - the offset to translate
        Returns:
        this
        See Also:
        translation(Vector2dc)
      • translateLocal

        public Matrix3x2d translateLocal​(Vector2dc offset)
        Pre-multiply a translation to this matrix by translating by the given number of units in x and y.

        If M is this matrix and T the translation matrix, then the new matrix will be T * M. So when transforming a vector v with the new matrix by using T * M * v, the translation will be applied last!

        In order to set the matrix to a translation transformation without pre-multiplying it, use translation(Vector2dc).

        Parameters:
        offset - the number of units in x and y by which to translate
        Returns:
        this
        See Also:
        translation(Vector2dc)
      • translateLocal

        public Matrix3x2d translateLocal​(Vector2dc offset,
                                         Matrix3x2d dest)
        Pre-multiply a translation to this matrix by translating by the given number of units in x and y and store the result in dest.

        If M is this matrix and T the translation matrix, then the new matrix will be T * M. So when transforming a vector v with the new matrix by using T * M * v, the translation will be applied last!

        In order to set the matrix to a translation transformation without pre-multiplying it, use translation(Vector2dc).

        Specified by:
        translateLocal in interface Matrix3x2dc
        Parameters:
        offset - the number of units in x and y by which to translate
        dest - will hold the result
        Returns:
        dest
        See Also:
        translation(Vector2dc)
      • translateLocal

        public Matrix3x2d translateLocal​(double x,
                                         double y,
                                         Matrix3x2d dest)
        Pre-multiply a translation to this matrix by translating by the given number of units in x and y and store the result in dest.

        If M is this matrix and T the translation matrix, then the new matrix will be T * M. So when transforming a vector v with the new matrix by using T * M * v, the translation will be applied last!

        In order to set the matrix to a translation transformation without pre-multiplying it, use translation(double, double).

        Specified by:
        translateLocal in interface Matrix3x2dc
        Parameters:
        x - the offset to translate in x
        y - the offset to translate in y
        dest - will hold the result
        Returns:
        dest
        See Also:
        translation(double, double)
      • translateLocal

        public Matrix3x2d translateLocal​(double x,
                                         double y)
        Pre-multiply a translation to this matrix by translating by the given number of units in x and y.

        If M is this matrix and T the translation matrix, then the new matrix will be T * M. So when transforming a vector v with the new matrix by using T * M * v, the translation will be applied last!

        In order to set the matrix to a translation transformation without pre-multiplying it, use translation(double, double).

        Parameters:
        x - the offset to translate in x
        y - the offset to translate in y
        Returns:
        this
        See Also:
        translation(double, double)
      • toString

        public java.lang.String toString()
        Return a string representation of this matrix.

        This method creates a new DecimalFormat on every invocation with the format string "0.000E0;-".

        Overrides:
        toString in class java.lang.Object
        Returns:
        the string representation
      • toString

        public java.lang.String toString​(java.text.NumberFormat formatter)
        Return a string representation of this matrix by formatting the matrix elements with the given NumberFormat.
        Parameters:
        formatter - the NumberFormat used to format the matrix values with
        Returns:
        the string representation
      • get

        public Matrix3x2d get​(Matrix3x2d dest)
        Get the current values of this matrix and store them into dest.

        This is the reverse method of set(Matrix3x2dc) and allows to obtain intermediate calculation results when chaining multiple transformations.

        Specified by:
        get in interface Matrix3x2dc
        Parameters:
        dest - the destination matrix
        Returns:
        dest
        See Also:
        set(Matrix3x2dc)
      • get

        public java.nio.DoubleBuffer get​(java.nio.DoubleBuffer buffer)
        Store this matrix in column-major order into the supplied DoubleBuffer at the current buffer position.

        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 get(int, DoubleBuffer), taking the absolute position as parameter.

        Specified by:
        get in interface Matrix3x2dc
        Parameters:
        buffer - will receive the values of this matrix in column-major order at its current position
        Returns:
        the passed in buffer
        See Also:
        get(int, DoubleBuffer)
      • get

        public java.nio.DoubleBuffer get​(int index,
                                         java.nio.DoubleBuffer buffer)
        Store this matrix in column-major order into the supplied DoubleBuffer starting at the specified absolute buffer position/index.

        This method will not increment the position of the given DoubleBuffer.

        Specified by:
        get in interface Matrix3x2dc
        Parameters:
        index - the absolute position into the DoubleBuffer
        buffer - will receive the values of this matrix in column-major order
        Returns:
        the passed in buffer
      • get

        public java.nio.ByteBuffer get​(java.nio.ByteBuffer buffer)
        Store this matrix in column-major order into the supplied ByteBuffer at the current buffer position.

        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 get(int, ByteBuffer), taking the absolute position as parameter.

        Specified by:
        get in interface Matrix3x2dc
        Parameters:
        buffer - will receive the values of this matrix in column-major order at its current position
        Returns:
        the passed in buffer
        See Also:
        get(int, ByteBuffer)
      • get

        public java.nio.ByteBuffer get​(int index,
                                       java.nio.ByteBuffer buffer)
        Store this matrix in column-major order into the supplied ByteBuffer starting at the specified absolute buffer position/index.

        This method will not increment the position of the given ByteBuffer.

        Specified by:
        get in interface Matrix3x2dc
        Parameters:
        index - the absolute position into the ByteBuffer
        buffer - will receive the values of this matrix in column-major order
        Returns:
        the passed in buffer
      • get3x3

        public java.nio.DoubleBuffer get3x3​(java.nio.DoubleBuffer buffer)
        Store this matrix as an equivalent 4x4 matrix in column-major order into the supplied DoubleBuffer at the current buffer position.

        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 get3x3(int, DoubleBuffer), taking the absolute position as parameter.

        Specified by:
        get3x3 in interface Matrix3x2dc
        Parameters:
        buffer - will receive the values of this matrix in column-major order at its current position
        Returns:
        the passed in buffer
        See Also:
        get3x3(int, DoubleBuffer)
      • get3x3

        public java.nio.DoubleBuffer get3x3​(int index,
                                            java.nio.DoubleBuffer buffer)
        Store this matrix as an equivalent 3x3 matrix in column-major order into the supplied DoubleBuffer starting at the specified absolute buffer position/index.

        This method will not increment the position of the given DoubleBuffer.

        Specified by:
        get3x3 in interface Matrix3x2dc
        Parameters:
        index - the absolute position into the DoubleBuffer
        buffer - will receive the values of this matrix in column-major order
        Returns:
        the passed in buffer
      • get3x3

        public java.nio.ByteBuffer get3x3​(java.nio.ByteBuffer buffer)
        Store this matrix as an equivalent 3x3 matrix in column-major order into the supplied ByteBuffer at the current buffer position.

        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 get3x3(int, ByteBuffer), taking the absolute position as parameter.

        Specified by:
        get3x3 in interface Matrix3x2dc
        Parameters:
        buffer - will receive the values of this matrix in column-major order at its current position
        Returns:
        the passed in buffer
        See Also:
        get3x3(int, ByteBuffer)
      • get3x3

        public java.nio.ByteBuffer get3x3​(int index,
                                          java.nio.ByteBuffer buffer)
        Store this matrix as an equivalent 3x3 matrix in column-major order into the supplied ByteBuffer starting at the specified absolute buffer position/index.

        This method will not increment the position of the given ByteBuffer.

        Specified by:
        get3x3 in interface Matrix3x2dc
        Parameters:
        index - the absolute position into the ByteBuffer
        buffer - will receive the values of this matrix in column-major order
        Returns:
        the passed in buffer
      • get4x4

        public java.nio.DoubleBuffer get4x4​(java.nio.DoubleBuffer buffer)
        Store this matrix as an equivalent 4x4 matrix in column-major order into the supplied DoubleBuffer at the current buffer position.

        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 get4x4(int, DoubleBuffer), taking the absolute position as parameter.

        Specified by:
        get4x4 in interface Matrix3x2dc
        Parameters:
        buffer - will receive the values of this matrix in column-major order at its current position
        Returns:
        the passed in buffer
        See Also:
        get4x4(int, DoubleBuffer)
      • get4x4

        public java.nio.DoubleBuffer get4x4​(int index,
                                            java.nio.DoubleBuffer buffer)
        Store this matrix as an equivalent 4x4 matrix in column-major order into the supplied DoubleBuffer starting at the specified absolute buffer position/index.

        This method will not increment the position of the given DoubleBuffer.

        Specified by:
        get4x4 in interface Matrix3x2dc
        Parameters:
        index - the absolute position into the DoubleBuffer
        buffer - will receive the values of this matrix in column-major order
        Returns:
        the passed in buffer
      • get4x4

        public java.nio.ByteBuffer get4x4​(java.nio.ByteBuffer buffer)
        Store this matrix as an equivalent 4x4 matrix in column-major order into the supplied ByteBuffer at the current buffer position.

        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 get4x4(int, ByteBuffer), taking the absolute position as parameter.

        Specified by:
        get4x4 in interface Matrix3x2dc
        Parameters:
        buffer - will receive the values of this matrix in column-major order at its current position
        Returns:
        the passed in buffer
        See Also:
        get4x4(int, ByteBuffer)
      • get4x4

        public java.nio.ByteBuffer get4x4​(int index,
                                          java.nio.ByteBuffer buffer)
        Store this matrix as an equivalent 4x4 matrix in column-major order into the supplied ByteBuffer starting at the specified absolute buffer position/index.

        This method will not increment the position of the given ByteBuffer.

        Specified by:
        get4x4 in interface Matrix3x2dc
        Parameters:
        index - the absolute position into the ByteBuffer
        buffer - will receive the values of this matrix in column-major order
        Returns:
        the passed in buffer
      • getTransposed

        public java.nio.DoubleBuffer getTransposed​(java.nio.DoubleBuffer buffer)
        Description copied from interface: Matrix3x2dc
        Store this matrix in row-major order into the supplied DoubleBuffer at the current buffer position.

        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 Matrix3x2dc.getTransposed(int, DoubleBuffer), taking the absolute position as parameter.

        Specified by:
        getTransposed in interface Matrix3x2dc
        Parameters:
        buffer - will receive the values of this matrix in row-major order at its current position
        Returns:
        the passed in buffer
        See Also:
        Matrix3x2dc.getTransposed(int, DoubleBuffer)
      • getTransposed

        public java.nio.DoubleBuffer getTransposed​(int index,
                                                   java.nio.DoubleBuffer buffer)
        Description copied from interface: Matrix3x2dc
        Store this matrix in row-major order into the supplied DoubleBuffer starting at the specified absolute buffer position/index.

        This method will not increment the position of the given DoubleBuffer.

        Specified by:
        getTransposed in interface Matrix3x2dc
        Parameters:
        index - the absolute position into the DoubleBuffer
        buffer - will receive the values of this matrix in row-major order
        Returns:
        the passed in buffer
      • getTransposed

        public java.nio.ByteBuffer getTransposed​(java.nio.ByteBuffer buffer)
        Description copied from interface: Matrix3x2dc
        Store this matrix in row-major order into the supplied ByteBuffer at the current buffer position.

        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 Matrix3x2dc.getTransposed(int, ByteBuffer), taking the absolute position as parameter.

        Specified by:
        getTransposed in interface Matrix3x2dc
        Parameters:
        buffer - will receive the values of this matrix in row-major order at its current position
        Returns:
        the passed in buffer
        See Also:
        Matrix3x2dc.getTransposed(int, ByteBuffer)
      • getTransposed

        public java.nio.ByteBuffer getTransposed​(int index,
                                                 java.nio.ByteBuffer buffer)
        Description copied from interface: Matrix3x2dc
        Store this matrix in row-major order into the supplied ByteBuffer starting at the specified absolute buffer position/index.

        This method will not increment the position of the given ByteBuffer.

        Specified by:
        getTransposed in interface Matrix3x2dc
        Parameters:
        index - the absolute position into the ByteBuffer
        buffer - will receive the values of this matrix in row-major order
        Returns:
        the passed in buffer
      • getTransposed

        public java.nio.FloatBuffer getTransposed​(java.nio.FloatBuffer buffer)
        Description copied from interface: Matrix3x2dc
        Store this matrix in row-major order into the supplied FloatBuffer at the current buffer position.

        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.

        In order to specify the offset into the FloatBuffer at which the matrix is stored, use Matrix3x2dc.getTransposed(int, FloatBuffer), taking the absolute position as parameter.

        Specified by:
        getTransposed in interface Matrix3x2dc
        Parameters:
        buffer - will receive the values of this matrix in row-major order at its current position
        Returns:
        the passed in buffer
        See Also:
        Matrix3x2dc.getTransposed(int, FloatBuffer)
      • getTransposed

        public java.nio.FloatBuffer getTransposed​(int index,
                                                  java.nio.FloatBuffer buffer)
        Description copied from interface: Matrix3x2dc
        Store this matrix in row-major order into the supplied FloatBuffer starting 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.

        Specified by:
        getTransposed in interface Matrix3x2dc
        Parameters:
        index - the absolute position into the FloatBuffer
        buffer - will receive the values of this matrix in row-major order
        Returns:
        the passed in buffer
      • getTransposedFloats

        public java.nio.ByteBuffer getTransposedFloats​(java.nio.ByteBuffer buffer)
        Description copied from interface: Matrix3x2dc
        Store this matrix as float values in row-major order into the supplied ByteBuffer at the current buffer position.

        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 FloatBuffer.

        In order to specify the offset into the ByteBuffer at which the matrix is stored, use Matrix3x2dc.getTransposedFloats(int, ByteBuffer), taking the absolute position as parameter.

        Specified by:
        getTransposedFloats in interface Matrix3x2dc
        Parameters:
        buffer - will receive the values of this matrix as float values in row-major order at its current position
        Returns:
        the passed in buffer
        See Also:
        Matrix3x2dc.getTransposedFloats(int, ByteBuffer)
      • getTransposedFloats

        public java.nio.ByteBuffer getTransposedFloats​(int index,
                                                       java.nio.ByteBuffer buffer)
        Description copied from interface: Matrix3x2dc
        Store this matrix in row-major order into the supplied ByteBuffer starting 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 FloatBuffer.

        Specified by:
        getTransposedFloats in interface Matrix3x2dc
        Parameters:
        index - the absolute position into the ByteBuffer
        buffer - will receive the values of this matrix as float values in row-major order
        Returns:
        the passed in buffer
      • getToAddress

        public Matrix3x2dc getToAddress​(long address)
        Description copied from interface: Matrix3x2dc
        Store this matrix in column-major order at the given off-heap address.

        This method will throw an UnsupportedOperationException when JOML is used with `-Djoml.nounsafe`.

        This method is unsafe as it can result in a crash of the JVM process when the specified address range does not belong to this process.

        Specified by:
        getToAddress in interface Matrix3x2dc
        Parameters:
        address - the off-heap address where to store this matrix
        Returns:
        this
      • get

        public double[] get​(double[] arr,
                            int offset)
        Store this matrix into the supplied double array in column-major order at the given offset.
        Specified by:
        get in interface Matrix3x2dc
        Parameters:
        arr - the array to write the matrix values into
        offset - the offset into the array
        Returns:
        the passed in array
      • get

        public double[] get​(double[] arr)
        Store this matrix into the supplied double array in column-major order.

        In order to specify an explicit offset into the array, use the method get(double[], int).

        Specified by:
        get in interface Matrix3x2dc
        Parameters:
        arr - the array to write the matrix values into
        Returns:
        the passed in array
        See Also:
        get(double[], int)
      • get3x3

        public double[] get3x3​(double[] arr,
                               int offset)
        Store this matrix as an equivalent 3x3 matrix in column-major order into the supplied float array at the given offset.
        Specified by:
        get3x3 in interface Matrix3x2dc
        Parameters:
        arr - the array to write the matrix values into
        offset - the offset into the array
        Returns:
        the passed in array
      • get3x3

        public double[] get3x3​(double[] arr)
        Store this matrix as an equivalent 3x3 matrix in column-major order into the supplied float array.

        In order to specify an explicit offset into the array, use the method get3x3(double[], int).

        Specified by:
        get3x3 in interface Matrix3x2dc
        Parameters:
        arr - the array to write the matrix values into
        Returns:
        the passed in array
        See Also:
        get3x3(double[], int)
      • get4x4

        public double[] get4x4​(double[] arr,
                               int offset)
        Store this matrix as an equivalent 4x4 matrix in column-major order into the supplied float array at the given offset.
        Specified by:
        get4x4 in interface Matrix3x2dc
        Parameters:
        arr - the array to write the matrix values into
        offset - the offset into the array
        Returns:
        the passed in array
      • get4x4

        public double[] get4x4​(double[] arr)
        Store this matrix as an equivalent 4x4 matrix in column-major order into the supplied float array.

        In order to specify an explicit offset into the array, use the method get4x4(double[], int).

        Specified by:
        get4x4 in interface Matrix3x2dc
        Parameters:
        arr - the array to write the matrix values into
        Returns:
        the passed in array
        See Also:
        get4x4(double[], int)
      • set

        public Matrix3x2d set​(java.nio.DoubleBuffer buffer)
        Set the values of this matrix by reading 6 double values from the given DoubleBuffer in 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 Matrix3x2d set​(java.nio.ByteBuffer buffer)
        Set the values of this matrix by reading 6 double values from the given ByteBuffer in 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 Matrix3x2d set​(int index,
                              java.nio.DoubleBuffer buffer)
        Set the values of this matrix by reading 6 double values from the given DoubleBuffer in column-major order, starting at the specified absolute buffer position/index.

        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:
        index - the absolute position into the DoubleBuffer
        buffer - the DoubleBuffer to read the matrix values from in column-major order
        Returns:
        this
      • set

        public Matrix3x2d set​(int index,
                              java.nio.ByteBuffer buffer)
        Set the values of this matrix by reading 6 double values from the given ByteBuffer in column-major order, starting at the specified absolute buffer position/index.

        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:
        index - the absolute position into the ByteBuffer
        buffer - the ByteBuffer to read the matrix values from in column-major order
        Returns:
        this
      • setFromAddress

        public Matrix3x2d setFromAddress​(long address)
        Set the values of this matrix by reading 6 double values from off-heap memory in column-major order, starting at the given address.

        This method will throw an UnsupportedOperationException when JOML is used with `-Djoml.nounsafe`.

        This method is unsafe as it can result in a crash of the JVM process when the specified address range does not belong to this process.

        Parameters:
        address - the off-heap memory address to read the matrix values from in column-major order
        Returns:
        this
      • zero

        public Matrix3x2d zero()
        Set all values within this matrix to zero.
        Returns:
        this
      • identity

        public Matrix3x2d identity()
        Set this matrix to the identity.
        Returns:
        this
      • scale

        public Matrix3x2d scale​(double x,
                                double y,
                                Matrix3x2d dest)
        Apply scaling to this matrix by scaling the unit axes by the given x and y and store the result in dest.

        If M is this matrix and S the scaling matrix, then the new matrix will be M * S. So when transforming a vector v with the new matrix by using M * S * v, the scaling will be applied first!

        Specified by:
        scale in interface Matrix3x2dc
        Parameters:
        x - the factor of the x component
        y - the factor of the y component
        dest - will hold the result
        Returns:
        dest
      • scale

        public Matrix3x2d scale​(double x,
                                double y)
        Apply scaling to this matrix by scaling the base axes by the given x and y factors.

        If M is this matrix and S the scaling matrix, then the new matrix will be M * S. So when transforming a vector v with the new matrix by using M * S * v, the scaling will be applied first!

        Parameters:
        x - the factor of the x component
        y - the factor of the y component
        Returns:
        this
      • scale

        public Matrix3x2d scale​(Vector2dc xy)
        Apply scaling to this matrix by scaling the base axes by the given xy factors.

        If M is this matrix and S the scaling matrix, then the new matrix will be M * S. So when transforming a vector v with the new matrix by using M * S * v, the scaling will be applied first!

        Parameters:
        xy - the factors of the x and y component, respectively
        Returns:
        this
      • scale

        public Matrix3x2d scale​(Vector2dc xy,
                                Matrix3x2d dest)
        Apply scaling to this matrix by scaling the base axes by the given xy factors and store the result in dest.

        If M is this matrix and S the scaling matrix, then the new matrix will be M * S. So when transforming a vector v with the new matrix by using M * S * v, the scaling will be applied first!

        Specified by:
        scale in interface Matrix3x2dc
        Parameters:
        xy - the factors of the x and y component, respectively
        dest - will hold the result
        Returns:
        dest
      • scale

        public Matrix3x2d scale​(Vector2fc xy)
        Apply scaling to this matrix by scaling the base axes by the given xy factors.

        If M is this matrix and S the scaling matrix, then the new matrix will be M * S. So when transforming a vector v with the new matrix by using M * S * v, the scaling will be applied first!

        Parameters:
        xy - the factors of the x and y component, respectively
        Returns:
        this
      • scale

        public Matrix3x2d scale​(Vector2fc xy,
                                Matrix3x2d dest)
        Apply scaling to this matrix by scaling the base axes by the given xy factors and store the result in dest.

        If M is this matrix and S the scaling matrix, then the new matrix will be M * S. So when transforming a vector v with the new matrix by using M * S * v, the scaling will be applied first!

        Specified by:
        scale in interface Matrix3x2dc
        Parameters:
        xy - the factors of the x and y component, respectively
        dest - will hold the result
        Returns:
        dest
      • scale

        public Matrix3x2d scale​(double xy,
                                Matrix3x2d dest)
        Apply scaling to this matrix by uniformly scaling the two base axes by the given xy factor and store the result in dest.

        If M is this matrix and S the scaling matrix, then the new matrix will be M * S. So when transforming a vector v with the new matrix by using M * S * v, the scaling will be applied first!

        Specified by:
        scale in interface Matrix3x2dc
        Parameters:
        xy - the factor for the two components
        dest - will hold the result
        Returns:
        dest
        See Also:
        scale(double, double, Matrix3x2d)
      • scale

        public Matrix3x2d scale​(double xy)
        Apply scaling to this matrix by uniformly scaling the two base axes by the given xyz factor.

        If M is this matrix and S the scaling matrix, then the new matrix will be M * S. So when transforming a vector v with the new matrix by using M * S * v, the scaling will be applied first!

        Parameters:
        xy - the factor for the two components
        Returns:
        this
        See Also:
        scale(double, double)
      • scaleLocal

        public Matrix3x2d scaleLocal​(double x,
                                     double y,
                                     Matrix3x2d dest)
        Description copied from interface: Matrix3x2dc
        Pre-multiply scaling to this matrix by scaling the base axes by the given x and y factors and store the result in dest.

        If M is this matrix and S the scaling matrix, then the new matrix will be S * M. So when transforming a vector v with the new matrix by using S * M * v , the scaling will be applied last!

        Specified by:
        scaleLocal in interface Matrix3x2dc
        Parameters:
        x - the factor of the x component
        y - the factor of the y component
        dest - will hold the result
        Returns:
        dest
      • scaleLocal

        public Matrix3x2d scaleLocal​(double x,
                                     double y)
        Pre-multiply scaling to this matrix by scaling the base axes by the given x and y factors.

        If M is this matrix and S the scaling matrix, then the new matrix will be S * M. So when transforming a vector v with the new matrix by using S * M * v, the scaling will be applied last!

        Parameters:
        x - the factor of the x component
        y - the factor of the y component
        Returns:
        this
      • scaleLocal

        public Matrix3x2d scaleLocal​(double xy,
                                     Matrix3x2d dest)
        Description copied from interface: Matrix3x2dc
        Pre-multiply scaling to this matrix by scaling the two base axes by the given xy factor, and store the result in dest.

        If M is this matrix and S the scaling matrix, then the new matrix will be S * M. So when transforming a vector v with the new matrix by using S * M * v , the scaling will be applied last!

        Specified by:
        scaleLocal in interface Matrix3x2dc
        Parameters:
        xy - the factor to scale all two base axes by
        dest - will hold the result
        Returns:
        dest
      • scaleLocal

        public Matrix3x2d scaleLocal​(double xy)
        Pre-multiply scaling to this matrix by scaling the base axes by the given xy factor.

        If M is this matrix and S the scaling matrix, then the new matrix will be S * M. So when transforming a vector v with the new matrix by using S * M * v, the scaling will be applied last!

        Parameters:
        xy - the factor of the x and y component
        Returns:
        this
      • scaleAround

        public Matrix3x2d scaleAround​(double sx,
                                      double sy,
                                      double ox,
                                      double oy,
                                      Matrix3x2d dest)
        Apply scaling to this matrix by scaling the base axes by the given sx and sy factors while using (ox, oy) as the scaling origin, and store the result in dest.

        If M is this matrix and S the scaling matrix, then the new matrix will be M * S. So when transforming a vector v with the new matrix by using M * S * v , the scaling will be applied first!

        This method is equivalent to calling: translate(ox, oy, dest).scale(sx, sy).translate(-ox, -oy)

        Specified by:
        scaleAround in interface Matrix3x2dc
        Parameters:
        sx - the scaling factor of the x component
        sy - the scaling factor of the y component
        ox - the x coordinate of the scaling origin
        oy - the y coordinate of the scaling origin
        dest - will hold the result
        Returns:
        dest
      • scaleAround

        public Matrix3x2d scaleAround​(double sx,
                                      double sy,
                                      double ox,
                                      double oy)
        Apply scaling to this matrix by scaling the base axes by the given sx and sy factors while using (ox, oy) as the scaling origin.

        If M is this matrix and S the scaling matrix, then the new matrix will be M * S. So when transforming a vector v with the new matrix by using M * S * v, the scaling will be applied first!

        This method is equivalent to calling: translate(ox, oy).scale(sx, sy).translate(-ox, -oy)

        Parameters:
        sx - the scaling factor of the x component
        sy - the scaling factor of the y component
        ox - the x coordinate of the scaling origin
        oy - the y coordinate of the scaling origin
        Returns:
        this
      • scaleAround

        public Matrix3x2d scaleAround​(double factor,
                                      double ox,
                                      double oy,
                                      Matrix3x2d dest)
        Apply scaling to this matrix by scaling the base axes by the given factor while using (ox, oy) as the scaling origin, and store the result in dest.

        If M is this matrix and S the scaling matrix, then the new matrix will be M * S. So when transforming a vector v with the new matrix by using M * S * v, the scaling will be applied first!

        This method is equivalent to calling: translate(ox, oy, dest).scale(factor).translate(-ox, -oy)

        Specified by:
        scaleAround in interface Matrix3x2dc
        Parameters:
        factor - the scaling factor for all three axes
        ox - the x coordinate of the scaling origin
        oy - the y coordinate of the scaling origin
        dest - will hold the result
        Returns:
        this
      • scaleAround

        public Matrix3x2d scaleAround​(double factor,
                                      double ox,
                                      double oy)
        Apply scaling to this matrix by scaling the base axes by the given factor while using (ox, oy) as the scaling origin.

        If M is this matrix and S the scaling matrix, then the new matrix will be M * S. So when transforming a vector v with the new matrix by using M * S * v, the scaling will be applied first!

        This method is equivalent to calling: translate(ox, oy).scale(factor).translate(-ox, -oy)

        Parameters:
        factor - the scaling factor for all axes
        ox - the x coordinate of the scaling origin
        oy - the y coordinate of the scaling origin
        Returns:
        this
      • scaleAroundLocal

        public Matrix3x2d scaleAroundLocal​(double sx,
                                           double sy,
                                           double ox,
                                           double oy,
                                           Matrix3x2d dest)
        Description copied from interface: Matrix3x2dc
        Pre-multiply scaling to this matrix by scaling the base axes by the given sx and sy factors while using the given (ox, oy) as the scaling origin, and store the result in dest.

        If M is this matrix and S the scaling matrix, then the new matrix will be S * M. So when transforming a vector v with the new matrix by using S * M * v , the scaling will be applied last!

        This method is equivalent to calling: new Matrix3x2d().translate(ox, oy).scale(sx, sy).translate(-ox, -oy).mul(this, dest)

        Specified by:
        scaleAroundLocal in interface Matrix3x2dc
        Parameters:
        sx - the scaling factor of the x component
        sy - the scaling factor of the y component
        ox - the x coordinate of the scaling origin
        oy - the y coordinate of the scaling origin
        dest - will hold the result
        Returns:
        dest
      • scaleAroundLocal

        public Matrix3x2d scaleAroundLocal​(double factor,
                                           double ox,
                                           double oy,
                                           Matrix3x2d dest)
        Description copied from interface: Matrix3x2dc
        Pre-multiply scaling to this matrix by scaling the base axes by the given factor while using (ox, oy) as the scaling origin, and store the result in dest.

        If M is this matrix and S the scaling matrix, then the new matrix will be S * M. So when transforming a vector v with the new matrix by using S * M * v, the scaling will be applied last!

        This method is equivalent to calling: new Matrix3x2d().translate(ox, oy).scale(factor).translate(-ox, -oy).mul(this, dest)

        Specified by:
        scaleAroundLocal in interface Matrix3x2dc
        Parameters:
        factor - the scaling factor for all three axes
        ox - the x coordinate of the scaling origin
        oy - the y coordinate of the scaling origin
        dest - will hold the result
        Returns:
        this
      • scaleAroundLocal

        public Matrix3x2d scaleAroundLocal​(double sx,
                                           double sy,
                                           double sz,
                                           double ox,
                                           double oy,
                                           double oz)
        Pre-multiply scaling to this matrix by scaling the base axes by the given sx and sy factors while using (ox, oy) as the scaling origin.

        If M is this matrix and S the scaling matrix, then the new matrix will be S * M. So when transforming a vector v with the new matrix by using S * M * v, the scaling will be applied last!

        This method is equivalent to calling: new Matrix3x2d().translate(ox, oy).scale(sx, sy).translate(-ox, -oy).mul(this, this)

        Parameters:
        sx - the scaling factor of the x component
        sy - the scaling factor of the y component
        sz - the scaling factor of the z component
        ox - the x coordinate of the scaling origin
        oy - the y coordinate of the scaling origin
        oz - the z coordinate of the scaling origin
        Returns:
        this
      • scaleAroundLocal

        public Matrix3x2d scaleAroundLocal​(double factor,
                                           double ox,
                                           double oy)
        Pre-multiply scaling to this matrix by scaling the base axes by the given factor while using (ox, oy) as the scaling origin.

        If M is this matrix and S the scaling matrix, then the new matrix will be S * M. So when transforming a vector v with the new matrix by using S * M * v, the scaling will be applied last!

        This method is equivalent to calling: new Matrix3x2d().translate(ox, oy).scale(factor).translate(-ox, -oy).mul(this, this)

        Parameters:
        factor - the scaling factor for all three axes
        ox - the x coordinate of the scaling origin
        oy - the y coordinate of the scaling origin
        Returns:
        this
      • scaling

        public Matrix3x2d scaling​(double factor)
        Set this matrix to be a simple scale matrix, which scales the two base 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 and y
        Returns:
        this
        See Also:
        scale(double)
      • scaling

        public Matrix3x2d scaling​(double x,
                                  double y)
        Set this matrix to be a simple scale matrix.
        Parameters:
        x - the scale in x
        y - the scale in y
        Returns:
        this
      • rotation

        public Matrix3x2d rotation​(double angle)
        Set this matrix to a rotation matrix which rotates the given radians.

        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.

        Parameters:
        angle - the angle in radians
        Returns:
        this
        See Also:
        rotate(double)
      • transform

        public Vector3d transform​(Vector3d v)
        Transform/multiply the given vector by this matrix by assuming a third row in this matrix of (0, 0, 1) and store the result in that vector.
        Specified by:
        transform in interface Matrix3x2dc
        Parameters:
        v - the vector to transform and to hold the final result
        Returns:
        v
        See Also:
        Vector3d.mul(Matrix3x2dc)
      • transform

        public Vector3d transform​(double x,
                                  double y,
                                  double z,
                                  Vector3d dest)
        Transform/multiply the given vector (x, y, z) by this matrix and store the result in dest.
        Specified by:
        transform in interface Matrix3x2dc
        Parameters:
        x - the x component of the vector to transform
        y - the y component of the vector to transform
        z - the z component of the vector to transform
        dest - will contain the result
        Returns:
        dest
      • transformPosition

        public Vector2d transformPosition​(double x,
                                          double y,
                                          Vector2d dest)
        Transform/multiply the given 2D-vector (x, y), as if it was a 3D-vector with z=1, by this matrix and store the result in dest.

        The given 2D-vector is treated as a 3D-vector with its z-component being 1.0, so it will represent a position/location in 2D-space rather than a direction.

        In order to store the result in the same vector, use transformPosition(Vector2d).

        Specified by:
        transformPosition in interface Matrix3x2dc
        Parameters:
        x - the x component of the vector to transform
        y - the y component of the vector to transform
        dest - will hold the result
        Returns:
        dest
        See Also:
        transformPosition(Vector2d), transform(Vector3dc, Vector3d)
      • transformDirection

        public Vector2d transformDirection​(Vector2d v)
        Transform/multiply the given 2D-vector, as if it was a 3D-vector with z=0, by this matrix and store the result in that vector.

        The given 2D-vector is treated as a 3D-vector with its z-component being 0.0, so it will represent a direction in 2D-space rather than a position. This method will therefore not take the translation part of the matrix into account.

        In order to store the result in another vector, use transformDirection(Vector2dc, Vector2d).

        Specified by:
        transformDirection in interface Matrix3x2dc
        Parameters:
        v - the vector to transform and to hold the final result
        Returns:
        v
        See Also:
        transformDirection(Vector2dc, Vector2d)
      • transformDirection

        public Vector2d transformDirection​(Vector2dc v,
                                           Vector2d dest)
        Transform/multiply the given 2D-vector, as if it was a 3D-vector with z=0, by this matrix and store the result in dest.

        The given 2D-vector is treated as a 3D-vector with its z-component being 0.0, so it will represent a direction in 2D-space rather than a position. This method will therefore not take the translation part of the matrix into account.

        In order to store the result in the same vector, use transformDirection(Vector2d).

        Specified by:
        transformDirection in interface Matrix3x2dc
        Parameters:
        v - the vector to transform and to hold the final result
        dest - will hold the result
        Returns:
        dest
        See Also:
        transformDirection(Vector2d)
      • transformDirection

        public Vector2d transformDirection​(double x,
                                           double y,
                                           Vector2d dest)
        Transform/multiply the given 2D-vector (x, y), as if it was a 3D-vector with z=0, by this matrix and store the result in dest.

        The given 2D-vector is treated as a 3D-vector with its z-component being 0.0, so it will represent a direction in 2D-space rather than a position. This method will therefore not take the translation part of the matrix into account.

        In order to store the result in the same vector, use transformDirection(Vector2d).

        Specified by:
        transformDirection in interface Matrix3x2dc
        Parameters:
        x - the x component of the vector to transform
        y - the y component of the vector to transform
        dest - will hold the result
        Returns:
        dest
        See Also:
        transformDirection(Vector2d)
      • writeExternal

        public void writeExternal​(java.io.ObjectOutput out)
                           throws java.io.IOException
        Specified by:
        writeExternal in interface java.io.Externalizable
        Throws:
        java.io.IOException
      • readExternal

        public void readExternal​(java.io.ObjectInput in)
                          throws java.io.IOException
        Specified by:
        readExternal in interface java.io.Externalizable
        Throws:
        java.io.IOException
      • rotate

        public Matrix3x2d rotate​(double ang)
        Apply a rotation transformation to this matrix by rotating the given amount of radians.

        If M is this matrix and R the rotation matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v , the rotation will be applied first!

        Parameters:
        ang - the angle in radians
        Returns:
        this
      • rotate

        public Matrix3x2d rotate​(double ang,
                                 Matrix3x2d dest)
        Apply a rotation transformation to this matrix by rotating the given amount of radians and store the result in dest.

        If M is this matrix and R the rotation matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v, the rotation will be applied first!

        Specified by:
        rotate in interface Matrix3x2dc
        Parameters:
        ang - the angle in radians
        dest - will hold the result
        Returns:
        dest
      • rotateLocal

        public Matrix3x2d rotateLocal​(double ang,
                                      Matrix3x2d dest)
        Pre-multiply a rotation to this matrix by rotating the given amount of radians and store the result in dest.

        If M is this matrix and R the rotation matrix, then the new matrix will be R * M. So when transforming a vector v with the new matrix by using R * M * v, the rotation will be applied last!

        In order to set the matrix to a rotation matrix without pre-multiplying the rotation transformation, use rotation().

        Reference: http://en.wikipedia.org

        Specified by:
        rotateLocal in interface Matrix3x2dc
        Parameters:
        ang - the angle in radians to rotate
        dest - will hold the result
        Returns:
        dest
        See Also:
        rotation(double)
      • rotateLocal

        public Matrix3x2d rotateLocal​(double ang)
        Pre-multiply a rotation to this matrix by rotating the given amount of radians.

        If M is this matrix and R the rotation matrix, then the new matrix will be R * M. So when transforming a vector v with the new matrix by using R * M * v, the rotation will be applied last!

        In order to set the matrix to a rotation matrix without pre-multiplying the rotation transformation, use rotation().

        Reference: http://en.wikipedia.org

        Parameters:
        ang - the angle in radians to rotate
        Returns:
        this
        See Also:
        rotation(double)
      • rotateAbout

        public Matrix3x2d rotateAbout​(double ang,
                                      double x,
                                      double y)
        Apply a rotation transformation to this matrix by rotating the given amount of radians about the specified rotation center (x, y).

        This method is equivalent to calling: translate(x, y).rotate(ang).translate(-x, -y)

        If M is this matrix and R the rotation matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v, the rotation will be applied first!

        Parameters:
        ang - the angle in radians
        x - the x component of the rotation center
        y - the y component of the rotation center
        Returns:
        this
        See Also:
        translate(double, double), rotate(double)
      • rotateAbout

        public Matrix3x2d rotateAbout​(double ang,
                                      double x,
                                      double y,
                                      Matrix3x2d dest)
        Apply a rotation transformation to this matrix by rotating the given amount of radians about the specified rotation center (x, y) and store the result in dest.

        This method is equivalent to calling: translate(x, y, dest).rotate(ang).translate(-x, -y)

        If M is this matrix and R the rotation matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v, the rotation will be applied first!

        Specified by:
        rotateAbout in interface Matrix3x2dc
        Parameters:
        ang - the angle in radians
        x - the x component of the rotation center
        y - the y component of the rotation center
        dest - will hold the result
        Returns:
        dest
        See Also:
        translate(double, double, Matrix3x2d), rotate(double, Matrix3x2d)
      • rotateTo

        public Matrix3x2d rotateTo​(Vector2dc fromDir,
                                   Vector2dc toDir,
                                   Matrix3x2d dest)
        Apply a rotation transformation to this matrix that rotates the given normalized fromDir direction vector to point along the normalized toDir, and store the result in dest.

        If M is this matrix and R the rotation matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v, the rotation will be applied first!

        Specified by:
        rotateTo in interface Matrix3x2dc
        Parameters:
        fromDir - the normalized direction which should be rotate to point along toDir
        toDir - the normalized destination direction
        dest - will hold the result
        Returns:
        dest
      • rotateTo

        public Matrix3x2d rotateTo​(Vector2dc fromDir,
                                   Vector2dc toDir)
        Apply a rotation transformation to this matrix that rotates the given normalized fromDir direction vector to point along the normalized toDir.

        If M is this matrix and R the rotation matrix, then the new matrix will be M * R. So when transforming a vector v with the new matrix by using M * R * v, the rotation will be applied first!

        Parameters:
        fromDir - the normalized direction which should be rotate to point along toDir
        toDir - the normalized destination direction
        Returns:
        this
      • view

        public Matrix3x2d view​(double left,
                               double right,
                               double bottom,
                               double top,
                               Matrix3x2d dest)
        Apply a "view" transformation to this matrix that maps the given (left, bottom) and (right, top) corners to (-1, -1) and (1, 1) respectively and store the result in dest.

        If M is this matrix and O the orthographic projection matrix, then the new matrix will be M * O. So when transforming a vector v with the new matrix by using M * O * v, the orthographic projection transformation will be applied first!

        Specified by:
        view in interface Matrix3x2dc
        Parameters:
        left - the distance from the center to the left view edge
        right - the distance from the center to the right view edge
        bottom - the distance from the center to the bottom view edge
        top - the distance from the center to the top view edge
        dest - will hold the result
        Returns:
        dest
        See Also:
        setView(double, double, double, double)
      • view

        public Matrix3x2d view​(double left,
                               double right,
                               double bottom,
                               double top)
        Apply a "view" transformation to this matrix that maps the given (left, bottom) and (right, top) corners to (-1, -1) and (1, 1) respectively.

        If M is this matrix and O the orthographic projection matrix, then the new matrix will be M * O. So when transforming a vector v with the new matrix by using M * O * v, the orthographic projection transformation will be applied first!

        Parameters:
        left - the distance from the center to the left view edge
        right - the distance from the center to the right view edge
        bottom - the distance from the center to the bottom view edge
        top - the distance from the center to the top view edge
        Returns:
        this
        See Also:
        setView(double, double, double, double)
      • setView

        public Matrix3x2d setView​(double left,
                                  double right,
                                  double bottom,
                                  double top)
        Set this matrix to define a "view" transformation that maps the given (left, bottom) and (right, top) corners to (-1, -1) and (1, 1) respectively.
        Parameters:
        left - the distance from the center to the left view edge
        right - the distance from the center to the right view edge
        bottom - the distance from the center to the bottom view edge
        top - the distance from the center to the top view edge
        Returns:
        this
        See Also:
        view(double, double, double, double)
      • origin

        public Vector2d origin​(Vector2d origin)
        Obtain the position that gets transformed to the origin by this matrix. This can be used to get the position of the "camera" from a given view transformation matrix.

        This method is equivalent to the following code:

         Matrix3x2d inv = new Matrix3x2d(this).invert();
         inv.transform(origin.set(0, 0));
         
        Specified by:
        origin in interface Matrix3x2dc
        Parameters:
        origin - will hold the position transformed to the origin
        Returns:
        origin
      • viewArea

        public double[] viewArea​(double[] area)
        Obtain the extents of the view transformation of this matrix and store it in area. This can be used to determine which region of the screen (i.e. the NDC space) is covered by the view.
        Specified by:
        viewArea in interface Matrix3x2dc
        Parameters:
        area - will hold the view area as [minX, minY, maxX, maxY]
        Returns:
        area
      • positiveX

        public Vector2d positiveX​(Vector2d dir)
        Description copied from interface: Matrix3x2dc
        Obtain the direction of +X before the transformation represented by this matrix is applied.

        This method uses the rotation component of the left 2x2 submatrix to obtain the direction that is transformed to +X by this matrix.

        This method is equivalent to the following code:

         Matrix3x2d inv = new Matrix3x2d(this).invert();
         inv.transformDirection(dir.set(1, 0)).normalize();
         
        If this is already an orthogonal matrix, then consider using Matrix3x2dc.normalizedPositiveX(Vector2d) instead.

        Reference: http://www.euclideanspace.com

        Specified by:
        positiveX in interface Matrix3x2dc
        Parameters:
        dir - will hold the direction of +X
        Returns:
        dir
      • normalizedPositiveX

        public Vector2d normalizedPositiveX​(Vector2d dir)
        Description copied from interface: Matrix3x2dc
        Obtain the direction of +X before the transformation represented by this orthogonal matrix is applied. This method only produces correct results if this is an orthogonal matrix.

        This method uses the rotation component of the left 2x2 submatrix to obtain the direction that is transformed to +X by this matrix.

        This method is equivalent to the following code:

         Matrix3x2d inv = new Matrix3x2d(this).transpose();
         inv.transformDirection(dir.set(1, 0));
         

        Reference: http://www.euclideanspace.com

        Specified by:
        normalizedPositiveX in interface Matrix3x2dc
        Parameters:
        dir - will hold the direction of +X
        Returns:
        dir
      • positiveY

        public Vector2d positiveY​(Vector2d dir)
        Description copied from interface: Matrix3x2dc
        Obtain the direction of +Y before the transformation represented by this matrix is applied.

        This method uses the rotation component of the left 2x2 submatrix to obtain the direction that is transformed to +Y by this matrix.

        This method is equivalent to the following code:

         Matrix3x2d inv = new Matrix3x2d(this).invert();
         inv.transformDirection(dir.set(0, 1)).normalize();
         
        If this is already an orthogonal matrix, then consider using Matrix3x2dc.normalizedPositiveY(Vector2d) instead.

        Reference: http://www.euclideanspace.com

        Specified by:
        positiveY in interface Matrix3x2dc
        Parameters:
        dir - will hold the direction of +Y
        Returns:
        dir
      • normalizedPositiveY

        public Vector2d normalizedPositiveY​(Vector2d dir)
        Description copied from interface: Matrix3x2dc
        Obtain the direction of +Y before the transformation represented by this orthogonal matrix is applied. This method only produces correct results if this is an orthogonal matrix.

        This method uses the rotation component of the left 2x2 submatrix to obtain the direction that is transformed to +Y by this matrix.

        This method is equivalent to the following code:

         Matrix3x2d inv = new Matrix3x2d(this).transpose();
         inv.transformDirection(dir.set(0, 1));
         

        Reference: http://www.euclideanspace.com

        Specified by:
        normalizedPositiveY in interface Matrix3x2dc
        Parameters:
        dir - will hold the direction of +Y
        Returns:
        dir
      • unproject

        public Vector2d unproject​(double winX,
                                  double winY,
                                  int[] viewport,
                                  Vector2d dest)
        Unproject the given window coordinates (winX, winY) by this matrix using the specified viewport.

        This method first converts the given window coordinates to normalized device coordinates in the range [-1..1] and then transforms those NDC coordinates by the inverse of this matrix.

        As a necessary computation step for unprojecting, this method computes the inverse of this matrix. In order to avoid computing the matrix inverse with every invocation, the inverse of this matrix can be built once outside using invert(Matrix3x2d) and then the method unprojectInv() can be invoked on it.

        Specified by:
        unproject in interface Matrix3x2dc
        Parameters:
        winX - the x-coordinate in window coordinates (pixels)
        winY - the y-coordinate in window coordinates (pixels)
        viewport - the viewport described by [x, y, width, height]
        dest - will hold the unprojected position
        Returns:
        dest
        See Also:
        unprojectInv(double, double, int[], Vector2d), invert(Matrix3x2d)
      • unprojectInv

        public Vector2d unprojectInv​(double winX,
                                     double winY,
                                     int[] viewport,
                                     Vector2d dest)
        Unproject the given window coordinates (winX, winY) by this matrix using the specified viewport.

        This method differs from unproject() in that it assumes that this is already the inverse matrix of the original projection matrix. It exists to avoid recomputing the matrix inverse with every invocation.

        Specified by:
        unprojectInv in interface Matrix3x2dc
        Parameters:
        winX - the x-coordinate in window coordinates (pixels)
        winY - the y-coordinate in window coordinates (pixels)
        viewport - the viewport described by [x, y, width, height]
        dest - will hold the unprojected position
        Returns:
        dest
        See Also:
        unproject(double, double, int[], Vector2d)
      • span

        public Matrix3x2d span​(Vector2d corner,
                               Vector2d xDir,
                               Vector2d yDir)
        Compute the extents of the coordinate system before this transformation was applied and store the resulting corner coordinates in corner and the span vectors in xDir and yDir.

        That means, given the maximum extents of the coordinate system between [-1..+1] in all dimensions, this method returns one corner and the length and direction of the two base axis vectors in the coordinate system before this transformation is applied, which transforms into the corner coordinates [-1, +1].

        Parameters:
        corner - will hold one corner of the span
        xDir - will hold the direction and length of the span along the positive X axis
        yDir - will hold the direction and length of the span along the positive Y axis
        Returns:
        this
      • testPoint

        public boolean testPoint​(double x,
                                 double y)
        Description copied from interface: Matrix3x2dc
        Test whether the given point (x, y) is within the frustum defined by this matrix.

        This method assumes this matrix to be a transformation from any arbitrary coordinate system/space M into standard OpenGL clip space and tests whether the given point with the coordinates (x, y, z) given in space M is within the clip space.

        Reference: Fast Extraction of Viewing Frustum Planes from the World-View-Projection Matrix

        Specified by:
        testPoint in interface Matrix3x2dc
        Parameters:
        x - the x-coordinate of the point
        y - the y-coordinate of the point
        Returns:
        true if the given point is inside the frustum; false otherwise
      • testCircle

        public boolean testCircle​(double x,
                                  double y,
                                  double r)
        Description copied from interface: Matrix3x2dc
        Test whether the given circle is partly or completely within or outside of the frustum defined by this matrix.

        This method assumes this matrix to be a transformation from any arbitrary coordinate system/space M into standard OpenGL clip space and tests whether the given sphere with the coordinates (x, y, z) given in space M is within the clip space.

        Reference: Fast Extraction of Viewing Frustum Planes from the World-View-Projection Matrix

        Specified by:
        testCircle in interface Matrix3x2dc
        Parameters:
        x - the x-coordinate of the circle's center
        y - the y-coordinate of the circle's center
        r - the circle's radius
        Returns:
        true if the given circle is partly or completely inside the frustum; false otherwise
      • testAar

        public boolean testAar​(double minX,
                               double minY,
                               double maxX,
                               double maxY)
        Description copied from interface: Matrix3x2dc
        Test whether the given axis-aligned rectangle is partly or completely within or outside of the frustum defined by this matrix. The rectangle is specified via its min and max corner coordinates.

        This method assumes this matrix to be a transformation from any arbitrary coordinate system/space M into standard OpenGL clip space and tests whether the given axis-aligned rectangle with its minimum corner coordinates (minX, minY, minZ) and maximum corner coordinates (maxX, maxY, maxZ) given in space M is within the clip space.

        Reference: Efficient View Frustum Culling
        Reference: Fast Extraction of Viewing Frustum Planes from the World-View-Projection Matrix

        Specified by:
        testAar in interface Matrix3x2dc
        Parameters:
        minX - the x-coordinate of the minimum corner
        minY - the y-coordinate of the minimum corner
        maxX - the x-coordinate of the maximum corner
        maxY - the y-coordinate of the maximum corner
        Returns:
        true if the axis-aligned box is completely or partly inside of the frustum; false otherwise
      • 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
      • equals

        public boolean equals​(Matrix3x2dc m,
                              double delta)
        Description copied from interface: Matrix3x2dc
        Compare the matrix elements of this matrix with the given matrix using the given delta and return whether all of them are equal within a maximum difference of delta.

        Please note that this method is not used by any data structure such as ArrayList HashSet or HashMap and their operations, such as ArrayList.contains(Object) or HashSet.remove(Object), since those data structures only use the Object.equals(Object) and Object.hashCode() methods.

        Specified by:
        equals in interface Matrix3x2dc
        Parameters:
        m - the other matrix
        delta - the allowed maximum difference
        Returns:
        true whether all of the matrix elements are equal; false otherwise
      • isFinite

        public boolean isFinite()
        Description copied from interface: Matrix3x2dc
        Determine whether all matrix elements are finite floating-point values, that is, they are not NaN and not infinity.
        Specified by:
        isFinite in interface Matrix3x2dc
        Returns:
        true if all components are finite floating-point values; false otherwise
      • clone

        public java.lang.Object clone()
                               throws java.lang.CloneNotSupportedException
        Overrides:
        clone in class java.lang.Object
        Throws:
        java.lang.CloneNotSupportedException