public abstract class Transformer2 extends Transformer
Transformer
is provided for
convenience when only a 2-d transformation is required. Subclasses
need to implement the tran2
method, which is somewhat more
convenient than Transformer
's tranP
method.Constructor and Description |
---|
Transformer2() |
Modifier and Type | Method and Description |
---|---|
boolean |
canTransformCoords(int nin,
int nout)
Indicates whether this
Transformer
is able to transform between coordinate spaces with the given
dimensionalities. |
abstract double[][] |
tran2(int npoint,
double[] xin,
double[] yin,
boolean forward)
Transforms points from 2-d input coordinates to 2-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.
|
getAuthor, getContact, getPurpose, hasForward, hasInverse, simpFI, simpIF
public final boolean canTransformCoords(int nin, int nout)
Transformer
is able to transform between coordinate spaces with the given
dimensionalities.canTransformCoords
in class Transformer
nin
- the number of coordinates of an input pointnout
- the number of coordinates of an output pointnin
and nout
are equal to 2public final double[][] tranP(int npoint, int ncoord_in, double[][] in, boolean forward, int ncoord_out) throws Exception
Transformer
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.
tranP
in class Transformer
npoint
- the number of points to be transformedncoord_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 usedncoord_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
.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.Exception
public abstract double[][] tran2(int npoint, double[] xin, double[] yin, boolean forward) throws Exception
Transformer2
,
taking input x and y coordinate arrays and returning a two-element
array consisting of the x and y 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.
npoint
- the number of points to be transformedxin
- an array of npoint
elements
representing the X coordinates to be transformedyin
- an array of npoint
elements
representing the Y coordinates to be transformedforward
- true
if the forward transformation
is to be used, false
if its inverse
transformation is to be usednpoint
-element array of the output X coordinates,
and the second element is an
npoint
-element array of the output Y coordinatesException
- If an error occurs during the transformation,
this method may throw an Exception. In this
case the transformation will be aborted.Copyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.