org.jscience.astronomy.solarsystem.coordinates
Class Rotater

java.lang.Object
  extended by org.jscience.astronomy.solarsystem.coordinates.Transformer
      extended by org.jscience.astronomy.solarsystem.coordinates.Rotater
All Implemented Interfaces:
Named

public class Rotater
extends Transformer
implements Named


Constructor Summary
Rotater(double[][] vectors)
          Create a matrix from input data.
Rotater(java.lang.String order, double phi, double theta, double psi)
          Form a rotation from the Euler angles - three successive rotations about specified Cartesian axes A rotation is positive when the reference frame rotates anticlockwise as seen looking towards the origin from the positive region of the specified axis.
 
Method Summary
 Rotater add(Rotater r)
          Add an additional rotation to the current rotation.
 java.lang.String getDescription()
          Get a description of the component
protected  int getInputDimension()
          Get the input dimension to a Rotater
 double[][] getMatrix()
          Return the double coefficients for the matrix
 java.lang.String getName()
          Get the name of the component
protected  int getOutputDimension()
          Get the output dimension to a Rotater
 Rotater inverse()
          This isn't really right...
 boolean isInverse(Transformer trans)
          Is this the inverse rotation?
 void printOut()
          Debug output
 void transform(double[] in, double[] out)
          Multiple a vector by the matrix.
 Rotater transpose()
          Get the transpose of the Matrix.
 
Methods inherited from class org.jscience.astronomy.solarsystem.coordinates.Transformer
transform, transform
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 axes

A 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 occur
phi - 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 class Transformer

getOutputDimension

protected int getOutputDimension()
Get the output dimension to a Rotater

Specified by:
getOutputDimension in class Transformer

getName

public java.lang.String getName()
Get the name of the component

Specified by:
getName in interface Named
Returns:
DOCUMENT ME!

getDescription

public java.lang.String getDescription()
Get a description of the component


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 class Transformer

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 class Transformer
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 class Transformer

printOut

public void printOut()
Debug output