Class Matrix

java.lang.Object
com.ijurnove.cpu3d.Matrix

public class Matrix extends Object
A Matrix stores a two dimensional array of doubles.
  • Field Details

    • AXIS_CONV_MATRIX

      protected static final Matrix AXIS_CONV_MATRIX
  • Constructor Details

    • Matrix

      public Matrix(double[][] values)
      Constructs a new Matrix filled with a specified set of values.
      Parameters:
      values - the initial Matrix values
  • Method Details

    • getValues

      public double[][] getValues()
      Returns the values within the Matrix as a double[][].
      Returns:
      the values within this Matrix
    • columnCount

      public int columnCount()
      Returns the number of columns.
      Returns:
      the number of columns
    • rowCount

      public int rowCount()
      Returns the number of rows.
      Returns:
      the number of rows
    • setValue

      public void setValue(int col, int row, double newVal)
      Sets the item at a specified row and column.
      Parameters:
      col - the column of the item to set
      row - the row of the item to set
      newVal - the value to set
    • getValue

      public double getValue(int col, int row)
      Returns the value at a specified row and column.
      Parameters:
      col - the column of the item
      row - the row of the item
    • getRow

      public double[] getRow(int rowNum)
      Returns an entire row of the Matrix as a double[]
      Parameters:
      rowNum - the row to be returned
      Returns:
      a specified row
    • getColumn

      public double[] getColumn(int columnNum)
      Returns an entire column of the Matrix as a double[].
      Parameters:
      columnNum - the column to be returned
      Returns:
      a specified column
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • setValues

      public void setValues(Matrix newValues)
      Sets all values in this Matrix to the values of another.
      Parameters:
      newValues - the Matrix to fill this one
    • scalarMult

      public static void scalarMult(Matrix m, double factor)
      Multiplies all items of a Matrix by a number.
      Parameters:
      m - the Matrix to be multiplied
      factor - the number to multiply all numbers in the Matrix by
    • scalarMult

      public void scalarMult(double factor)
      Multiplies all items of this Matrix by a number.
      Parameters:
      factor - the number to multiply all numbers in this Matrix by
    • multiply

      public static Matrix multiply(Matrix matrix1, Matrix matrix2)
      Multiplies two Matrixes together.
      Parameters:
      matrix1 - the first Matrix
      matrix2 - the second Matrix
      Returns:
      the product of the two Matrices
    • multiply

      public Matrix multiply(Matrix matrix2)
      Multiplies this Matrix by another.
      Parameters:
      matrix2 - the Matrix to multiply this one by
      Returns:
      the product of this Matrix and the given Matrix
    • perspRenderUpd

      protected void perspRenderUpd(Camera c)
    • perspRenderUpdForPointShadowMap

      protected void perspRenderUpdForPointShadowMap(Camera c)
    • orthoRenderUpd

      protected void orthoRenderUpd(Camera c)
    • lookAt

      protected static Matrix lookAt(Vector3d rightVec, Vector3d upVec, Vector3d fwdVec, Point3d pos)