com.io7m.jtensors

## Class MatrixM4x4D

- java.lang.Object
- - com.io7m.jtensors.MatrixM4x4D

- All Implemented Interfaces:
    MatrixReadable4x4DType, MatrixReadableDType

      public class MatrixM4x4D
      extends Object
      implements MatrixReadable4x4DType

  A 4x4 mutable matrix type with double precision elements.

  Values of type `MatrixM4x4D` are backed by direct memory, with the rows and columns of the matrices being stored in column-major format. This allows the matrices to be passed to OpenGL directly, without requiring transposition.

  Values of this type cannot be accessed safely from multiple threads without explicit synchronization.

  See "Mathematics for 3D Game Programming and Computer Graphics" 2nd Ed for the derivations of most of the code in this class (ISBN: 1-58450-277-0).

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `MatrixM4x4D.Context` The Context type contains the minimum storage required for all of the functions of the `MatrixM4x4D` class.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MatrixM4x4D()` Construct a new identity matrix.
    `MatrixM4x4D(MatrixM4x4D source)` Construct a new copy of the given matrix.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static MatrixM4x4D` | `add(MatrixReadable4x4DType m0, MatrixReadable4x4DType m1, MatrixM4x4D out)` Elementwise add of matrices `m0` and `m1`.
    `static MatrixM4x4D` | `addInPlace(MatrixM4x4D m0, MatrixReadable4x4DType m1)` Elementwise add of matrices `m0` and `m1`, returning the result in `m0`.
    `static MatrixM4x4D` | `addRowScaled(MatrixReadable4x4DType m, int row_a, int row_b, int row_c, double r, MatrixM4x4D out)` Add the values in row `row_b` to the values in row `row_a` scaled by `r`, saving the resulting row in row `row_c` of the matrix `out`.
    `static MatrixM4x4D` | `addRowScaledInPlace(MatrixM4x4D m, int row_a, int row_b, int row_c, double r)` Add the values in row `row_b` to the values in row `row_a` scaled by `r`, saving the resulting row in row `row_c` of the matrix `m`.
    `static MatrixM4x4D` | `addRowScaledWithContext(MatrixM4x4D.Context context, MatrixReadable4x4DType m, int row_a, int row_b, int row_c, double r, MatrixM4x4D out)` Add the values in row `row_b` to the values in row `row_a` scaled by `r`, saving the resulting row in row `row_c` of the matrix `out`.
    `static MatrixM4x4D` | `copy(MatrixReadable4x4DType input, MatrixM4x4D output)` Copy the contents of the matrix `input` to the matrix `output`, completely replacing all elements.
    `static double` | `determinant(MatrixReadable4x4DType m)` Calculate the determinant of the matrix `m`.
    `static DoubleBuffer` | `doubleBuffer(MatrixM4x4D m)`
    `boolean` | `equals(Object obj)`
    `static MatrixM4x4D` | `exchangeRows(MatrixReadable4x4DType m, int row_a, int row_b, MatrixM4x4D out)` Exchange the row `row_a` and row `row_b` of the matrix `m`, saving the exchanged rows to `out`.
    `static MatrixM4x4D` | `exchangeRowsInPlace(MatrixM4x4D m, int row_a, int row_b)` Exchange the row `row_a` and row `row_b` of the matrix `m`, saving the exchanged rows to `m`.
    `static MatrixM4x4D` | `exchangeRowsInPlaceWithContext(MatrixM4x4D.Context context, MatrixM4x4D m, int row_a, int row_b)` Exchange the row `row_a` and row `row_b` of the matrix `m`, saving the exchanged rows to `m`.
    `static MatrixM4x4D` | `exchangeRowsWithContext(MatrixM4x4D.Context context, MatrixReadable4x4DType m, int row_a, int row_b, MatrixM4x4D out)` Exchange two rows `row_a` and row `row_b` of the matrix `m`, saving the exchanged rows to `out` .
    `double` | `get(int row, int column)`
    `static double` | `get(MatrixReadable4x4DType m, int row, int column)`
    `DoubleBuffer` | `getDoubleBuffer()`
    `void` | `getRow4D(int row, VectorM4D out)` Retrieve row `row`, saving the result to `out`.
    `double` | `getRowColumnD(int row, int column)`
    `int` | `hashCode()`
    `static com.io7m.jfunctional.OptionType<MatrixM4x4D>` | `invert(MatrixReadable4x4DType m, MatrixM4x4D out)` Calculate the inverse of the matrix `m`, saving the resulting matrix to `out`.
    `static com.io7m.jfunctional.OptionType<MatrixM4x4D>` | `invertInPlace(MatrixM4x4D m)` Calculate the inverse of the matrix `m`, saving the resulting matrix to `m`.
    `static com.io7m.jfunctional.OptionType<MatrixM4x4D>` | `invertInPlaceWithContext(MatrixM4x4D.Context context, MatrixM4x4D m)` Calculate the inverse of the matrix `m`, saving the resulting matrix to `m`.
    `static com.io7m.jfunctional.OptionType<MatrixM4x4D>` | `invertWithContext(MatrixM4x4D.Context context, MatrixReadable4x4DType m, MatrixM4x4D out)` Calculate the inverse of the matrix `m`, saving the resulting matrix to `out`.
    `static void` | `lookAtWithContext(MatrixM4x4D.Context context, VectorReadable3DType origin, VectorReadable3DType target, VectorReadable3DType up, MatrixM4x4D out_matrix)` Calculate a matrix representing a "camera" looking from the point `origin` to the point `target`.
    `static MatrixM4x4D` | `makeRotation(double angle, VectorReadable3DType axis)` Generate and return a matrix that represents a rotation of `angle` radians around the axis `axis`.
    `static MatrixM4x4D` | `makeRotation(double angle, VectorReadable3DType axis, MatrixM4x4D out)` Generate a matrix that represents a rotation of `angle` radians around the axis `axis` and save to `out`.
    `static MatrixM4x4D` | `makeTranslation3D(VectorReadable3DType v)` Generate and return a matrix that represents a translation of `(v.x, v.y, v.z)` from the origin.
    `static MatrixM4x4D` | `makeTranslation3D(VectorReadable3DType v, MatrixM4x4D out)` Generate a matrix that represents a translation of `(v.x, v.y, v.z)` from the origin, and save to `out`.
    `static MatrixM4x4D` | `makeTranslation3I(VectorReadable3IType v)` Generate and return a matrix that represents a translation of `(v.x, v.y, v.z)` from the origin.
    `static MatrixM4x4D` | `makeTranslation3I(VectorReadable3IType v, MatrixM4x4D out)` Generate a matrix that represents a translation of `(v.x, v.y, v.z)` from the origin, and save to `out`.
    `static MatrixM4x4D` | `multiply(MatrixReadable4x4DType m0, MatrixReadable4x4DType m1, MatrixM4x4D out)` Multiply the matrix `m0` with the matrix `m1`, writing the result to `out`.
    `static MatrixM4x4D` | `multiplyInPlace(MatrixM4x4D m0, MatrixReadable4x4DType m1)` Multiply the matrix `m0` with the matrix `m1`, writing the result to `m0`.
    `static VectorM4D` | `multiplyVector4D(MatrixReadable4x4DType m, VectorReadable4DType v, VectorM4D out)` Multiply the matrix `m` with the vector `v`, writing the resulting vector to `out`.
    `static VectorM4D` | `multiplyVector4DWithContext(MatrixM4x4D.Context context, MatrixReadable4x4DType m, VectorReadable4DType v, VectorM4D out)` Multiply the matrix `m` with the vector `v`, writing the resulting vector to `out`.
    `static MatrixM4x4D` | `rotate(double angle, MatrixReadable4x4DType m, VectorReadable3DType axis, MatrixM4x4D out)` Rotate the matrix `m` by `angle` radians around the axis `axis`, saving the result into `out`.
    `static MatrixM4x4D` | `rotateInPlace(double angle, MatrixM4x4D m, VectorReadable3DType axis)` Rotate the matrix `m` by `angle` radians around the axis `axis`, saving the result into `m`.
    `static MatrixM4x4D` | `rotateInPlaceWithContext(MatrixM4x4D.Context context, double angle, MatrixM4x4D m, VectorReadable3DType axis)` Rotate the matrix `m` by `angle` radians around the axis `axis`, saving the result into `m`.
    `static MatrixM4x4D` | `rotateWithContext(MatrixM4x4D.Context context, double angle, MatrixReadable4x4DType m, VectorReadable3DType axis, MatrixM4x4D out)` Rotate the matrix `m` by `angle` radians around the axis `axis`, saving the result into `out`.
    `static VectorM4D` | `row(MatrixReadable4x4DType m, int row, VectorM4D out)`
    `static MatrixM4x4D` | `scale(MatrixReadable4x4DType m, double r, MatrixM4x4D out)` Scale all elements of the matrix `m` by the scaling value `r`, saving the result in `out`.
    `static MatrixM4x4D` | `scaleInPlace(MatrixM4x4D m, double r)` Scale all elements of the matrix `m` by the scaling value `r`, saving the result in `m`.
    `static MatrixM4x4D` | `scaleRow(MatrixReadable4x4DType m, int row, double r, MatrixM4x4D out)` Scale row `r` of the matrix `m` by `r`, saving the result to row `r` of `out`.
    `static MatrixM4x4D` | `scaleRowInPlace(MatrixM4x4D m, int row, double r)` Scale row `row` of the matrix `m` by `r` , saving the result to row `r` of `m`.
    `static MatrixM4x4D` | `scaleRowInPlaceWithContext(MatrixM4x4D.Context context, MatrixM4x4D m, int row, double r)` Scale row `row` of the matrix `m` by `r` , saving the result to row `r` of `m`.
    `static MatrixM4x4D` | `scaleRowWithContext(MatrixM4x4D.Context context, MatrixReadable4x4DType m, int row, double r, MatrixM4x4D out)` Scale row `row` of the matrix `m` by `r` , saving the result to row `r` of `out`.
    `MatrixM4x4D` | `set(int row, int column, double value)` Set the value at the given row and column.
    `static MatrixM4x4D` | `set(MatrixM4x4D m, int row, int column, double value)` Set the value in the matrix `m` at row `row`, column `column` to `value`.
    `static MatrixM4x4D` | `setIdentity(MatrixM4x4D m)` Set the given matrix `m` to the identity matrix.
    `static MatrixM4x4D` | `setZero(MatrixM4x4D m)` Set the given matrix `m` to the zero matrix.
    `String` | `toString()`
    `static double` | `trace(MatrixReadable4x4DType m)` Return the trace of the matrix `m`.
    `static MatrixM4x4D` | `translateByVector2D(MatrixReadable4x4DType m, VectorReadable2DType v, MatrixM4x4D out)` Translate the matrix `m` by the vector `v`, storing the resulting matrix in `out`.
    `static MatrixM4x4D` | `translateByVector2DInPlace(MatrixM4x4D m, VectorReadable2DType v)` Translate the matrix `m` by the vector `v`, storing the resulting matrix in `m`.
    `static MatrixM4x4D` | `translateByVector2I(MatrixReadable4x4DType m, VectorReadable2IType v, MatrixM4x4D out)` Translate the matrix `m` by the vector `v`, storing the resulting matrix in `out`.
    `static MatrixM4x4D` | `translateByVector2IInPlace(MatrixM4x4D m, VectorReadable2IType v)` Translate the matrix `m` by the vector `v`, storing the resulting matrix in `m`.
    `static MatrixM4x4D` | `translateByVector3D(MatrixReadable4x4DType m, VectorReadable3DType v, MatrixM4x4D out)` Translate the matrix `m` by the vector `v`, storing the resulting matrix in `out`.
    `static MatrixM4x4D` | `translateByVector3DInPlace(MatrixM4x4D m, VectorReadable3DType v)` Translate the matrix `m` by the vector `v`, storing the resulting matrix in `m`.
    `static MatrixM4x4D` | `translateByVector3I(MatrixReadable4x4DType m, VectorReadable3IType v, MatrixM4x4D out)` Translate the matrix `m` by the vector `v`, storing the resulting matrix in `out`.
    `static MatrixM4x4D` | `translateByVector3IInPlace(MatrixM4x4D m, VectorReadable3IType v)` Translate the matrix `m` by the vector `v`, storing the resulting matrix in `m`.
    `static MatrixM4x4D` | `transpose(MatrixReadable4x4DType m, MatrixM4x4D out)` Transpose the given matrix `m`, writing the resulting matrix to `out`.
    `static MatrixM4x4D` | `transposeInPlace(MatrixM4x4D m)` Transpose the given matrix `m`, writing the resulting matrix to `m`.

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### MatrixM4x4D

          public MatrixM4x4D()

      Construct a new identity matrix.

    - #### MatrixM4x4D

          public MatrixM4x4D(MatrixM4x4D source)

      Construct a new copy of the given matrix.
      Parameters:
        `source` - The source matrix.

  - ### Method Detail

    - #### add

          public static final MatrixM4x4D add(MatrixReadable4x4DType m0,
                        MatrixReadable4x4DType m1,
                        MatrixM4x4D out)

      Elementwise add of matrices `m0` and `m1`.
      Parameters:
        `m0` - The left input matrix.
        `m1` - The right input matrix.
        `out` - The output matrix.
      Returns:
        `out`

    - #### addInPlace

          public static final MatrixM4x4D addInPlace(MatrixM4x4D m0,
                               MatrixReadable4x4DType m1)

      Elementwise add of matrices `m0` and `m1`, returning the result in `m0`.
      Parameters:
        `m0` - The left input matrix.
        `m1` - The right input matrix.
      Returns:
        m0

    - #### addRowScaled

          public static final MatrixM4x4D addRowScaled(MatrixReadable4x4DType m,
                                 int row_a,
                                 int row_b,
                                 int row_c,
                                 double r,
                                 MatrixM4x4D out)

      Add the values in row `row_b` to the values in row `row_a` scaled by `r`, saving the resulting row in row `row_c` of the matrix `out`.

      This is one of the three "elementary" operations defined on matrices. See Elementary operations .

      Parameters:
        `m` - The input matrix.
        `row_a` - The row on the lefthand side of the addition.
        `row_b` - The row on the righthand side of the addition.
        `row_c` - The destination row.
        `r` - The scaling value.
        `out` - The output matrix.
      Returns:
        `out`

    - #### addRowScaledInPlace

          public static final MatrixM4x4D addRowScaledInPlace(MatrixM4x4D m,
                                        int row_a,
                                        int row_b,
                                        int row_c,
                                        double r)

      Add the values in row `row_b` to the values in row `row_a` scaled by `r`, saving the resulting row in row `row_c` of the matrix `m`.

      This is one of the three "elementary" operations defined on matrices. See Elementary operations .

      Parameters:
        `m` - The input matrix.
        `row_a` - The row on the lefthand side of the addition.
        `row_b` - The row on the righthand side of the addition.
        `row_c` - The destination row.
        `r` - The scaling value.
      Returns:
        `m`

    - #### addRowScaledWithContext

          public static final MatrixM4x4D addRowScaledWithContext(MatrixM4x4D.Context context,
                                            MatrixReadable4x4DType m,
                                            int row_a,
                                            int row_b,
                                            int row_c,
                                            double r,
                                            MatrixM4x4D out)

      Add the values in row `row_b` to the values in row `row_a` scaled by `r`, saving the resulting row in row `row_c` of the matrix `out`. The function uses storage preallocated in `context` to avoid any new allocations.

      This is one of the three "elementary" operations defined on matrices. See Elementary operations .

      Parameters:
        `context` - Preallocated storage.
        `m` - The input matrix.
        `row_a` - The row on the lefthand side of the addition.
        `row_b` - The row on the righthand side of the addition.
        `row_c` - The destination row.
        `r` - The scaling value.
        `out` - The output matrix.
      Returns:
        `out`

    - #### copy

          public static final MatrixM4x4D copy(MatrixReadable4x4DType input,
                         MatrixM4x4D output)

      Copy the contents of the matrix `input` to the matrix `output`, completely replacing all elements.
      Parameters:
        `input` - The input vector.
        `output` - The output vector.
      Returns:
        `output`

    - #### determinant

          public static final double determinant(MatrixReadable4x4DType m)

      Calculate the determinant of the matrix `m`.
      Parameters:
        `m` - The input matrix.
      Returns:
        The determinant.

    - #### doubleBuffer

          public static final DoubleBuffer doubleBuffer(MatrixM4x4D m)

      Parameters:
        `m` - The input matrix.
      Returns:
        A view of the buffer that backs this matrix.

    - #### exchangeRows

          public static final MatrixM4x4D exchangeRows(MatrixReadable4x4DType m,
                                 int row_a,
                                 int row_b,
                                 MatrixM4x4D out)

      Exchange the row `row_a` and row `row_b` of the matrix `m`, saving the exchanged rows to `out`.

      This is one of the three "elementary" operations defined on matrices. See Elementary operations .

      Parameters:
        `m` - The input matrix.
        `row_a` - The first row.
        `row_b` - The second row.
        `out` - The output matrix.
      Returns:
        `out`

    - #### exchangeRowsInPlace

          public static final MatrixM4x4D exchangeRowsInPlace(MatrixM4x4D m,
                                        int row_a,
                                        int row_b)

      Exchange the row `row_a` and row `row_b` of the matrix `m`, saving the exchanged rows to `m`.

      This is one of the three "elementary" operations defined on matrices. See Elementary operations .

      Parameters:
        `m` - The input matrix.
        `row_a` - The first row.
        `row_b` - The second row.
      Returns:
        `m`

    - #### exchangeRowsInPlaceWithContext

          public static final MatrixM4x4D exchangeRowsInPlaceWithContext(MatrixM4x4D.Context context,
                                                   MatrixM4x4D m,
                                                   int row_a,
                                                   int row_b)

      Exchange the row `row_a` and row `row_b` of the matrix `m`, saving the exchanged rows to `m`. The function uses storage preallocated in `context` to avoid allocating memory.

      This is one of the three "elementary" operations defined on matrices. See Elementary operations .

      Parameters:
        `context` - Preallocated storage.
        `m` - The input matrix.
        `row_a` - The first row.
        `row_b` - The second row.
      Returns:
        `m`

    - #### exchangeRowsWithContext

          public static final MatrixM4x4D exchangeRowsWithContext(MatrixM4x4D.Context context,
                                            MatrixReadable4x4DType m,
                                            int row_a,
                                            int row_b,
                                            MatrixM4x4D out)

      Exchange two rows `row_a` and row `row_b` of the matrix `m`, saving the exchanged rows to `out` .

      The function uses storage preallocated in `context` to avoid allocating memory.

      This is one of the three "elementary" operations defined on matrices. See Elementary operations .

      Parameters:
        `context` - Preallocated storage.
        `m` - The input matrix.
        `row_a` - The first row.
        `row_b` - The second row.
        `out` - The output matrix.
      Returns:
        `out`

    - #### get

          public static final double get(MatrixReadable4x4DType m,
                   int row,
                   int column)

      Parameters:
        `m` - The input matrix
        `row` - The row
        `column` - The column
      Returns:
        The value from the matrix `m` at row `row`, column `column`.

    - #### invert

          public static final com.io7m.jfunctional.OptionType<MatrixM4x4D> invert(MatrixReadable4x4DType m,
                                                            MatrixM4x4D out)

      Calculate the inverse of the matrix `m`, saving the resulting matrix to `out`. The function returns `Some(out)` iff it was possible to invert the matrix, and `None` otherwise. It is not possible to invert a matrix that has a determinant of `0`. If the function returns `None`, `m` is untouched.
      Parameters:
        `m` - The input matrix.
        `out` - The output matrix.
      Returns:
        `out`
      See Also:
        `determinant(MatrixReadable4x4DType)`

    - #### invertInPlace

          public static final com.io7m.jfunctional.OptionType<MatrixM4x4D> invertInPlace(MatrixM4x4D m)

      Calculate the inverse of the matrix `m`, saving the resulting matrix to `m`. The function returns `Some(m)` iff it was possible to invert the matrix, and `None` otherwise. It is not possible to invert a matrix that has a determinant of `0`. If the function returns `None`, `m` is untouched.
      Parameters:
        `m` - The input matrix.
      Returns:
        `m`
      See Also:
        `determinant(MatrixReadable4x4DType)`

    - #### invertInPlaceWithContext

          public static final com.io7m.jfunctional.OptionType<MatrixM4x4D> invertInPlaceWithContext(MatrixM4x4D.Context context,
                                                                              MatrixM4x4D m)

      Calculate the inverse of the matrix `m`, saving the resulting matrix to `m`. The function returns `Some(out)` iff it was possible to invert the matrix, and `None` otherwise. It is not possible to invert a matrix that has a determinant of `0`. The function uses preallocated storage in `context` to avoid allocating memory. If the function returns `None`, `m` is untouched.
      Parameters:
        `context` - Preallocated storage.
        `m` - The input matrix.
      Returns:
        `m`
      See Also:
        `determinant(MatrixReadable4x4DType)`

    - #### invertWithContext

          public static final com.io7m.jfunctional.OptionType<MatrixM4x4D> invertWithContext(MatrixM4x4D.Context context,
                                                                       MatrixReadable4x4DType m,
                                                                       MatrixM4x4D out)

      Calculate the inverse of the matrix `m`, saving the resulting matrix to `out`. The function returns `Some(out)` iff it was possible to invert the matrix, and `None` otherwise. It is not possible to invert a matrix that has a determinant of `0`. The function uses preallocated storage in `context` to avoid allocating memory. If the function returns `None`, `m` is untouched.
      Parameters:
        `context` - Preallocated storage.
        `m` - The input matrix.
        `out` - The output matrix.
      Returns:
        `out`
      See Also:
        `determinant(MatrixReadable4x4DType)`

    - #### lookAtWithContext

          public static final void lookAtWithContext(MatrixM4x4D.Context context,
                               VectorReadable3DType origin,
                               VectorReadable3DType target,
                               VectorReadable3DType up,
                               MatrixM4x4D out_matrix)

      Calculate a matrix representing a "camera" looking from the point `origin` to the point `target`. `target` must represent the "up" vector for the camera. Usually, this is simply a unit vector `(0, 1, 0)` representing the Y axis.

      The function uses preallocated storage from `context`.

      The view is expressed as a rotation and translation matrix, written to `out_matrix`.

      Parameters:
        `context` - Preallocated storage
        `out_matrix` - The output matrix
        `origin` - The position of the viewer
        `target` - The target being viewed
        `up` - The up vector

    - #### makeRotation

          public static final MatrixM4x4D makeRotation(double angle,
                                 VectorReadable3DType axis)

      Generate and return a matrix that represents a rotation of `angle` radians around the axis `axis`.

      The function assumes a right-handed coordinate system and therefore a positive rotation around any axis represents a counter-clockwise rotation around that axis.

      Parameters:
        `angle` - The angle in radians.
        `axis` - The axis.
      Returns:
        A rotation matrix.

    - #### makeRotation

          public static final MatrixM4x4D makeRotation(double angle,
                                 VectorReadable3DType axis,
                                 MatrixM4x4D out)

      Generate a matrix that represents a rotation of `angle` radians around the axis `axis` and save to `out`.

      The function assumes a right-handed coordinate system and therefore a positive rotation around any axis represents a counter-clockwise rotation around that axis.

      Parameters:
        `angle` - The angle in radians.
        `axis` - The axis.
        `out` - The output matrix.
      Returns:
        `out`

    - #### makeTranslation3D

          public static final MatrixM4x4D makeTranslation3D(VectorReadable3DType v)

      Generate and return a matrix that represents a translation of `(v.x, v.y, v.z)` from the origin.
      Parameters:
        `v` - The translation vector.
      Returns:
        `out`

    - #### makeTranslation3D

          public static final MatrixM4x4D makeTranslation3D(VectorReadable3DType v,
                                      MatrixM4x4D out)

      Generate a matrix that represents a translation of `(v.x, v.y, v.z)` from the origin, and save to `out`.
      Parameters:
        `v` - The translation vector.
        `out` - The output matrix.
      Returns:
        `out`

    - #### makeTranslation3I

          public static final MatrixM4x4D makeTranslation3I(VectorReadable3IType v)

      Generate and return a matrix that represents a translation of `(v.x, v.y, v.z)` from the origin.
      Parameters:
        `v` - The translation vector.
      Returns:
        `out`

    - #### makeTranslation3I

          public static final MatrixM4x4D makeTranslation3I(VectorReadable3IType v,
                                      MatrixM4x4D out)

      Generate a matrix that represents a translation of `(v.x, v.y, v.z)` from the origin, and save to `out`.
      Parameters:
        `v` - The translation vector.
        `out` - The output matrix.
      Returns:
        `out`

    - #### multiply

          public static final MatrixM4x4D multiply(MatrixReadable4x4DType m0,
                             MatrixReadable4x4DType m1,
                             MatrixM4x4D out)

      Multiply the matrix `m0` with the matrix `m1`, writing the result to `out`.
      Parameters:
        `m0` - The left input vector.
        `m1` - The right input vector.
        `out` - The output vector.
      Returns:
        `out`

    - #### multiplyInPlace

          public static final MatrixM4x4D multiplyInPlace(MatrixM4x4D m0,
                                    MatrixReadable4x4DType m1)

      Multiply the matrix `m0` with the matrix `m1`, writing the result to `m0`.
      Parameters:
        `m0` - The left input vector.
        `m1` - The right input vector.
      Returns:
        `out`

    - #### multiplyVector4D

          public static final VectorM4D multiplyVector4D(MatrixReadable4x4DType m,
                                   VectorReadable4DType v,
                                   VectorM4D out)

      Multiply the matrix `m` with the vector `v`, writing the resulting vector to `out`.

      Formally, this can be considered to be premultiplication of the column vector `v` with the matrix `m`.

      Parameters:
        `m` - The input matrix.
        `v` - The input vector.
        `out` - The output vector.
      Returns:
        `out`

    - #### multiplyVector4DWithContext

          public static final VectorM4D multiplyVector4DWithContext(MatrixM4x4D.Context context,
                                              MatrixReadable4x4DType m,
                                              VectorReadable4DType v,
                                              VectorM4D out)

      Multiply the matrix `m` with the vector `v`, writing the resulting vector to `out`.

      The function uses preallocated storage in `context` to avoid allocating memory.

      Formally, this can be considered to be premultiplication of the column vector `v` with the matrix `m`.

      Parameters:
        `context` - Preallocated storage.
        `m` - The input matrix.
        `v` - The input vector.
        `out` - The output vector.
      Returns:
        `out`

    - #### rotate

          public static final MatrixM4x4D rotate(double angle,
                           MatrixReadable4x4DType m,
                           VectorReadable3DType axis,
                           MatrixM4x4D out)

      Rotate the matrix `m` by `angle` radians around the axis `axis`, saving the result into `out`.

      The function assumes a right-handed coordinate system and therefore a positive rotation around any axis represents a counter-clockwise rotation around that axis.

      Parameters:
        `angle` - The angle in radians.
        `m` - The input matrix.
        `axis` - A vector representing an axis.
        `out` - The output matrix.
      Returns:
        `out`

    - #### rotateInPlace

          public static final MatrixM4x4D rotateInPlace(double angle,
                                  MatrixM4x4D m,
                                  VectorReadable3DType axis)

      Rotate the matrix `m` by `angle` radians around the axis `axis`, saving the result into `m`.

      The function assumes a right-handed coordinate system and therefore a positive rotation around any axis represents a counter-clockwise rotation around that axis.

      Parameters:
        `angle` - The angle in radians.
        `m` - The input matrix.
        `axis` - A vector representing an axis.
      Returns:
        `m`

    - #### rotateInPlaceWithContext

          public static final MatrixM4x4D rotateInPlaceWithContext(MatrixM4x4D.Context context,
                                             double angle,
                                             MatrixM4x4D m,
                                             VectorReadable3DType axis)

      Rotate the matrix `m` by `angle` radians around the axis `axis`, saving the result into `m`. The function uses preallocated storage in `context` to avoid allocating memory.

      The function assumes a right-handed coordinate system and therefore a positive rotation around any axis represents a counter-clockwise rotation around that axis.

      Parameters:
        `context` - Preallocated storage.
        `angle` - The angle in radians.
        `m` - The input matrix.
        `axis` - A vector representing an axis.
      Returns:
        `m`

    - #### rotateWithContext

          public static final MatrixM4x4D rotateWithContext(MatrixM4x4D.Context context,
                                      double angle,
                                      MatrixReadable4x4DType m,
                                      VectorReadable3DType axis,
                                      MatrixM4x4D out)

      Rotate the matrix `m` by `angle` radians around the axis `axis`, saving the result into `out`. The function uses preallocated storage in `context` to avoid allocating memory.

      The function assumes a right-handed coordinate system and therefore a positive rotation around any axis represents a counter-clockwise rotation around that axis.

      Parameters:
        `context` - Preallocated storage.
        `angle` - The angle in radians.
        `m` - The input matrix.
        `axis` - A vector representing an axis.
        `out` - The output matrix.
      Returns:
        `out`

    - #### row

          public static final VectorM4D row(MatrixReadable4x4DType m,
                      int row,
                      VectorM4D out)

      Parameters:
        `m` - The matrix
        `row` - The row
        `out` - The output vector
      Returns:
        Row `row` of the matrix `m` in the vector `out`.

    - #### scale

          public static final MatrixM4x4D scale(MatrixReadable4x4DType m,
                          double r,
                          MatrixM4x4D out)

      Scale all elements of the matrix `m` by the scaling value `r`, saving the result in `out`.
      Parameters:
        `out` - The output matrix.
        `m` - The input matrix.
        `r` - The scaling value.
      Returns:
        `m`

    - #### scaleInPlace

          public static final MatrixM4x4D scaleInPlace(MatrixM4x4D m,
                                 double r)

      Scale all elements of the matrix `m` by the scaling value `r`, saving the result in `m`.
      Parameters:
        `m` - The input matrix.
        `r` - The scaling value.
      Returns:
        `m`

    - #### scaleRow

          public static final MatrixM4x4D scaleRow(MatrixReadable4x4DType m,
                             int row,
                             double r,
                             MatrixM4x4D out)

      Scale row `r` of the matrix `m` by `r`, saving the result to row `r` of `out`.

      This is one of the three "elementary" operations defined on matrices. See Elementary operations .

      Parameters:
        `m` - The input matrix.
        `row` - The index of the row (0 <= row < 4).
        `r` - The scaling value.
        `out` - The output matrix.
      Returns:
        `out`

    - #### scaleRowInPlace

          public static final MatrixM4x4D scaleRowInPlace(MatrixM4x4D m,
                                    int row,
                                    double r)

      Scale row `row` of the matrix `m` by `r` , saving the result to row `r` of `m`.

      This is one of the three "elementary" operations defined on matrices. See Elementary operations .

      Parameters:
        `m` - The input matrix.
        `row` - The index of the row (0 <= row < 4).
        `r` - The scaling value.
      Returns:
        `out`

    - #### scaleRowInPlaceWithContext

          public static final MatrixM4x4D scaleRowInPlaceWithContext(MatrixM4x4D.Context context,
                                               MatrixM4x4D m,
                                               int row,
                                               double r)

      Scale row `row` of the matrix `m` by `r` , saving the result to row `r` of `m`. The function uses preallocated storage in `context` to avoid allocating memory.

      This is one of the three "elementary" operations defined on matrices. See Elementary operations .

      Parameters:
        `context` - Preallocated storage.
        `m` - The input matrix.
        `row` - The index of the row (0 <= row < 4).
        `r` - The scaling value.
      Returns:
        `m`

    - #### scaleRowWithContext

          public static final MatrixM4x4D scaleRowWithContext(MatrixM4x4D.Context context,
                                        MatrixReadable4x4DType m,
                                        int row,
                                        double r,
                                        MatrixM4x4D out)

      Scale row `row` of the matrix `m` by `r` , saving the result to row `r` of `out`. The function uses preallocated storage in `context` to avoid allocating memory.

      This is one of the three "elementary" operations defined on matrices. See Elementary operations .

      Parameters:
        `context` - Preallocated storage.
        `m` - The input matrix.
        `row` - The index of the row (0 <= row < 4).
        `r` - The scaling value.
        `out` - The output matrix.
      Returns:
        `out`

    - #### set

          public static final MatrixM4x4D set(MatrixM4x4D m,
                        int row,
                        int column,
                        double value)

      Set the value in the matrix `m` at row `row`, column `column` to `value`.
      Parameters:
        `m` - The matrix
        `row` - The row
        `column` - The column
        `value` - The value
      Returns:
        `m`

    - #### setIdentity

          public static final MatrixM4x4D setIdentity(MatrixM4x4D m)

      Set the given matrix `m` to the identity matrix.
      Parameters:
        `m` - The matrix
      Returns:
        `m`

    - #### setZero

          public static final MatrixM4x4D setZero(MatrixM4x4D m)

      Set the given matrix `m` to the zero matrix.
      Parameters:
        `m` - The matrix
      Returns:
        `m`

    - #### trace

          public static final double trace(MatrixReadable4x4DType m)

      Return the trace of the matrix `m`. The trace is defined as the sum of the diagonal elements of the matrix.
      Parameters:
        `m` - The input matrix
      Returns:
        The trace of the matrix
      Since:
        5.0.0

    - #### translateByVector2D

          public static final MatrixM4x4D translateByVector2D(MatrixReadable4x4DType m,
                                        VectorReadable2DType v,
                                        MatrixM4x4D out)

      Translate the matrix `m` by the vector `v`, storing the resulting matrix in `out`.
      Parameters:
        `m` - The input matrix.
        `v` - The translation vector.
        `out` - The output matrix.
      Returns:
        `out`

    - #### translateByVector2DInPlace

          public static final MatrixM4x4D translateByVector2DInPlace(MatrixM4x4D m,
                                               VectorReadable2DType v)

      Translate the matrix `m` by the vector `v`, storing the resulting matrix in `m`.
      Parameters:
        `m` - The input matrix.
        `v` - The translation vector.
      Returns:
        `m`

    - #### translateByVector2I

          public static final MatrixM4x4D translateByVector2I(MatrixReadable4x4DType m,
                                        VectorReadable2IType v,
                                        MatrixM4x4D out)

      Translate the matrix `m` by the vector `v`, storing the resulting matrix in `out`.
      Parameters:
        `m` - The input matrix.
        `v` - The translation vector.
        `out` - The output matrix.
      Returns:
        `out`

    - #### translateByVector2IInPlace

          public static final MatrixM4x4D translateByVector2IInPlace(MatrixM4x4D m,
                                               VectorReadable2IType v)

      Translate the matrix `m` by the vector `v`, storing the resulting matrix in `m`.
      Parameters:
        `m` - The input matrix.
        `v` - The translation vector.
      Returns:
        `m`

    - #### translateByVector3D

          public static final MatrixM4x4D translateByVector3D(MatrixReadable4x4DType m,
                                        VectorReadable3DType v,
                                        MatrixM4x4D out)

      Translate the matrix `m` by the vector `v`, storing the resulting matrix in `out`.
      Parameters:
        `m` - The input matrix.
        `v` - The translation vector.
        `out` - The output matrix.
      Returns:
        `out`

    - #### translateByVector3DInPlace

          public static final MatrixM4x4D translateByVector3DInPlace(MatrixM4x4D m,
                                               VectorReadable3DType v)

      Translate the matrix `m` by the vector `v`, storing the resulting matrix in `m`.
      Parameters:
        `m` - The input matrix.
        `v` - The translation vector.
      Returns:
        `m`

    - #### translateByVector3I

          public static final MatrixM4x4D translateByVector3I(MatrixReadable4x4DType m,
                                        VectorReadable3IType v,
                                        MatrixM4x4D out)

      Translate the matrix `m` by the vector `v`, storing the resulting matrix in `out`.
      Parameters:
        `m` - The input matrix.
        `v` - The translation vector.
        `out` - The output matrix.
      Returns:
        `out`

    - #### translateByVector3IInPlace

          public static final MatrixM4x4D translateByVector3IInPlace(MatrixM4x4D m,
                                               VectorReadable3IType v)

      Translate the matrix `m` by the vector `v`, storing the resulting matrix in `m`.
      Parameters:
        `m` - The input matrix.
        `v` - The translation vector.
      Returns:
        `m`

    - #### transpose

          public static final MatrixM4x4D transpose(MatrixReadable4x4DType m,
                              MatrixM4x4D out)

      Transpose the given matrix `m`, writing the resulting matrix to `out`.
      Parameters:
        `m` - The input matrix.
        `out` - The output matrix.
      Returns:
        `out`

    - #### transposeInPlace

          public static final MatrixM4x4D transposeInPlace(MatrixM4x4D m)

      Transpose the given matrix `m`, writing the resulting matrix to `m`.
      Parameters:
        `m` - The input matrix.
      Returns:
        `m`

    - #### equals

          public final boolean equals(@Nullable
                       Object obj)

      Overrides:
        `equals` in class `Object`

    - #### get

          public final double get(int row,
                   int column)

      Parameters:
        `row` - The row
        `column` - The column
      Returns:
        The value at the given row and column

    - #### getDoubleBuffer

          public final DoubleBuffer getDoubleBuffer()

      Specified by:
        `getDoubleBuffer` in interface `MatrixReadableDType`
      Returns:
        A view of the buffer that backs this matrix.

    - #### getRow4D

          public final void getRow4D(int row,
                      VectorM4D out)

      Description copied from interface: `MatrixReadable4x4DType`
      Retrieve row `row`, saving the result to `out`.
      Specified by:
        `getRow4D` in interface `MatrixReadable4x4DType`
      Parameters:
        `row` - The index of the row, starting at `0`.
        `out` - The output vector.

    - #### getRowColumnD

          public final double getRowColumnD(int row,
                             int column)

      Specified by:
        `getRowColumnD` in interface `MatrixReadableDType`
      Parameters:
        `row` - The row
        `column` - The column
      Returns:
        The value from the matrix at row `row` , column `column`.

    - #### hashCode

          public final int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### set

          public final MatrixM4x4D set(int row,
                        int column,
                        double value)

      Set the value at the given row and column.
      Parameters:
        `row` - The row
        `column` - The column
        `value` - The value
      Returns:
        `this`

    - #### toString

          public final String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2014 <code@io7m.com> http://io7m.com