uk.ac.starlink.ast
Class Transformer1

java.lang.Object
  extended by uk.ac.starlink.ast.Transformer
      extended by uk.ac.starlink.ast.Transformer1

public abstract class Transformer1
extends Transformer

Defines a custom one-dimensional coordinate transformation function. This abstract subclass of Transformer is provided for convenience when only a 1-d transformation is required. Subclasses need to implement the tran1 method, which is somewhat more convenient than Transformer's tranP method.

Version:
$Id$
Author:
Mark Taylor (Starlink)

Constructor Summary
Transformer1()
           
 
Method Summary
 boolean canTransformCoords(int nin, int nout)
          Indicates whether this Transformer is able to transform between coordinate spaces with the given dimensionalities.
abstract  double[] tran1(int npoint, double[] xin, boolean forward)
          Transforms points from 1-d input coordinates to 1-d output coordinates.
 double[][] tranP(int npoint, int ncoord_in, double[][] in, boolean forward, int ncoord_out)
          Transforms points from input coordinates to output coordinates.
 
Methods inherited from class uk.ac.starlink.ast.Transformer
getAuthor, getContact, getPurpose, hasForward, hasInverse, simpFI, simpIF
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Transformer1

public Transformer1()
Method Detail

canTransformCoords

public final boolean canTransformCoords(int nin,
                                        int nout)
Indicates whether this Transformer is able to transform between coordinate spaces with the given dimensionalities.

Specified by:
canTransformCoords in class Transformer
Parameters:
nin - the number of coordinates of an input point
nout - the number of coordinates of an output point
Returns:
true only if both nin and nout are equal to 1

tranP

public final double[][] tranP(int npoint,
                              int ncoord_in,
                              double[][] in,
                              boolean forward,
                              int ncoord_out)
                       throws Exception
Description copied from class: Transformer
Transforms points from input coordinates to output coordinates. This method does the work of the Transformer, taking an array of input coordinate arrays and returning an array of output coordinate arrays.

This method will only be called with forward set true if a prior call of the hasForward method has returned true, and will only be called with forward set false if a prior call of the hasInverse has returned true.

If forward is true, then this method will only be called with values of ncoord_in, ncoord_out for which a prior call of canTransform(ncoord_in,ncoord_out) has returned true.
If forward is false, then this method will only be called with values of ncoord_in, ncoord_out for which a prior call of canTransform(ncoord_out,ncoord_in) has returned true.

Specified by:
tranP in class Transformer
Parameters:
npoint - the number of points to be transformed
ncoord_in - the number of coordinates being supplied for each input point (the dimensionality of the input space)
in - an array of ncoord_in arrays, each containing npoint elements. These give the coordinates of each point to transform.
forward - true if the forward transformation is to be used, false if its inverse transformation is to be used
ncoord_out - the number of coordinates being generated by the transformation for each output point (the dimensionality of the output space). This need not be equal to ncoord_in.
Returns:
an array of ncoord_out arrays, each containing npoint elements. These give the coordinates of the transformed points. throws Exception If an error occurs during the transformation, this method may throw an Exception. In this case the transformation will be aborted.
Throws:
Exception

tran1

public abstract double[] tran1(int npoint,
                               double[] xin,
                               boolean forward)
                        throws Exception
Transforms points from 1-d input coordinates to 1-d output coordinates. This method does the work of the Transformer1, taking an input coordinate array and returning an output coordinate array.

This method will only be called with forward set true if a prior call of the hasForward method has returned true, and will only be called with forward set false if a prior call of the hasInverse has returned true.

Parameters:
npoint - the number of points to be transformed
xin - an array of npoint elements representing the coordinates to be transformed
forward - true if the forward transformation is to be used, false if its inverse transformation is to be used
Returns:
an array of npoint elements giving the transformed coordinates. throws Exception If an error occurs during the transformation, this method may throw an Exception. In this case the transformation will be aborted.
Throws:
Exception


Copyright © 2017 Central Laboratory of the Research Councils. All Rights Reserved.