# 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:

## 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:
$MathML capable browser required$
where u, v, w and t are obtained by
$MathML capable browser required$

## Instantiation

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

Defined in the `sis-referencing` module

• ## Method Summary

Modifier and Type
Method
Description
`void`
```delta­Transform(double[] src­Pts, int src­Off, double[] dst­Pts, int dst­Off, int num­Pts)```
Transforms an array of relative distance vectors.
`Matrix`
`get­Matrix()`
Returns the coefficients of this linear transform as a matrix.
`Linear­Transform`
`inverse()`
Returns the inverse transform of this object, which shall also be linear.
`boolean`
`is­Affine()`
Returns `true` if this transform is affine.

### Methods inherited from interface MathTransform

`derivative, get­Source­Dimensions, get­Target­Dimensions, is­Identity, to­WKT, transform, transform, transform, transform, transform`
• ## 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
• ### 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.
• ### 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
`inverse` in interface `Math­Transform`
`Noninvertible­Transform­Exception` - if the transform can not be inverted.