Package com.io7m.jtensors.core.parameterized.matrices

# Class PMatrices3x3F

java.lang.Object
com.io7m.jtensors.core.parameterized.matrices.PMatrices3x3F

    public final class PMatrices3x3F
    extends java.lang.Object

Functions over `PMatrix3x3F` values.

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

Since:
  8.0.0

- ## Method Summary

  Modifier and Type | Method | Description
  --- | --- | ---
  `static <A,​ B,​ C,​ D,​ E,​ F> PMatrix3x3F<E,​F>` | `add​(PMatrix3x3F<A,​B> m0, PMatrix3x3F<C,​D> m1)` | Add the matrices `m0` and `m1`.
  `static <A,​ B> Vector3F` | `column0​(PMatrix3x3F<A,​B> m)` |
  `static <A,​ B> Vector3F` | `column1​(PMatrix3x3F<A,​B> m)` |
  `static <A,​ B> Vector3F` | `column2​(PMatrix3x3F<A,​B> m)` |
  `static <A,​ B> double` | `determinant​(PMatrix3x3F<A,​B> m)` | Calculate the determinant of the matrix `m`.
  `static <A,​ B> PMatrix3x3F<A,​B>` | `identity()` | The identity matrix.
  `static <A,​ B> java.util.Optional<PMatrix3x3F<B,​A>>` | `invert​(PMatrix3x3F<A,​B> m)` | Calculate the inverse of the matrix `m`.
  `static <A,​ B,​ C> PMatrix3x3F<A,​C>` | `multiply​(PMatrix3x3F<B,​C> m0, PMatrix3x3F<A,​B> m1)` | Multiply the matrices `m0` and `m1`.
  `static <A,​ B> PVector3F<B>` | `multiplyVectorPost​(PMatrix3x3F<A,​B> m, PVector3F<A> v)` | Multiply the vector `v` by the matrix `m`.
  `static Vector3F` | `multiplyVectorPost​(PMatrix3x3F m, Vector3F v)` | Multiply the vector `v` by the matrix `m`.
  `static <A,​ B> PMatrix3x3F<A,​B>` | `ofAxisAngle​(double axis_x, double axis_y, double axis_z, double angle)` | Construct a matrix that will rotate by `angle` radians around the axis `(x, y, z)`.
  `static <A,​ B> PMatrix3x3F<A,​B>` | `ofColumns​(Vector3F c0, Vector3F c1, Vector3F c2)` | Construct a matrix from the column vectors `(c0, c1, c2)`.
  `static <A,​ B> PMatrix3x3F<A,​B>` | `ofRows​(Vector3F r0, Vector3F r1, Vector3F r2)` | Construct a matrix from the row vectors `(r0, r1, r2)`.
  `static <A,​ B> PMatrix3x3F<A,​B>` | `ofScale​(double x, double y, double z)` | Construct a matrix that will scale by `(x, y, z)`.
  `static <A,​ B> Vector3F` | `row0​(PMatrix3x3F<A,​B> m)` |
  `static <A,​ B> Vector3F` | `row1​(PMatrix3x3F<A,​B> m)` |
  `static <A,​ B> Vector3F` | `row2​(PMatrix3x3F<A,​B> m)` |
  `static <A,​ B,​ C,​ D> PMatrix3x3F<C,​D>` | `scale​(PMatrix3x3F<A,​B> m, double r)` | Scale the matrix `m` by `r`.
  `static <A,​ B,​ C,​ D,​ E,​ F> PMatrix3x3F<E,​F>` | `subtract​(PMatrix3x3F<A,​B> m0, PMatrix3x3F<C,​D> m1)` | Subtract the matrices `m0` and `m1`.
  `static <A,​ B> PMatrix3x3F<A,​B>` | `toParameterized​(Matrix3x3F m)` |
  `static <A,​ B> Matrix3x3F` | `toUnparameterized​(PMatrix3x3F<A,​B> m)` |
  `static <A,​ B> double` | `trace​(PMatrix3x3F<A,​B> m)` | Return the trace of the matrix `m`.
  `static <A,​ B> PMatrix3x3F<A,​B>` | `transpose​(PMatrix3x3F<A,​B> m)` | Calculate the transpose of the matrix `m`.
  `static <A,​ B> PMatrix3x3F<A,​B>` | `withColumn​(PMatrix3x3F<A,​B> m, int column, float r0, float r1, float r2)` | Set the column `column` of `m` to `(r0, r1, r2)`.
  `static <A,​ B> PMatrix3x3F<A,​B>` | `withRow​(PMatrix3x3F<A,​B> m, int row, float c0, float c1, float c2)` | Set the row `row` of `m` to `(c0, c1, c2)`.
  `static <A,​ B> PMatrix3x3F<A,​B>` | `zero()` | The zero matrix.

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

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### add

    public static <A,​ B,​ C,​ D,​ E,​ F> PMatrix3x3F<E,​F> add​(PMatrix3x3F<A,​B> m0, PMatrix3x3F<C,​D> m1)
    Add the matrices `m0` and `m1`.
    Type Parameters:
      `A` - A phantom type parameter (possibly representing a source coordinate system)
      `B` - A phantom type parameter (possibly representing a target coordinate system)
      `C` - A phantom type parameter (possibly representing a source coordinate system)
      `D` - A phantom type parameter (possibly representing a target coordinate system)
      `E` - A phantom type parameter (possibly representing a source coordinate system)
      `F` - A phantom type parameter (possibly representing a target coordinate system)
    Parameters:
      `m0` - The left matrix
      `m1` - The right matrix
    Returns:
      `m0 + m1`

  - ### determinant

    public static <A,​ B> double determinant​(PMatrix3x3F<A,​B> m)
    Calculate the determinant of the matrix `m`.
    Type Parameters:
      `A` - A phantom type parameter (possibly representing a source coordinate system)
      `B` - A phantom type parameter (possibly representing a target coordinate system)
    Parameters:
      `m` - The matrix
    Returns:
      The determinant of `m`

  - ### invert

    public static <A,​ B> java.util.Optional<PMatrix3x3F<B,​A>> invert​(PMatrix3x3F<A,​B> m)
    Calculate the inverse of the matrix `m`.
    Type Parameters:
      `A` - A phantom type parameter (possibly representing a source coordinate system)
      `B` - A phantom type parameter (possibly representing a target coordinate system)
    Parameters:
      `m` - The matrix
    Returns:
      The inverse of `m`, or nothing if no inverse exists

  - ### multiply

    public static <A,​ B,​ C> PMatrix3x3F<A,​C> multiply​(PMatrix3x3F<B,​C> m0, PMatrix3x3F<A,​B> m1)
    Multiply the matrices `m0` and `m1`.
    Type Parameters:
      `A` - A phantom type parameter (possibly representing a source coordinate system)
      `B` - A phantom type parameter (possibly representing a target coordinate system)
      `C` - A phantom type parameter (possibly representing a source coordinate system)
    Parameters:
      `m0` - The left matrix
      `m1` - The right matrix
    Returns:
      `m0 * m1`

  - ### multiplyVectorPost

    public static <A,​ B> PVector3F<B> multiplyVectorPost​(PMatrix3x3F<A,​B> m, PVector3F<A> v)

    Multiply the vector `v` by the matrix `m`.

    This is post multiplication.

    Type Parameters:
      `A` - A phantom type parameter (possibly representing a source coordinate system)
      `B` - A phantom type parameter (possibly representing a target coordinate system)
    Parameters:
      `m` - The matrix
      `v` - The vector
    Returns:
      `m * v`

  - ### multiplyVectorPost

    public static Vector3F multiplyVectorPost​(PMatrix3x3F m, Vector3F v)

    Multiply the vector `v` by the matrix `m`.

    This is post multiplication.

    Parameters:
      `m` - The matrix
      `v` - The vector
    Returns:
      `m * v`

  - ### ofColumns

    public static <A,​ B> PMatrix3x3F<A,​B> ofColumns​(Vector3F c0, Vector3F c1, Vector3F c2)
    Construct a matrix from the column vectors `(c0, c1, c2)`.
    Type Parameters:
      `A` - A phantom type parameter (possibly representing a source coordinate system)
      `B` - A phantom type parameter (possibly representing a target coordinate system)
    Parameters:
      `c0` - The column 0
      `c1` - The column 1
      `c2` - The column 2
    Returns:
      A constructed matrix

  - ### ofRows

    public static <A,​ B> PMatrix3x3F<A,​B> ofRows​(Vector3F r0, Vector3F r1, Vector3F r2)
    Construct a matrix from the row vectors `(r0, r1, r2)`.
    Type Parameters:
      `A` - A phantom type parameter (possibly representing a source coordinate system)
      `B` - A phantom type parameter (possibly representing a target coordinate system)
    Parameters:
      `r0` - The row 0
      `r1` - The row 1
      `r2` - The row 2
    Returns:
      A constructed matrix

  - ### ofScale

    public static <A,​ B> PMatrix3x3F<A,​B> ofScale​(double x, double y, double z)
    Construct a matrix that will scale by `(x, y, z)`.
    Type Parameters:
      `A` - A phantom type parameter (possibly representing a source coordinate system)
      `B` - A phantom type parameter (possibly representing a target coordinate system)
    Parameters:
      `x` - The X scaling value
      `y` - The Y scaling value
      `z` - The Z scaling value
    Returns:
      A constructed matrix

  - ### ofAxisAngle

    public static <A,​ B> PMatrix3x3F<A,​B> ofAxisAngle​(double axis_x, double axis_y, double axis_z, double angle)
    Construct a matrix that will rotate by `angle` radians around the axis `(x, y, z)`.
    Type Parameters:
      `A` - A phantom type parameter (possibly representing a source coordinate system)
      `B` - A phantom type parameter (possibly representing a target coordinate system)
    Parameters:
      `angle` - The angle in radians
      `axis_x` - The X axis value
      `axis_y` - The Y axis value
      `axis_z` - The Z axis value
    Returns:
      A constructed matrix

  - ### row0

    public static <A,​ B> Vector3F row0​(PMatrix3x3F<A,​B> m)
    Type Parameters:
      `A` - A phantom type parameter (possibly representing a source coordinate system)
      `B` - A phantom type parameter (possibly representing a source coordinate system)
    Parameters:
      `m` - The matrix
    Returns:
      Row 0 of the matrix

  - ### row1

    public static <A,​ B> Vector3F row1​(PMatrix3x3F<A,​B> m)
    Type Parameters:
      `A` - A phantom type parameter (possibly representing a source coordinate system)
      `B` - A phantom type parameter (possibly representing a source coordinate system)
    Parameters:
      `m` - The matrix
    Returns:
      Row 1 of the matrix

  - ### row2

    public static <A,​ B> Vector3F row2​(PMatrix3x3F<A,​B> m)
    Type Parameters:
      `A` - A phantom type parameter (possibly representing a source coordinate system)
      `B` - A phantom type parameter (possibly representing a source coordinate system)
    Parameters:
      `m` - The matrix
    Returns:
      Row 2 of the matrix

  - ### column0

    public static <A,​ B> Vector3F column0​(PMatrix3x3F<A,​B> m)
    Type Parameters:
      `A` - A phantom type parameter (possibly representing a source coordinate system)
      `B` - A phantom type parameter (possibly representing a source coordinate system)
    Parameters:
      `m` - The matrix
    Returns:
      Column 0 of the matrix

  - ### column1

    public static <A,​ B> Vector3F column1​(PMatrix3x3F<A,​B> m)
    Type Parameters:
      `A` - A phantom type parameter (possibly representing a source coordinate system)
      `B` - A phantom type parameter (possibly representing a source coordinate system)
    Parameters:
      `m` - The matrix
    Returns:
      Column 1 of the matrix

  - ### column2

    public static <A,​ B> Vector3F column2​(PMatrix3x3F<A,​B> m)
    Type Parameters:
      `A` - A phantom type parameter (possibly representing a source coordinate system)
      `B` - A phantom type parameter (possibly representing a source coordinate system)
    Parameters:
      `m` - The matrix
    Returns:
      Column 2 of the matrix

  - ### scale

    public static <A,​ B,​ C,​ D> PMatrix3x3F<C,​D> scale​(PMatrix3x3F<A,​B> m, double r)
    Scale the matrix `m` by `r`.
    Type Parameters:
      `A` - A phantom type parameter (possibly representing a source coordinate system)
      `B` - A phantom type parameter (possibly representing a target coordinate system)
      `C` - A phantom type parameter (possibly representing a source coordinate system)
      `D` - A phantom type parameter (possibly representing a target coordinate system)
    Parameters:
      `m` - The matrix
      `r` - The scale factor
    Returns:
      `m * r`

  - ### subtract

    public static <A,​ B,​ C,​ D,​ E,​ F> PMatrix3x3F<E,​F> subtract​(PMatrix3x3F<A,​B> m0, PMatrix3x3F<C,​D> m1)
    Subtract the matrices `m0` and `m1`.
    Type Parameters:
      `A` - A phantom type parameter (possibly representing a source coordinate system)
      `B` - A phantom type parameter (possibly representing a target coordinate system)
      `C` - A phantom type parameter (possibly representing a source coordinate system)
      `D` - A phantom type parameter (possibly representing a target coordinate system)
      `E` - A phantom type parameter (possibly representing a source coordinate system)
      `F` - A phantom type parameter (possibly representing a target coordinate system)
    Parameters:
      `m0` - The left matrix
      `m1` - The right matrix
    Returns:
      `m0 - m1`

  - ### trace

    public static <A,​ B> double trace​(PMatrix3x3F<A,​B> m)
    Return the trace of the matrix `m`. The trace is defined as the sum of the diagonal elements of the matrix.
    Type Parameters:
      `A` - A phantom type parameter (possibly representing a source coordinate system)
      `B` - A phantom type parameter (possibly representing a target coordinate system)
    Parameters:
      `m` - The matrix
    Returns:
      The trace of the matrix

  - ### transpose

    public static <A,​ B> PMatrix3x3F<A,​B> transpose​(PMatrix3x3F<A,​B> m)
    Calculate the transpose of the matrix `m`.
    Type Parameters:
      `A` - A phantom type parameter (possibly representing a source coordinate system)
      `B` - A phantom type parameter (possibly representing a target coordinate system)
    Parameters:
      `m` - The matrix
    Returns:
      The transpose of `m`

  - ### withColumn

    public static <A,​ B> PMatrix3x3F<A,​B> withColumn​(PMatrix3x3F<A,​B> m, int column, float r0, float r1, float r2)
    Set the column `column` of `m` to `(r0, r1, r2)`.
    Type Parameters:
      `A` - A phantom type parameter (possibly representing a source coordinate system)
      `B` - A phantom type parameter (possibly representing a target coordinate system) * @param r0 The value of row 0 in the column
    Parameters:
      `m` - The matrix
      `column` - The column index in the range `[0, 2]`
      `r1` - The value of row 1 in the column
      `r2` - The value of row 2 in the column
    Returns:
      A matrix with the given row

  - ### withRow

    public static <A,​ B> PMatrix3x3F<A,​B> withRow​(PMatrix3x3F<A,​B> m, int row, float c0, float c1, float c2)
    Set the row `row` of `m` to `(c0, c1, c2)`.
    Type Parameters:
      `A` - A phantom type parameter (possibly representing a source coordinate system)
      `B` - A phantom type parameter (possibly representing a target coordinate system)
    Parameters:
      `m` - The matrix
      `row` - The row index in the range `[0, 2]`
      `c0` - The value of column 0 in the row
      `c1` - The value of column 1 in the row
      `c2` - The value of column 2 in the row
    Returns:
      A matrix with the given row

  - ### zero

    public static <A,​ B> PMatrix3x3F<A,​B> zero()
    The zero matrix.
    Type Parameters:
      `A` - A phantom type parameter (possibly representing a source coordinate system)
      `B` - A phantom type parameter (possibly representing a target coordinate system)
    Returns:
      A matrix with all zero components

  - ### identity

    public static <A,​ B> PMatrix3x3F<A,​B> identity()
    The identity matrix.
    Type Parameters:
      `A` - A phantom type parameter (possibly representing a source coordinate system)
      `B` - A phantom type parameter (possibly representing a target coordinate system)
    Returns:
      A matrix with all diagonal components set to 1 and all other components set to 0.

  - ### toUnparameterized

    public static <A,​ B> Matrix3x3F toUnparameterized​(PMatrix3x3F<A,​B> m)
    Type Parameters:
      `A` - A phantom type parameter (possibly representing a source coordinate system)
      `B` - A phantom type parameter (possibly representing a target coordinate system)
    Parameters:
      `m` - The input matrix
    Returns:
      A matrix equal to `m` but without type parameters

  - ### toParameterized

    public static <A,​ B> PMatrix3x3F<A,​B> toParameterized​(Matrix3x3F m)
    Type Parameters:
      `A` - A phantom type parameter (possibly representing a source coordinate system)
      `B` - A phantom type parameter (possibly representing a target coordinate system)
    Parameters:
      `m` - The input matrix
    Returns:
      A matrix equal to `m` with type parameters