org.geotools.referencing.operation.builder
Class SimilarTransformBuilder

java.lang.Object
  extended by org.geotools.referencing.operation.builder.MathTransformBuilder
      extended by org.geotools.referencing.operation.builder.ProjectiveTransformBuilder
          extended by org.geotools.referencing.operation.builder.SimilarTransformBuilder

public class SimilarTransformBuilder
extends ProjectiveTransformBuilder

Builds MathTransform setup as Similar transformation from a list of MappedPosition. The The calculation uses least square method. The similar transform equation:

                                                  
  [ x']   [  a -b  Tx  ] [ x ]   [ a*x - b*y + Tx ]
  [ y'] = [  b  a  Ty  ] [ y ] = [ b*x + a*y + Ty ] 
In the case that we have more identical points we can write it like this (in Matrix):
                                           
  [ x'1 ]      [ x1 -y1  1 0 ]   [ a  ]
  [ x'2 ]      [ x2 -y2  1 0 ]   [ b  ]
  [  .  ]      [      .      ]   [ Tx ]                          
  [  .  ]      [      .      ] * [ Ty ]                          
  [ x'n ]   =  [ xn  yn  1 0 ]   
  [ y'1 ]      [ y1  x1  0 1 ]   
  [ y'2 ]      [ y2  x2  0 1 ]  
  [  .  ]      [      .      ]                                      
  [  .  ]      [      .      ]                                    
  [ y'n ]      [ yn xn  0  1 ]     
    x' = A*m  
Using the least square method we get this result:
m = (ATA)-1 ATx'

Since:
2.4
Version:
$Id: SimilarTransformBuilder.java 30641 2008-06-12 17:42:27Z acuster $
Author:
Jan Jezek

Field Summary
 
Fields inherited from class org.geotools.referencing.operation.builder.ProjectiveTransformBuilder
A, P, X
 
Fields inherited from class org.geotools.referencing.operation.builder.MathTransformBuilder
mtFactory
 
Constructor Summary
SimilarTransformBuilder(java.util.List<MappedPosition> vectors)
          Creates SimilarTransformBuilder for the set of properties.
 
Method Summary
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 2.
protected  GeneralMatrix getProjectiveMatrix()
          Returns the matrix for Projective transformation setup as Affine.
 
Methods inherited from class org.geotools.referencing.operation.builder.ProjectiveTransformBuilder
calculateLSM, computeMathTransform, fillPMatrix, fillXMatrix, getCoordinateSystemType, includeWeights
 
Methods inherited from class org.geotools.referencing.operation.builder.MathTransformBuilder
getDimension, getErrorStatistics, getMappedPositions, getMathTransform, getName, getSourceCRS, getSourcePoints, getTargetCRS, getTargetPoints, getTransformation, printPoints, setMappedPositions, setSourcePoints, setTargetPoints, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimilarTransformBuilder

public SimilarTransformBuilder(java.util.List<MappedPosition> vectors)
                        throws javax.vecmath.MismatchedSizeException,
                               org.opengis.geometry.MismatchedDimensionException,
                               org.opengis.geometry.MismatchedReferenceSystemException
Creates SimilarTransformBuilder for the set of properties. The List of MappedPosition is expected.

Parameters:
vectors - list of MappedPosition
Throws:
javax.vecmath.MismatchedSizeException
org.opengis.geometry.MismatchedDimensionException
org.opengis.geometry.MismatchedReferenceSystemException
Method Detail

fillAMatrix

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

Overrides:
fillAMatrix in class ProjectiveTransformBuilder

getMinimumPointCount

public int getMinimumPointCount()
Returns the minimum number of points required by this builder, which is 2.

Overrides:
getMinimumPointCount in class ProjectiveTransformBuilder
Returns:
Returns the minimum number of points required by this builder, which is 2.

getProjectiveMatrix

protected GeneralMatrix getProjectiveMatrix()
Returns the matrix for Projective transformation setup as Affine. The M matrix looks like this:
                                                       
 [  a  -b  Tx  ]                           
 [  b   a  Ty  ]                              
 [  0   0  1   ]                                                                   
 

Overrides:
getProjectiveMatrix in class ProjectiveTransformBuilder
Returns:
Matrix M.


Copyright © 1996-2010 Geotools. All Rights Reserved.