Class RotationMatrix
Object
RotationMatrix
- All Implemented Interfaces:
Serializable
A matrix that performs a rotation in
Euclidean space.
- Author:
- Owen Feehan
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionRotationMatrix(int numberDimensions) Creates a rotation-matrix populated only with zeros.RotationMatrix(cern.colt.matrix.DoubleMatrix2D matrix) Creates a rotation-matrix from an existingDoubleMatrix2D. -
Method Summary
Modifier and TypeMethodDescriptioncolumn(int columnIndex) Extracts a column from the rotation-matrix as a point.Deep-copy of the current rotation-matrix.cern.colt.matrix.DoubleMatrix2DThe underlying matrix used internally in the rotation-matrix.intThe number of dimensions in the rotation-matrix.voidmultiplyByConstant(double value) Multiplies each element in the rotation-matrix by a value.rotatePoint(Tuple3d point) Performs a rotation on a single point, encoded as aPoint3d.voidrotatePointInplace(Point3d point) Performs a rotation on a single point, replacing the existing value of the point.toString()Transposes the matrix immutably.
-
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 existingDoubleMatrix2D.- Parameters:
matrix- the matrix, which is then used internally in the structure.
-
-
Method Details
-
rotatePoint
Performs a rotation on a single point, encoded as aPoint3d.The existing value of
Point3dremains unmodified.- Parameters:
point- the point to rotate.- Returns:
- a newly-created rotated point.
-
rotatePointInplace
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
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
Transposes the matrix immutably.- Returns:
- a newly-created
RotationMatrixthat is a transposed copy.
-
duplicate
Deep-copy of the current rotation-matrix.- Returns:
- a newly created deep copy of the current object.
-
toString
-