Package org.apache.sis.referencing.operation.transform

## Interface LinearTransform

- All Superinterfaces:
    `MathTransform`

      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 `getMatrix()` method. The relationship between matrix size and transform dimensions is as below:

  - The number of columns in the matrix is equal to the number of source dimensions plus 1
  - The number of rows in the matrix is equal to the number of target dimensions plus 1.
  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:
  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 `PerspectiveTransform` 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 = m 00 m 01 m 02 m 03 m 10 m 11 m 12 m 13 m 20 m 21 m 22 m 23 m 30 m 31 m 32 m 33 × x y z 1
  Instantiation
  The easiest way to instantiate a `LinearTransform` is to use the `MathTransforms​.linear(Matrix)` convenience method.
  Since:
    0.4
  See Also:
    `MathTransforms​.linear(Matrix)`, `LinearTransformBuilder`, `AffineTransform`, Affine transformation on MathWorld

  Defined in the `sis-referencing` module

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `deltaTransform​(double[] srcPts, int srcOff, double[] dstPts, int dstOff, int numPts)` | Transforms an array of relative distance vectors.
    `Matrix` | `getMatrix()` | Returns the coefficients of this linear transform as a matrix.
    `LinearTransform` | `inverse()` | Returns the inverse transform of this object, which shall also be linear.
    `boolean` | `isAffine()` | Returns `true` if this transform is affine.

    - ### Methods inherited from interface MathTransform

      `derivative, getSourceDimensions, getTargetDimensions, isIdentity, toWKT, transform, transform, transform, transform, transform`

- - ### Method Detail

    - #### isAffine

          boolean isAffine()

      Returns `true` if this transform is affine. An affine transform preserves parallelism.
      Returns:
        `true` if this transform is affine.
      Since:
        0.6
      See Also:
        `MatrixSIS​.isAffine()`

    - #### getMatrix

          Matrix getMatrix()

      Returns the coefficients of this linear transform as a matrix. Converting a coordinate with this `MathTransform` is equivalent to multiplying the returned matrix by a vector containing the coordinate values with an additional 1 in the last row. See `LinearTransform` class Javadoc for more details.
      Returns:
        the coefficients of this linear transform as a matrix.
      See Also:
        `MathTransforms​.getMatrix(MathTransform)`

    - #### 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:
        `srcPts` - the array containing the source vectors.
        `srcOff` - the offset to the first vector to be transformed in the source array.
        `dstPts` - the array into which the transformed vectors are returned. Can be the same than `srcPts`.
        `dstOff` - the offset to the location of the first transformed vector that is stored in the destination array.
        `numPts` - the number of vector objects to be transformed.
      Throws:
        `TransformException` - if a vector can not be transformed.
      Since:
        0.7
      See Also:
        `AffineTransform​.deltaTransform(double[], int, double[], int, int)`

    - #### inverse

          LinearTransform inverse()
                           throws NoninvertibleTransformException

      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 `MathTransform`
      Returns:
        the inverse transform.
      Throws:
        `NoninvertibleTransformException` - if the transform can not be inverted.
      Since:
        0.7
      See Also:
        `AffineTransform​.createInverse()`