Interface LinearTransform

All Superinterfaces:
Math­Transform

public interface LinearTransform extends MathTransform
A usually affine, or otherwise a projective transform, which convert coordinates using only linear equations. A projective transform is capable of mapping an arbitrary quadrilateral into another arbitrary quadrilateral, while preserving the straightness of lines. In the special case where the transform is affine, the parallelism of lines in the source is preserved in the output.

Such a coordinate transformation can be represented by a matrix of arbitrary size, which is given by the get­Matrix() method. The relationship between matrix size and transform dimensions is as below:

Affine transform

In most cases the transform in affine. For such transforms, the last matrix row contains only zero values except in the last column, which contains 1. For example a conversion from projected coordinates (metres) to display coordinates (pixel) can be done as below:
Matrix representation of an affine transform

Projective transform

If the last matrix row does not met the above constraints, then the transform is not affine. A projective transform can be used as a generalization of affine transforms. In such case the computation performed by SIS is similar to Perspective­Transform in Java Advanced Imaging. For example a square matrix of size 4×4 is used for transforming three-dimensional coordinates. The transformed points (x',y',z') are computed as below:
x' y' z' = u/t v/t w/t
where u, v, w and t are obtained by
u v w t = m00 m01 m02 m03 m10 m11 m12 m13 m20 m21 m22 m23 m30 m31 m32 m33 × x y z 1

Instantiation

The easiest way to instantiate a Linear­Transform is to use the Math­Transforms​.linear(Matrix) convenience method.
Since:
0.4
See Also:

Defined in the sis-referencing module

  • Method Details

    • isAffine

      boolean isAffine()
      Returns true if this transform is affine. An affine transform preserves parallelism and has the same derivative at every locations.
      Returns:
      true if this transform is affine.
      Since:
      0.6
      See Also:
    • getMatrix

      Matrix getMatrix()
      Returns the coefficients of this linear transform as a matrix. Converting a coordinate with this Math­Transform is equivalent to multiplying the returned matrix by a vector containing the coordinate values with an additional 1 in the last row. See Linear­Transform class Javadoc for more details.
      Returns:
      the coefficients of this linear transform as a matrix.
      See Also:
    • deltaTransform

      void deltaTransform(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts) throws TransformException
      Transforms an array of relative distance vectors. Distance vectors are transformed without applying the translation components. The supplied array of distance values will contain packed values.
      Example: if the source dimension is 3, then the values will be packed in this order: (Δx₀,Δy₀,Δz₀, Δx₁,Δy₁,Δz₁ …).
      Parameters:
      src­Pts - the array containing the source vectors.
      src­Off - the offset to the first vector to be transformed in the source array.
      dst­Pts - the array into which the transformed vectors are returned. Can be the same than src­Pts.
      dst­Off - the offset to the location of the first transformed vector that is stored in the destination array.
      num­Pts - the number of vector objects to be transformed.
      Throws:
      Transform­Exception - if a vector can not be transformed.
      Since:
      0.7
      See Also:
    • inverse

      Returns the inverse transform of this object, which shall also be linear. The target of the inverse transform is the source of the original. The source of the inverse transform is the target of the original.
      Specified by:
      inverse in interface Math­Transform
      Returns:
      the inverse transform.
      Throws:
      Noninvertible­Transform­Exception - if the transform can not be inverted.
      Since:
      0.7
      See Also: