Class Rotater

    • Constructor Summary

      Constructors 
      Constructor Description
      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
    • 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 Component
      • getDescription

        public java.lang.String getDescription()
        Get a description of the component
        Specified by:
        getDescription in interface 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.
      • printOut

        public void printOut()
        Debug output