Class RotationMatrix

Object
RotationMatrix
All Implemented Interfaces:
Serializable

public class RotationMatrix extends Object implements Serializable
A matrix that performs a rotation in Euclidean space.
Author:
Owen Feehan
See Also:
  • Constructor Details

    • RotationMatrix

      public RotationMatrix(int numberDimensions)
      Creates a rotation-matrix populated only with zeros.
      Parameters:
      numberDimensions - the dimensionality of the matrix to create.
    • RotationMatrix

      public RotationMatrix(cern.colt.matrix.DoubleMatrix2D matrix)
      Creates a rotation-matrix from an existing DoubleMatrix2D.
      Parameters:
      matrix - the matrix, which is then used internally in the structure.
  • Method Details

    • rotatePoint

      public Point3d rotatePoint(Tuple3d point)
      Performs a rotation on a single point, encoded as a Point3d.

      The existing value of Point3d remains unmodified.

      Parameters:
      point - the point to rotate.
      Returns:
      a newly-created rotated point.
    • rotatePointInplace

      public void rotatePointInplace(Point3d point)
      Performs a rotation on a single point, replacing the existing value of the point.
      Parameters:
      point - the point to rotate, and to which the rotated point's value is assigned.
    • column

      public Point3d column(int columnIndex) throws OperationFailedException
      Extracts a column from the rotation-matrix as a point.

      This should only be called on a three-dimensional rotation matrix.

      Parameters:
      columnIndex - the index of the column.
      Returns:
      a newly created point from the column.
      Throws:
      OperationFailedException - if the rotation-matrix does not have three dimensions exactly.
    • getNumberDimensions

      public int getNumberDimensions()
      The number of dimensions in the rotation-matrix.
      Returns:
      the number of dimensions.
    • getMatrix

      public cern.colt.matrix.DoubleMatrix2D getMatrix()
      The underlying matrix used internally in the rotation-matrix.
      Returns:
      the internal matrix structure used within the RotationMatrix.
    • multiplyByConstant

      public void multiplyByConstant(double value)
      Multiplies each element in the rotation-matrix by a value.
      Parameters:
      value - the value to multiply each element by.
    • transpose

      public RotationMatrix transpose()
      Transposes the matrix immutably.
      Returns:
      a newly-created RotationMatrix that is a transposed copy.
    • duplicate

      public RotationMatrix duplicate()
      Deep-copy of the current rotation-matrix.
      Returns:
      a newly created deep copy of the current object.
    • toString

      public String toString()
      Overrides:
      toString in class Object