Class Rotater
- java.lang.Object
-
- skyview.geometry.Transformer
-
- skyview.geometry.Rotater
-
- All Implemented Interfaces:
java.io.Serializable
,Component
public class Rotater extends Transformer implements Component
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Rotater
add(Rotater r)
Add an additional rotation to the current rotation.java.lang.String
getDescription()
Get a description of the componentprotected int
getInputDimension()
Get the input dimension to a Rotaterdouble[][]
getMatrix()
Return the double coefficients for the matrixjava.lang.String
getName()
Get the name of the componentprotected int
getOutputDimension()
Get the output dimension to a RotaterRotater
inverse()
This isn't really right...boolean
isInverse(Transformer trans)
Is this the inverse rotation?void
printOut()
Debug outputvoid
transform(double[] in, double[] out)
Multiple a vector by the matrix.Rotater
transpose()
Get the transpose of the Matrix.-
Methods inherited from class skyview.geometry.Transformer
transform, transform
-
-
-
-
Constructor Detail
-
Rotater
public Rotater(double[][] vectors) throws TransformationException
Create a matrix from input data. Each row should have the same number of elements but this is not checked. The user may enter a matrix that is not a rotation matrix.- Throws:
TransformationException
-
Rotater
public Rotater(java.lang.String order, double phi, double theta, double psi)
Form a rotation from the Euler angles - three successive rotations about specified Cartesian axesA rotation is positive when the reference frame rotates anticlockwise as seen looking towards the origin from the positive region of the specified axis.
The characters of ORDER define which axes the three successive rotations are about. A typical value is 'ZXZ', indicating that RMAT is to become the direction cosine matrix corresponding to rotations of the reference frame through PHI radians about the old Z-axis, followed by THETA radians about the resulting X-axis, then PSI radians about the resulting Z-axis.
The axis names can be any of the following, in any order or combination: X, Y, Z, uppercase or lowercase, 1, 2, 3. Normal axis labelling/numbering conventions apply; the xyz (=123) triad is right-handed. Thus, the 'ZXZ' example given above could be written 'zxz' or '313' (or even 'ZxZ' or '3xZ'). ORDER is terminated by length or by the first unrecognized character.
Fewer than three rotations are acceptable, in which case the later angle arguments are ignored. If all rotations are zero, the identity matrix is produced.
- Parameters:
order
- specifies about which axes the rotations occurphi
- 1st rotation (radians)theta
- 2nd rotation ( " )psi
- 3rd rotation ( " )
-
-
Method Detail
-
getInputDimension
protected int getInputDimension()
Get the input dimension to a Rotater- Specified by:
getInputDimension
in classTransformer
-
getOutputDimension
protected int getOutputDimension()
Get the output dimension to a Rotater- Specified by:
getOutputDimension
in classTransformer
-
getName
public java.lang.String getName()
Get the name of the component
-
getDescription
public java.lang.String getDescription()
Get a description of the component- Specified by:
getDescription
in interfaceComponent
-
getMatrix
public double[][] getMatrix()
Return the double coefficients for the matrix
-
transpose
public Rotater transpose()
Get the transpose of the Matrix. For rotation matrices, the transpose is the inverse. This uses a create-on-demand protocol which creates the transpose matrix on the first transpose call and simply returns the reference in later calls.
-
inverse
public Rotater inverse()
This isn't really right... We should check this is a rotation matrix better!- Specified by:
inverse
in classTransformer
-
add
public Rotater add(Rotater r)
Add an additional rotation to the current rotation. The current rotation is applied first, and then the additional rotation. This is equivalent to multiply the old matrix by the new matrix with new matrix on the left.
-
transform
public void transform(double[] in, double[] out)
Multiple a vector by the matrix.- Specified by:
transform
in classTransformer
- Parameters:
in
- The input vector.out
- The output vector, it may be the same as the input vector if the dimensionalities are the same. All transformers are expected to work with aliased inputs and output.
-
isInverse
public boolean isInverse(Transformer trans)
Is this the inverse rotation?- Specified by:
isInverse
in classTransformer
-
printOut
public void printOut()
Debug output
-
-