Class AffineTransform

java.lang.Object
com.vividsolutions.jump.warp.CoordinateTransform
com.vividsolutions.jump.warp.AffineTransform

public class AffineTransform extends CoordinateTransform
An AffineTransform implementation that is initialized by specifying three points and the three points they map to.

From http://graphics.lcs.mit.edu/classes/6.837/F01/Lecture07/lecture07.pdf:

     [ x1_ ] = [  x1 y1 1  0  0  0  ] [ a11 ]
     [ y1_ ] = [  0  0  0  x1 y1 1  ] [ a12 ]
     [ x2_ ] = [  x2 y2 1  0  0  0  ] [ a13 ]
     [ y2_ ] = [  0  0  0  x2 y2 1  ] [ a21 ]
     [ x3_ ] = [  x3 y3 1  0  0  0  ] [ a22 ]
     [ y3_ ] = [  0  0  0  x3 y3 1  ] [ a23 ]
x_ = X a
Solution: a = Xinv x_
  • Constructor Summary

    Constructors
    Constructor
    Description
    AffineTransform(org.locationtech.jts.geom.Coordinate p1, org.locationtech.jts.geom.Coordinate p1_)
    A transformation that maps p1 to p1_ via a translation (no rotation or shear).
    AffineTransform(org.locationtech.jts.geom.Coordinate p1, org.locationtech.jts.geom.Coordinate p1_, org.locationtech.jts.geom.Coordinate p2, org.locationtech.jts.geom.Coordinate p2_)
    A transformation that maps p1 to p1_ and p2 to p2_ via a translation, rotation, and scaling (no "relative" shear).
    AffineTransform(org.locationtech.jts.geom.Coordinate p1, org.locationtech.jts.geom.Coordinate p1_, org.locationtech.jts.geom.Coordinate p2, org.locationtech.jts.geom.Coordinate p2_, org.locationtech.jts.geom.Coordinate p3, org.locationtech.jts.geom.Coordinate p3_)
    A transformation that maps p1 to p1_, p2 to p2_ and p3 to p3_.
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.locationtech.jts.geom.Coordinate
    rotate90(org.locationtech.jts.geom.Coordinate a, org.locationtech.jts.geom.Coordinate b)
    Determines where a point would end up if it were rotated 90 degrees about another point.
    org.locationtech.jts.geom.Coordinate
    transform(org.locationtech.jts.geom.Coordinate c)
    Applies the affine transform to a point.

    Methods inherited from class CoordinateTransform

    transform, transform

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AffineTransform

      public AffineTransform(org.locationtech.jts.geom.Coordinate p1, org.locationtech.jts.geom.Coordinate p1_)
      A transformation that maps p1 to p1_ via a translation (no rotation or shear).
      Parameters:
      p1 - a point
      p1_ - the point it maps to
    • AffineTransform

      public AffineTransform(org.locationtech.jts.geom.Coordinate p1, org.locationtech.jts.geom.Coordinate p1_, org.locationtech.jts.geom.Coordinate p2, org.locationtech.jts.geom.Coordinate p2_)
      A transformation that maps p1 to p1_ and p2 to p2_ via a translation, rotation, and scaling (no "relative" shear).
      Parameters:
      p1 - a point
      p1_ - the point p1 maps to
      p2 - another point
      p2_ - the point p2 maps to
    • AffineTransform

      public AffineTransform(org.locationtech.jts.geom.Coordinate p1, org.locationtech.jts.geom.Coordinate p1_, org.locationtech.jts.geom.Coordinate p2, org.locationtech.jts.geom.Coordinate p2_, org.locationtech.jts.geom.Coordinate p3, org.locationtech.jts.geom.Coordinate p3_)
      A transformation that maps p1 to p1_, p2 to p2_ and p3 to p3_.
      Parameters:
      p1 - a point
      p1_ - the point p1 maps to
      p2 - another point
      p2_ - the point p2 maps to
      p3 - another point
      p3_ - the point p3 maps to
  • Method Details

    • rotate90

      public static org.locationtech.jts.geom.Coordinate rotate90(org.locationtech.jts.geom.Coordinate a, org.locationtech.jts.geom.Coordinate b)
      Determines where a point would end up if it were rotated 90 degrees about another point.
      Parameters:
      a - the fixed point
      b - the point to rotate (b itself will not be changed)
      Returns:
      b rotated 90 degrees clockwise about a
    • transform

      public org.locationtech.jts.geom.Coordinate transform(org.locationtech.jts.geom.Coordinate c)
      Applies the affine transform to a point. From http://graphics.lcs.mit.edu/classes/6.837/F01/Lecture07/lecture07.pdf:
           [ x_ ] = [  a11 a12 a13  ] [ x ]
           [ y_ ] = [  a21 a22 a23  ] [ y ]
           [ 1  ] = [  0   0   1    ] [ 1 ]
      
      Specified by:
      transform in class CoordinateTransform
      Parameters:
      c - the input to the affine transform
      Returns:
      the result of applying the affine transform to c