Module omix.api

Class Matrix4d

java.lang.Object
omix.util.math.vector.Matrix4d

public class Matrix4d
extends Object
This class is a 4 × 4 matrix with double precision.
Author:
Dr. Peter Droste, Omix Visualization
  • Nested Class Summary

    Nested Classes 
    Modifier and Type Class Description
    static class  Matrix4d.RotationType
    Describes the type of rotation matrix.
  • Constructor Summary

    Constructors 
    Constructor Description
    Matrix4d()
    4 × 4 zeros.
    Matrix4d​(Matrix4d.RotationType type, double angle)
    Initializes a rotation matrix of given type with the given angle.
    Matrix4d​(Vec4d pos)
    Transpation matrix.
    The matrix has the form:
    |1, 0, 0, pos.x|
    |0, 1, 0, pos.y|
    |0, 0, 1, pos.z|
    |0, 0, 0, pos.w|
    Matrix4d​(Vec4d axis, double angle)
    Initializes a rotation matrix about the given axis with the given angle.
    Matrix4d​(Vec4d xAxis, Vec4d yAxis, Vec4d zAxis)
    Rotation matrix.
    The matrix has the form:
    |xAxis.x, yAxis.x, zAxis.x, 0|
    |xAxis.y, yAxis.y, zAxis.y, 0|
    |xAxis.z, yAxis.z, zAxis.z, 0|
    |xAxis.w, yAxis.w, zAxis.w, 1|
  • Method Summary

    Modifier and Type Method Description
    Matrix4d dot​(double a)
    Scale
    Matrix4d dot​(Matrix4d matrix)
    Scalar product
    Vec4d dot​(Vec4d vector)
    Product with a vector.
    double get​(int i, int j)
    Returns the value of the matrix index (i,j).
    Matrix4d plus​(Matrix4d matrix)
    Addition
    void set​(int i, int j, double value)
    Sets the value of the matrix index (i,j).
    String toString()  
    Matrix4d transponate()
    Transponates the matrix.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Matrix4d

      public Matrix4d()
      4 × 4 zeros.
    • Matrix4d

      public Matrix4d​(Vec4d pos)
      Transpation matrix.
      The matrix has the form:
      |1, 0, 0, pos.x|
      |0, 1, 0, pos.y|
      |0, 0, 1, pos.z|
      |0, 0, 0, pos.w|
      Parameters:
      pos -
    • Matrix4d

      public Matrix4d​(Vec4d xAxis, Vec4d yAxis, Vec4d zAxis)
      Rotation matrix.
      The matrix has the form:
      |xAxis.x, yAxis.x, zAxis.x, 0|
      |xAxis.y, yAxis.y, zAxis.y, 0|
      |xAxis.z, yAxis.z, zAxis.z, 0|
      |xAxis.w, yAxis.w, zAxis.w, 1|
      Parameters:
      xAxis - Direction of the target X axis
      yAxis - Direction of the target Y axis
      zAxis - Direction of the target Z axis
    • Matrix4d

      public Matrix4d​(Vec4d axis, double angle)
      Initializes a rotation matrix about the given axis with the given angle.
      Parameters:
      axis - rotation axis
      angle - angle in radians
    • Matrix4d

      public Matrix4d​(Matrix4d.RotationType type, double angle)
      Initializes a rotation matrix of given type with the given angle.
      Parameters:
      type - rotation axis
      angle - angle in radians
  • Method Details

    • transponate

      public Matrix4d transponate()
      Transponates the matrix.
      Returns:
      thisT
    • dot

      public Matrix4d dot​(Matrix4d matrix)
      Scalar product
      Parameters:
      matrix -
      Returns:
      this⋅matrix
    • set

      public void set​(int i, int j, double value)
      Sets the value of the matrix index (i,j).
      Parameters:
      i -
      j -
      value -
    • get

      public double get​(int i, int j)
      Returns the value of the matrix index (i,j).
      Parameters:
      i -
      j -
      Returns:
      value at i,j
    • plus

      public Matrix4d plus​(Matrix4d matrix)
      Addition
      Parameters:
      matrix -
      Returns:
      this + matrix
    • dot

      public Matrix4d dot​(double a)
      Scale
      Parameters:
      a -
      Returns:
      this⋅a
    • dot

      public Vec4d dot​(Vec4d vector)
      Product with a vector.
      Parameters:
      vector -
      Returns:
      this⋅vector
    • toString

      public String toString()
      Overrides:
      toString in class Object
      See Also:
      Object.toString()