Class Matrices

java.lang.Object
io.sf.jclf.math.linear3.Matrices

public class Matrices extends Object
Basic operations with 3x3 matrices.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static double
    determinant3(double[][] a)
     
    static void
    inverse3(double[][] a, double[][] inverse)
    Compute the inverse of a 3x3 matrix a.
    static void
    multiplyByMatrix3(double[][] a, double[][] b, double[][] result)
    Multiply the 3x3 matrix a by 3x3 matrix b.
    static void
    multiplyByVector3(double[][] a, double[] v, double[] result)
    Multiply the 3x3 matrix a by tri-vector v.
    static void
    multiplyByVector3(double[][] a, double x, double y, double z, double[] result)
    Multiply the 3x3 matrix a by a 3-vector of components x, y and z.
    static double[][]
    rotation(double[] u, double angleRad)
    Create a rotation matrix respect to the given axis.
    static double[][]
    rotX(double angleRad)
    Create a x-rotation matrix.
    static double[][]
    rotY(double angleRad)
    Create a y-rotation matrix.
    static double[][]
    rotZ(double angleRad)
    Create a z-rotation matrix.
    static void
    transpose3(double[][] a)
    In-place transposition of a 3x3 matrix.

    Methods inherited from class java.lang.Object

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

    • Matrices

      public Matrices()
  • Method Details

    • inverse3

      public static void inverse3(double[][] a, double[][] inverse)
      Compute the inverse of a 3x3 matrix a.
      Parameters:
      a - the matrix whose inverse has to be computed.
      inverse - the 3x3 matrix where the inverse is to be stored.
      Throws:
      IllegalArgumentException - if the determinant is null and the inverse cannot be computed.
    • determinant3

      public static double determinant3(double[][] a)
    • multiplyByVector3

      public static void multiplyByVector3(double[][] a, double[] v, double[] result)
      Multiply the 3x3 matrix a by tri-vector v.
      Parameters:
      a - the matrix to be multiplied.
      v - the tri-vector.
      result - the vector to store the result in.
    • multiplyByVector3

      public static void multiplyByVector3(double[][] a, double x, double y, double z, double[] result)
      Multiply the 3x3 matrix a by a 3-vector of components x, y and z.
      Parameters:
      a - the matrix to be multiplied.
      x - the first component of the vector.
      y - the second component of the vector.
      z - the third component of the vector.
      result - the vector to store the result in.
    • multiplyByMatrix3

      public static void multiplyByMatrix3(double[][] a, double[][] b, double[][] result)
      Multiply the 3x3 matrix a by 3x3 matrix b.
      Parameters:
      a - the first matrix operand.
      b - the second matrix operand.
      result - the 3x3 matrix where the result of the multiplication is to be stored.
    • transpose3

      public static void transpose3(double[][] a)
      In-place transposition of a 3x3 matrix.
      Parameters:
      a - the matrix to transpose.
    • rotX

      public static double[][] rotX(double angleRad)
      Create a x-rotation matrix.
      Parameters:
      angleRad - the rotation angle, in radians.
      Returns:
      the rotation matrix.
    • rotY

      public static double[][] rotY(double angleRad)
      Create a y-rotation matrix.
      Parameters:
      angleRad - the rotation angle, in radians.
      Returns:
      the rotation matrix.
    • rotZ

      public static double[][] rotZ(double angleRad)
      Create a z-rotation matrix.
      Parameters:
      angleRad - the rotation angle, in radians.
      Returns:
      the rotation matrix.
    • rotation

      public static double[][] rotation(double[] u, double angleRad)
      Create a rotation matrix respect to the given axis.
      Parameters:
      u - the unit vector defining the rotation axis.
      angleRad - the rotation angle, in radians.
      Returns:
      the rotation matrix.