Class Transformer

  • All Implemented Interfaces:
    java.io.Serializable, Component
    Direct Known Subclasses:
    Converter, Deprojecter, Distorter, Projecter, Rotater, Scaler, SphereDistorter

    public abstract class Transformer
    extends java.lang.Object
    implements Component
    The Transformer class is the superclass for a variety of classes that transform positions represented in one frame to another. The subclasses of Transformer include:
    • Projecter 3/2: Transform celestial coordinates to a projection plane.
    • Deprojecter 2/3: Transform coordinates in a projection plane to the celestial sphere.
    • Rotater 3/3: Rotate coordinates in the celestial sphere
    • SphereDistorter 3/3: Non-linear transformations in the celestial sphere.
    • Distorter 2/2: Non-linear transformations in the projection plane
    • Scaler 2/2: Affine transformations in the projection plane
    • Converter: Apply a series of conversions in turn.
    The numbers after the type indicate the dimensionality of the input/output.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      Transformer()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected abstract int getInputDimension()
      Get the dimensionality of the input vectors.
      protected abstract int getOutputDimension()
      Get the dimensionality of the output vectors.
      abstract Transformer inverse()
      Get the inverse of the transformation.
      abstract boolean isInverse​(Transformer trans)
      Are these two transformations, inverses of each other? This method is used to optimize a series of transformations where transformations.
      double[] transform​(double[] in)
      Convert a single point.
      void transform​(double[][] in, double[][] out)
      Convert an array of points where the output vectors are supplied.
      abstract void transform​(double[] in, double[] out)
      Convert a single point where the output vector is supplied.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Transformer

        public Transformer()
    • Method Detail

      • getOutputDimension

        protected abstract int getOutputDimension()
        Get the dimensionality of the output vectors.
      • getInputDimension

        protected abstract int getInputDimension()
        Get the dimensionality of the input vectors.
      • transform

        public double[] transform​(double[] in)
        Convert a single point. This method creates a new object and is not recommended when high throughput is needed.
        Parameters:
        in - An array giving the input vector.
        Returns:
        An array giving the transformed vector. For projections and deprojections this will have a different dimension
      • inverse

        public abstract Transformer inverse()
                                     throws TransformationException
        Get the inverse of the transformation. If the order matters, then the inverse is to be applied after the original transformation. This is primarily an issue with Converters.
        Throws:
        TransformationException
      • transform

        public abstract void transform​(double[] in,
                                       double[] out)
        Convert a single point where the output vector is supplied.
        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 abstract boolean isInverse​(Transformer trans)
        Are these two transformations, inverses of each other? This method is used to optimize a series of transformations where transformations.
      • transform

        public void transform​(double[][] in,
                              double[][] out)
                       throws TransformationException
        Convert an array of points where the output vectors are supplied. The vectors should have dimensionality [2][n] or [3][n]. The first dimension gives the index within the vector while the second gives which vector is being processed. This means that the user needs to create only a few objects (3 or 4) rather than of order n objects for each array. In practice this seems to speed up code by a factor of 4. (JDK1.5).
        Parameters:
        in - A set of positions to be transformed. The first dimension should be consistent with getInputDimension, while the second is the number of points to be transferred.
        out - The updated positions. The first dimension should be consistent with getOutputDimension, while the second is the number of points to be transferred. This argument may point to the same data as the input.
        Throws:
        TransformationException