Package math.matrices

Class Matrix

java.lang.Object
math.matrices.Matrix
Direct Known Subclasses:
RotationMatrix

public class Matrix
extends java.lang.Object
  • Constructor Details

    • Matrix

      public Matrix​(Vector r1, Vector r2, Vector r3)
      Matrix constructor which takes three Vectors.
      Parameters:
      r1 - The first row.
      r2 - The second row.
      r3 - The third row.
  • Method Details

    • scale

      public Matrix scale​(double t)
      Mutlyply the matrix by a scalar.
      Parameters:
      t - The scalar to multiply the matrix by.
      Returns:
      A new matrix which is the result of the multiplication.
    • multiply

      public <T extends Triple> T multiply​(Triple triple, DoubleTriFunction<T> creator)
      Multiply the matrix by a Triple.
      Type Parameters:
      T - The type of Triple to return.
      Parameters:
      triple - The Triple to multiply by the matrix.
      creator - A function which receives three doubles and returns some subtype of Triple.
      Returns:
      The Triple resulting from the multiplication, of the concrete type as returned by creator.
    • multiply

      public Point multiply​(Point p)
      Multiply the matrix by a Point.
      Parameters:
      p - The Point to multiply by the matrix.
      Returns:
      The Point resulting from the multiplication.
    • multiply

      public NonZeroVector multiply​(NonZeroVector v)
      Multiply the matrix by a NonZeroVector.
      Parameters:
      v - The NonZeroVector to multiply by the matrix.
      Returns:
      The NonZeroVector resulting from the multiplication.
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object