Class Matrix3

java.lang.Object
com.ardor3d.math.Matrix3
All Implemented Interfaces:
Poolable, ReadOnlyMatrix3, Savable, Externalizable, Serializable, Cloneable

public class Matrix3 extends Object implements Cloneable, Savable, Externalizable, ReadOnlyMatrix3, Poolable
Matrix3 represents a double precision 3x3 matrix. Note: some algorithms in this class were ported from Eberly, Wolfram, Game Gems and others to Java.
See Also:
  • Field Details

    • ALLOWED_DEVIANCE

      public static final double ALLOWED_DEVIANCE
      Used with equals method to determine if two Matrix3 objects are close enough to be considered equal.
      See Also:
    • IDENTITY

      public static final ReadOnlyMatrix3 IDENTITY
       1, 0, 0
       0, 1, 0
       0, 0, 1
       
    • _m00

      protected double _m00
    • _m01

      protected double _m01
    • _m02

      protected double _m02
    • _m10

      protected double _m10
    • _m11

      protected double _m11
    • _m12

      protected double _m12
    • _m20

      protected double _m20
    • _m21

      protected double _m21
    • _m22

      protected double _m22
  • Constructor Details

    • Matrix3

      public Matrix3()
      Constructs a new, mutable matrix set to identity.
    • Matrix3

      public Matrix3(double m00, double m01, double m02, double m10, double m11, double m12, double m20, double m21, double m22)
      Constructs a new, mutable matrix using the given matrix values (names are mRC = m[ROW][COL])
      Parameters:
      m00 - m00
      m01 - m01
      m02 - m02
      m10 - m10
      m11 - m11
      m12 - m12
      m20 - m20
      m21 - m21
      m22 - m22
    • Matrix3

      public Matrix3(ReadOnlyMatrix3 source)
      Constructs a new, mutable matrix using the values from the given matrix
      Parameters:
      source - the source matrix
  • Method Details

    • getValue

      public double getValue(int row, int column)
      Specified by:
      getValue in interface ReadOnlyMatrix3
      Parameters:
      row - the row index
      column - the column index
      Returns:
      the value stored in this matrix at row, column.
      Throws:
      IllegalArgumentException - if row and column are not in bounds [0, 2]
    • getValuef

      public float getValuef(int row, int column)
      Specified by:
      getValuef in interface ReadOnlyMatrix3
      Parameters:
      row - the row index
      column - the column index
      Returns:
      the value stored in this matrix at row, column, pre-cast to a float for convenience.
      Throws:
      IllegalArgumentException - if row and column are not in bounds [0, 2]
    • getM00

      public double getM00()
      Specified by:
      getM00 in interface ReadOnlyMatrix3
    • getM01

      public double getM01()
      Specified by:
      getM01 in interface ReadOnlyMatrix3
    • getM02

      public double getM02()
      Specified by:
      getM02 in interface ReadOnlyMatrix3
    • getM10

      public double getM10()
      Specified by:
      getM10 in interface ReadOnlyMatrix3
    • getM11

      public double getM11()
      Specified by:
      getM11 in interface ReadOnlyMatrix3
    • getM12

      public double getM12()
      Specified by:
      getM12 in interface ReadOnlyMatrix3
    • getM20

      public double getM20()
      Specified by:
      getM20 in interface ReadOnlyMatrix3
    • getM21

      public double getM21()
      Specified by:
      getM21 in interface ReadOnlyMatrix3
    • getM22

      public double getM22()
      Specified by:
      getM22 in interface ReadOnlyMatrix3
    • setM00

      public void setM00(double m00)
    • setM01

      public void setM01(double m01)
    • setM02

      public void setM02(double m02)
    • setM10

      public void setM10(double m10)
    • setM11

      public void setM11(double m11)
    • setM12

      public void setM12(double m12)
    • setM20

      public void setM20(double m20)
    • setM21

      public void setM21(double m21)
    • setM22

      public void setM22(double m22)
    • setIdentity

      public Matrix3 setIdentity()
      Same as set(IDENTITY)
      Returns:
      this matrix for chaining
    • isIdentity

      public boolean isIdentity()
      Specified by:
      isIdentity in interface ReadOnlyMatrix3
      Returns:
      true if this matrix equals the 3x3 identity matrix
    • setValue

      public Matrix3 setValue(int row, int column, double value)
      Sets the value of this matrix at row, column to the given value.
      Parameters:
      row - the row index
      column - the column index
      value - the value to set
      Returns:
      this matrix for chaining
      Throws:
      IllegalArgumentException - if row and column are not in bounds [0, 2]
    • set

      public Matrix3 set(double m00, double m01, double m02, double m10, double m11, double m12, double m20, double m21, double m22)
      Sets the values of this matrix to the values given.
      Parameters:
      m00 - m00
      m01 - m01
      m02 - m02
      m10 - m10
      m11 - m11
      m12 - m12
      m20 - m20
      m21 - m21
      m22 - m22
      Returns:
      this matrix for chaining
    • set

      public Matrix3 set(ReadOnlyMatrix3 source)
      Sets the values of this matrix to the values of the provided source matrix.
      Parameters:
      source - the source matrix
      Returns:
      this matrix for chaining
      Throws:
      NullPointerException - if source is null.
    • set

      public Matrix3 set(ReadOnlyQuaternion quaternion)
      Sets the values of this matrix to the rotational value of the given quaternion.
      Parameters:
      quaternion - the quaternion
      Returns:
      this matrix for chaining
    • fromDoubleBuffer

      public Matrix3 fromDoubleBuffer(DoubleBuffer source)
      Parameters:
      source - the buffer to read our matrix data from.
      Returns:
      this matrix for chaining.
    • fromDoubleBuffer

      public Matrix3 fromDoubleBuffer(DoubleBuffer source, boolean rowMajor)
      Parameters:
      source - the buffer to read our matrix data from.
      rowMajor - if true, data is stored row by row. Otherwise it is stored column by column.
      Returns:
      this matrix for chaining.
    • fromFloatBuffer

      public Matrix3 fromFloatBuffer(FloatBuffer source)
      Note: data is cast to floats.
      Parameters:
      source - the buffer to read our matrix data from.
      Returns:
      this matrix for chaining.
    • fromFloatBuffer

      public Matrix3 fromFloatBuffer(FloatBuffer source, boolean rowMajor)
      Note: data is cast to floats.
      Parameters:
      source - the buffer to read our matrix data from.
      rowMajor - if true, data is stored row by row. Otherwise it is stored column by column.
      Returns:
      this matrix for chaining.
    • fromArray

      public Matrix3 fromArray(double[] source)
      Sets the values of this matrix to the values of the provided double array.
      Parameters:
      source - the source matrix
      Returns:
      this matrix for chaining
      Throws:
      NullPointerException - if source is null.
      ArrayIndexOutOfBoundsException - if source array has a length less than 9.
    • fromArray

      public Matrix3 fromArray(double[] source, boolean rowMajor)
      Sets the values of this matrix to the values of the provided double array.
      Parameters:
      source - the source matrix
      rowMajor - true if the matrix is row major
      Returns:
      this matrix for chaining
      Throws:
      NullPointerException - if source is null.
      ArrayIndexOutOfBoundsException - if source array has a length less than 9.
    • setColumn

      public Matrix3 setColumn(int columnIndex, ReadOnlyVector3 columnData)
      Replaces a column in this matrix with the values of the given vector.
      Parameters:
      columnIndex - the column index
      columnData - the column data
      Returns:
      this matrix for chaining
      Throws:
      NullPointerException - if columnData is null.
      IllegalArgumentException - if columnIndex is not in [0, 2]
    • setRow

      public Matrix3 setRow(int rowIndex, ReadOnlyVector3 rowData)
      Replaces a row in this matrix with the values of the given vector.
      Parameters:
      rowIndex - the row index
      rowData - the row date
      Returns:
      this matrix for chaining
      Throws:
      NullPointerException - if rowData is null.
      IllegalArgumentException - if rowIndex is not in [0, 2]
    • fromAxes

      public Matrix3 fromAxes(ReadOnlyVector3 uAxis, ReadOnlyVector3 vAxis, ReadOnlyVector3 wAxis)
      Set the values of this matrix from the axes (columns) provided.
      Parameters:
      uAxis - the u axis
      vAxis - the v axis
      wAxis - the w axis
      Returns:
      this matrix for chaining
      Throws:
      NullPointerException - if any of the axes are null.
    • fromAngleAxis

      public Matrix3 fromAngleAxis(double angle, ReadOnlyVector3 axis)
      Sets this matrix to the rotation indicated by the given angle and axis of rotation. Note: This method creates an object, so use fromAngleNormalAxis when possible, particularly if your axis is already normalized.
      Parameters:
      angle - the angle to rotate (in radians).
      axis - the axis of rotation.
      Returns:
      this matrix for chaining
      Throws:
      NullPointerException - if axis is null.
    • fromAngleNormalAxis

      public Matrix3 fromAngleNormalAxis(double angle, ReadOnlyVector3 axis)
      Sets this matrix to the rotation indicated by the given angle and a unit-length axis of rotation.
      Parameters:
      angle - the angle to rotate (in radians).
      axis - the axis of rotation (already normalized).
      Returns:
      this matrix for chaining
      Throws:
      NullPointerException - if axis is null.
    • fromAngles

      public Matrix3 fromAngles(double yaw, double roll, double pitch)
      XXX: Need to redo this again... or at least correct the terms. YRP are arbitrary terms, based on a specific frame of axis. Updates this matrix from the given Euler rotation angles (y,r,p). Note that we are applying in order: roll, pitch, yaw but we've ordered them in x, y, and z for convenience. See: http://www.euclideanspace.com/maths/geometry/rotations/conversions/eulerToMatrix/index.htm
      Parameters:
      yaw - the Euler yaw of rotation (in radians). (aka Bank, often rot around x)
      roll - the Euler roll of rotation (in radians). (aka Heading, often rot around y)
      pitch - the Euler pitch of rotation (in radians). (aka Attitude, often rot around z)
      Returns:
      this matrix for chaining
    • applyRotation

      public Matrix3 applyRotation(double angle, double x, double y, double z)
    • applyRotationX

      public Matrix3 applyRotationX(double angle)
      Apply rotation around X (Mrx * this)
      Parameters:
      angle - the rotation angle
      Returns:
      this matrix for chaining
    • applyRotationY

      public Matrix3 applyRotationY(double angle)
      Apply rotation around Y (Mry * this)
      Parameters:
      angle - the rotation angle
      Returns:
      this matrix for chaining
    • applyRotationZ

      public Matrix3 applyRotationZ(double angle)
      Apply rotation around Z (Mrz * this)
      Parameters:
      angle - the rotation angle
      Returns:
      this matrix for chaining
    • getColumn

      public Vector3 getColumn(int index, Vector3 store)
      Specified by:
      getColumn in interface ReadOnlyMatrix3
      Parameters:
      index - the index of the column
      store - the vector object to store the result in. if null, a new one is created.
      Returns:
      the column specified by the index.
      Throws:
      IllegalArgumentException - if index is not in bounds [0, 2]
    • getRow

      public Vector3 getRow(int index, Vector3 store)
      Specified by:
      getRow in interface ReadOnlyMatrix3
      Parameters:
      index - the index of the row
      store - the vector object to store the result in. if null, a new one is created.
      Returns:
      the row specified by the index.
      Throws:
      IllegalArgumentException - if index is not in bounds [0, 2]
    • toDoubleBuffer

      public DoubleBuffer toDoubleBuffer(DoubleBuffer store)
      Specified by:
      toDoubleBuffer in interface ReadOnlyMatrix3
      Parameters:
      store - the buffer to store our matrix data in. Must not be null. Data is entered starting at current buffer position.
      Returns:
      matrix data as a DoubleBuffer in row major order. The position is at the end of the inserted data.
      Throws:
      NullPointerException - if store is null.
      BufferOverflowException - if there is not enough room left in the buffer to write all 9 values.
    • toDoubleBuffer

      public DoubleBuffer toDoubleBuffer(DoubleBuffer store, boolean rowMajor)
      Specified by:
      toDoubleBuffer in interface ReadOnlyMatrix3
      Parameters:
      store - the buffer to store our matrix data in. Must not be null. Data is entered starting at current buffer position.
      rowMajor - if true, data is stored row by row. Otherwise it is stored column by column.
      Returns:
      matrix data as a DoubleBuffer in the specified order. The position is at the end of the inserted data.
      Throws:
      NullPointerException - if store is null.
      BufferOverflowException - if there is not enough room left in the buffer to write all 9 values.
    • toFloatBuffer

      public FloatBuffer toFloatBuffer(FloatBuffer store)
      Note: data is cast to floats.
      Specified by:
      toFloatBuffer in interface ReadOnlyMatrix3
      Parameters:
      store - the buffer to store our matrix data in. Must not be null. Data is entered starting at current buffer position.
      Returns:
      matrix data as a FloatBuffer in row major order. The position is at the end of the inserted data.
      Throws:
      NullPointerException - if store is null.
      BufferOverflowException - if there is not enough room left in the buffer to write all 9 values.
    • toFloatBuffer

      public FloatBuffer toFloatBuffer(FloatBuffer store, boolean rowMajor)
      Note: data is cast to floats.
      Specified by:
      toFloatBuffer in interface ReadOnlyMatrix3
      Parameters:
      store - the buffer to store our matrix data in. Must not be null. Data is entered starting at current buffer position.
      rowMajor - if true, data is stored row by row. Otherwise it is stored column by column.
      Returns:
      matrix data as a FloatBuffer in the specified order. The position is at the end of the inserted data.
      Throws:
      NullPointerException - if store is null.
      BufferOverflowException - if there is not enough room left in the buffer to write all 9 values.
    • toArray

      public double[] toArray(double[] store)
      Specified by:
      toArray in interface ReadOnlyMatrix3
      Parameters:
      store - the double array to store our matrix data in. If null, a new array is created.
      Returns:
      matrix data as a double array in row major order.
      Throws:
      IllegalArgumentException - if the store is non-null and has a length < 9
    • toArray

      public double[] toArray(double[] store, boolean rowMajor)
      Specified by:
      toArray in interface ReadOnlyMatrix3
      Parameters:
      store - the double array to store our matrix data in. If null, a new array is created.
      rowMajor - if true, data is stored row by row. Otherwise it is stored column by column.
      Returns:
      matrix data as a double array in the specified order.
      Throws:
      IllegalArgumentException - if the store is non-null and has a length < 9
    • toAngles

      public double[] toAngles(double[] store)
      converts this matrix to Euler rotation angles (yaw, roll, pitch). See http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToEuler/index.htm
      Specified by:
      toAngles in interface ReadOnlyMatrix3
      Parameters:
      store - the double[] array to store the computed angles in. If null, a new double[] will be created
      Returns:
      the double[] array.
      Throws:
      IllegalArgumentException - if non-null store is not at least length 3
      See Also:
    • multiplyLocal

      public Matrix3 multiplyLocal(ReadOnlyMatrix3 matrix)
      Parameters:
      matrix - the matrix
      Returns:
      This matrix for chaining, modified internally to reflect multiplication against the given matrix
      Throws:
      NullPointerException - if matrix is null
    • multiply

      public Matrix3 multiply(ReadOnlyMatrix3 matrix, Matrix3 store)
      Specified by:
      multiply in interface ReadOnlyMatrix3
      Parameters:
      matrix - the matrix
      store - a matrix to store the result in. if null, a new matrix is created. It is safe for the given matrix and this parameter to be the same object.
      Returns:
      this matrix multiplied by the given matrix.
      Throws:
      NullPointerException - if matrix is null.
    • multiplyDiagonalPre

      public Matrix3 multiplyDiagonalPre(ReadOnlyVector3 vec, Matrix3 store)
      Multiplies this matrix by the diagonal matrix formed by the given vector (v^D * M). If supplied, the result is stored into the supplied "store" matrix.
      Specified by:
      multiplyDiagonalPre in interface ReadOnlyMatrix3
      Parameters:
      vec - the vector
      store - a matrix to store the result in. If store is null, a new matrix is created. Note that it IS safe for vec and store to be the same object.
      Returns:
      the store matrix, or a new matrix if store is null.
      Throws:
      NullPointerException - if vec is null
    • multiplyDiagonalPost

      public Matrix3 multiplyDiagonalPost(ReadOnlyVector3 vec, Matrix3 store)
      Multiplies this matrix by the diagonal matrix formed by the given vector (M * v^D). If supplied, the result is stored into the supplied "store" matrix.
      Specified by:
      multiplyDiagonalPost in interface ReadOnlyMatrix3
      Parameters:
      vec - the vector
      store - a matrix to store the result in. If store is null, a new matrix is created. Note that it IS safe for vec and store to be the same object.
      Returns:
      the store matrix, or a new matrix if store is null.
      Throws:
      NullPointerException - if vec is null
    • multiplyLocal

      public Matrix3 multiplyLocal(double scalar)
      Internally scales all values of this matrix by the given scalar.
      Parameters:
      scalar - the scalar value
      Returns:
      this matrix for chaining.
    • add

      public Matrix3 add(ReadOnlyMatrix3 matrix, Matrix3 store)
      Specified by:
      add in interface ReadOnlyMatrix3
      Parameters:
      matrix - the matrix to add to this.
      store - a matrix to store the result in. If store is null, a new matrix is created. Note that it IS safe for matrix and store to be the same object.
      Returns:
      the result.
      Throws:
      NullPointerException - if matrix is null
    • addLocal

      public Matrix3 addLocal(ReadOnlyMatrix3 matrix)
      Internally adds the values of the given matrix to this matrix.
      Parameters:
      matrix - the matrix to add to this.
      Returns:
      this matrix for chaining
      Throws:
      NullPointerException - if matrix is null
    • subtract

      public Matrix3 subtract(ReadOnlyMatrix3 matrix, Matrix3 store)
      Specified by:
      subtract in interface ReadOnlyMatrix3
      Parameters:
      matrix - the matrix to subtract from this.
      store - a matrix to store the result in. If store is null, a new matrix is created. Note that it IS safe for matrix and store to be the same object.
      Returns:
      the result.
      Throws:
      NullPointerException - if matrix is null
    • subtractLocal

      public Matrix3 subtractLocal(ReadOnlyMatrix3 matrix)
      Internally subtracts the values of the given matrix from this matrix.
      Parameters:
      matrix - the matrix to subtract from this.
      Returns:
      this matrix for chaining
      Throws:
      NullPointerException - if matrix is null
    • scale

      public Matrix3 scale(ReadOnlyVector3 scale, Matrix3 store)
      Applies the given scale to this matrix and returns the result as a new matrix
      Specified by:
      scale in interface ReadOnlyMatrix3
      Parameters:
      scale - the scale value
      store - a matrix to store the result in. If store is null, a new matrix is created.
      Returns:
      the new matrix
      Throws:
      NullPointerException - if scale is null.
    • scaleLocal

      public Matrix3 scaleLocal(ReadOnlyVector3 scale)
      Applies the given scale to this matrix values internally
      Parameters:
      scale - the scale value
      Returns:
      this matrix for chaining.
      Throws:
      NullPointerException - if scale is null.
    • transpose

      public Matrix3 transpose(Matrix3 store)
      transposes this matrix as a new matrix, basically flipping it across the diagonal
      Specified by:
      transpose in interface ReadOnlyMatrix3
      Parameters:
      store - a matrix to store the result in. If store is null, a new matrix is created.
      Returns:
      this matrix for chaining.
      See Also:
    • transposeLocal

      public Matrix3 transposeLocal()
      transposes this matrix in place
      Returns:
      this matrix for chaining.
      See Also:
    • invert

      public Matrix3 invert(Matrix3 store)
      Specified by:
      invert in interface ReadOnlyMatrix3
      Parameters:
      store - a matrix to store the result in. If store is null, a new matrix is created. Note that it IS safe for store == this.
      Returns:
      a matrix that represents this matrix, inverted. if store is not null and is read only
      Throws:
      ArithmeticException - if this matrix can not be inverted.
    • invertLocal

      public Matrix3 invertLocal()
      Inverts this matrix locally.
      Returns:
      this matrix inverted internally.
      Throws:
      ArithmeticException - if this matrix can not be inverted.
    • adjugate

      public Matrix3 adjugate(Matrix3 store)
      Specified by:
      adjugate in interface ReadOnlyMatrix3
      Parameters:
      store - The matrix to store the result in. If null, a new matrix is created.
      Returns:
      The adjugate, or classical adjoint, of this matrix
      See Also:
    • adjugateLocal

      public Matrix3 adjugateLocal()
      Returns:
      this matrix, modified to represent its adjugate, or classical adjoint
      See Also:
    • determinant

      public double determinant()
      Specified by:
      determinant in interface ReadOnlyMatrix3
      Returns:
      the determinate of this 3x3 matrix (aei+bfg+cdh-ceg-bdi-afh)
      See Also:
    • fromStartEndLocal

      public Matrix3 fromStartEndLocal(ReadOnlyVector3 start, ReadOnlyVector3 end)
      A function for creating a rotation matrix that rotates a vector called "start" into another vector called "end".
      Parameters:
      start - normalized non-zero starting vector
      end - normalized non-zero ending vector
      Returns:
      this matrix, for chaining
      See Also:
      • "Tomas Möller, John Hughes 'Efficiently Building a Matrix to Rotate One Vector to Another' Journal of Graphics Tools, 4(4):1-4, 1999"
    • applyPre

      public Vector3 applyPre(ReadOnlyVector3 vec, Vector3 store)
      Multiplies the given vector by this matrix (v * M). If supplied, the result is stored into the supplied "store" vector.
      Specified by:
      applyPre in interface ReadOnlyMatrix3
      Parameters:
      vec - the vector to multiply this matrix by.
      store - a vector to store the result in. If store is null, a new vector is created. Note that it IS safe for vec and store to be the same object.
      Returns:
      the store vector, or a new vector if store is null.
      Throws:
      NullPointerException - if vec is null
    • applyPost

      public Vector3 applyPost(ReadOnlyVector3 vec, Vector3 store)
      Multiplies the given vector by this matrix (M * v). If supplied, the result is stored into the supplied "store" vector.
      Specified by:
      applyPost in interface ReadOnlyMatrix3
      Parameters:
      vec - the vector to multiply this matrix by.
      store - a vector to store the result in. If store is null, a new vector is created. Note that it IS safe for vec and store to be the same object.
      Returns:
      the store vector, or a new vector if store is null.
      Throws:
      NullPointerException - if vec is null
    • lookAt

      public Matrix3 lookAt(ReadOnlyVector3 direction, ReadOnlyVector3 up)
      Modifies this matrix to equal the rotation required to point the z-axis at 'direction' and the y-axis to 'up'.
      Parameters:
      direction - where to 'look' at
      up - a vector indicating the local up direction.
      Returns:
      this matrix for chaining
    • isValid

      public static boolean isValid(ReadOnlyMatrix3 matrix)
      Check a matrix... if it is null or its doubles are NaN or infinite, return false. Else return true.
      Parameters:
      matrix - the vector to check
      Returns:
      true or false as stated above.
    • isOrthonormal

      public boolean isOrthonormal()
      Specified by:
      isOrthonormal in interface ReadOnlyMatrix3
      Returns:
      true if this Matrix is orthonormal - its rows are orthogonal, unit vectors.
    • toString

      public String toString()
      Overrides:
      toString in class Object
      Returns:
      the string representation of this matrix.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
      Returns:
      returns a unique code for this matrix object based on its values. If two matrices are numerically equal, they will return the same hash code value.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
      Parameters:
      o - the object to compare for equality
      Returns:
      true if this matrix and the provided matrix have the double values that are within the MathUtils.ZERO_TOLERANCE.
    • strictEquals

      public boolean strictEquals(Object o)
      Parameters:
      o - the object to compare for equality
      Returns:
      true if this matrix and the provided matrix have the exact same double values.
    • clone

      public Matrix3 clone()
      Specified by:
      clone in interface ReadOnlyMatrix3
      Overrides:
      clone in class Object
    • getClassTag

      public Class<? extends Matrix3> getClassTag()
      Specified by:
      getClassTag in interface Savable
    • write

      public void write(OutputCapsule capsule) throws IOException
      Specified by:
      write in interface Savable
      Throws:
      IOException
    • read

      public void read(InputCapsule capsule) throws IOException
      Specified by:
      read in interface Savable
      Throws:
      IOException
    • readExternal

      public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
      Used with serialization. Not to be called manually.
      Specified by:
      readExternal in interface Externalizable
      Parameters:
      in - ObjectInput
      Throws:
      IOException - if something wrong occurs while reading
      ClassNotFoundException - if a class is not found
    • writeExternal

      public void writeExternal(ObjectOutput out) throws IOException
      Used with serialization. Not to be called manually.
      Specified by:
      writeExternal in interface Externalizable
      Parameters:
      out - ObjectOutput
      Throws:
      IOException - if something wrong occurs while writing
    • fetchTempInstance

      public static final Matrix3 fetchTempInstance()
      Returns:
      An instance of Matrix3 that is intended for temporary use in calculations and so forth. Multiple calls to the method should return instances of this class that are not currently in use.
    • releaseTempInstance

      public static final void releaseTempInstance(Matrix3 mat)
      Releases a Matrix3 back to be used by a future call to fetchTempInstance. TAKE CARE: this Matrix3 object should no longer have other classes referencing it or "Bad Things" will happen.
      Parameters:
      mat - the Matrix3 to release.