## Class AffineTransformBuilder

• ```public class AffineTransformBuilder
extends ProjectiveTransformBuilder```
Builds MathTransform setup as Affine transformation from a list of MappedPosition. The calculation uses least square method. The Affine transform equation:
```  [ x']   [  m00  m01  m02  ] [ x ]   [ m00x + m01y + m02 ]
[ y'] = [  m10  m11  m12  ] [ y ] = [ m10x + m11y + m12 ]
[ 1 ]   [   0    0    1   ] [ 1 ]   [         1         ]
x' = m * x ```
In the case that we have more identical points we can write it like this (in Matrix):
```  [ x'1 ]      [ x1 y1 1  0  0  0 ]   [ m00 ]
[ x'2 ]      [ x2 y2 1  0  0  0 ]   [ m01 ]
[  .  ]      [        .         ]   [ m02 ]
[  .  ]      [        .         ] * [ m10 ]
[ x'n ]   =  [ xn yn 1  0  0  0 ]   [ m11 ]
[ y'1 ]      [ 0  0  0  x1 y1 1 ]   [ m12 ]
[ y'2 ]      [ 0  0  0  x2 y2 1 ]
[  .  ]      [        .         ]
[  .  ]      [        .         ]
[ y'n ]      [ 0  0  0  xn yn 1 ]
x' = A*m ```
Using the least square method we get this result:
```
m = (ATA)-1 ATx'   ```
Since:
2.4
Author:
Jan Jezek

• ### Fields inherited from class ProjectiveTransformBuilder

`A, P, X`
• ### Fields inherited from class MathTransformBuilder

`mtFactory`
• ### Constructor Summary

Constructors
Modifier Constructor Description
`protected ` `AffineTransformBuilder()`
` ` `AffineTransformBuilder​(List<MappedPosition> vectors)`
Creates AffineTransformBuilder for the set of properties.
• ### Method Summary

All Methods
Modifier and Type Method Description
`protected void` `fillAMatrix()`
Fills A matrix for m = (ATPA)-1 ATPx' equation
`int` `getMinimumPointCount()`
Returns the minimum number of points required by this builder, which is 3.
`protected GeneralMatrix` `getProjectiveMatrix()`
Returns the matrix for Projective transformation setup as Affine.
• ### Methods inherited from class ProjectiveTransformBuilder

`calculateLSM, computeMathTransform, fillPMatrix, fillXMatrix, getCoordinateSystemType, includeWeights`
• ### Methods inherited from class MathTransformBuilder

`getDimension, getErrorStatistics, getMappedPositions, getMathTransform, getName, getSourceCRS, getSourcePoints, getTargetCRS, getTargetPoints, getTransformation, printPoints, setMappedPositions, setSourcePoints, setTargetPoints, toString`
• ### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`
• ### Constructor Detail

• #### AffineTransformBuilder

`protected AffineTransformBuilder()`
• #### AffineTransformBuilder

```public AffineTransformBuilder​(List<MappedPosition> vectors)
throws IllegalArgumentException,
MismatchedDimensionException,
MismatchedReferenceSystemException```
Creates AffineTransformBuilder for the set of properties.
Parameters:
`vectors` - list of MappedPosition
Throws:
`IllegalArgumentException`
`MismatchedDimensionException`
`MismatchedReferenceSystemException`
• ### Method Detail

• #### getMinimumPointCount

`public int getMinimumPointCount()`
Returns the minimum number of points required by this builder, which is 3.
Overrides:
`getMinimumPointCount` in class `ProjectiveTransformBuilder`
Returns:
the minimum number of points required by this builder, which is 3.
• #### getProjectiveMatrix

`protected GeneralMatrix getProjectiveMatrix()`
Returns the matrix for Projective transformation setup as Affine. The M matrix looks like this:
``` [  m00  m01  m02  ]
[  m10  m11  m12  ]
[   0    0    1   ]
```
Overrides:
`getProjectiveMatrix` in class `ProjectiveTransformBuilder`
Returns:
Matrix M.
• #### fillAMatrix

`protected void fillAMatrix()`
Description copied from class: `ProjectiveTransformBuilder`
Fills A matrix for m = (ATPA)-1 ATPx' equation
Overrides:
`fillAMatrix` in class `ProjectiveTransformBuilder`