public class AffineTransformation
extends java.lang.Object
implements java.lang.Cloneable, com.vividsolutions.jts.geom.CoordinateFilter
Coordinate or Geometry.
 An affine transformation is a mapping of the 2D plane into itself
 via a series of transformations of the following basic types:
 An affine transformation can be represented by a 3x3 matrix in the following form:
 T = | m00 m01 m02 |
     | m10 m11 m12 |
     |  0   0   1  |
 
 A coordinate P = (x, y) can be transformed to a new coordinate P' = (x', y')
 by representing it as a 3x1 matrix and using matrix multiplication to compute:
 Affine transformations can be composed using the| x' | = T x | x | | y' | | y | | 1 | | 1 |
compose(com.vividsolutions.jump.geom.AffineTransformation) method.
 Composition is not commutative.
 Composition is computed via multiplication of the 
 transformation matrices as follows:
 This produces a transformation whose effect is that of A followed by B. The methodsA.compose(B) = TB x TA
reflect(double, double, double, double), rotate(double), scale(double, double), shear(double, double), and translate(double, double) 
 have the effect of composing a transformation of that type with
 the transformation they are applied to.| Constructor and Description | 
|---|
AffineTransformation()
Deprecated.  
Constructs a new identity transformation 
 | 
AffineTransformation(AffineTransformation trans)
Deprecated.  
Constructs a transformation which is
 a copy of the given one. 
 | 
AffineTransformation(com.vividsolutions.jts.geom.Coordinate src0,
                    com.vividsolutions.jts.geom.Coordinate src1,
                    com.vividsolutions.jts.geom.Coordinate src2,
                    com.vividsolutions.jts.geom.Coordinate dest0,
                    com.vividsolutions.jts.geom.Coordinate dest1,
                    com.vividsolutions.jts.geom.Coordinate dest2)
Deprecated.  
Constructs a transformation
 which maps the given source
 points into the given destination points. 
 | 
AffineTransformation(double[] matrix)
Deprecated.  
Constructs a new transformation whose 
 matrix has the specified values. 
 | 
AffineTransformation(double m00,
                    double m01,
                    double m02,
                    double m10,
                    double m11,
                    double m12)
Deprecated.  
Constructs a new transformation whose 
 matrix has the specified values. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
java.lang.Object | 
clone()
Deprecated.  
Clones this transformation 
 | 
AffineTransformation | 
compose(AffineTransformation trans)
Deprecated.  
Composes the given  
AffineTransformation 
 with this transformation. | 
AffineTransformation | 
composeBefore(AffineTransformation trans)
Deprecated.  
Composes this transformation 
 with the given  
AffineTransformation. | 
boolean | 
equals(java.lang.Object obj)
Deprecated.  
Tests if an object is an
 AffineTransformation
 and has the same matrix as 
 this transformation. 
 | 
void | 
filter(com.vividsolutions.jts.geom.Coordinate pt)
Deprecated.  
  | 
double | 
getDeterminant()
Deprecated.  
Computes the determinant of the transformation matrix. 
 | 
AffineTransformation | 
getInverse()
Deprecated.  
Computes the inverse of this transformation, if one
 exists. 
 | 
double[] | 
getMatrixEntries()
Deprecated.  
Gets an array containing the entries
 of the transformation matrix. 
 | 
boolean | 
isIdentity()
Deprecated.  
Tests if this transformation is the identity transformation. 
 | 
AffineTransformation | 
reflect(double x,
       double y)
Deprecated.  
Updates the value of this transformation
 to that of a reflection transformation composed 
 with the current value. 
 | 
AffineTransformation | 
reflect(double x0,
       double y0,
       double x1,
       double y1)
Deprecated.  
Updates the value of this transformation
 to that of a reflection transformation composed 
 with the current value. 
 | 
static AffineTransformation | 
reflectionInstance(double x,
                  double y)
Deprecated.  
Creates a transformation for a reflection about the 
 line (0,0) - (x,y). 
 | 
static AffineTransformation | 
reflectionInstance(double x0,
                  double y0,
                  double x1,
                  double y1)
Deprecated.  
Creates a transformation for a reflection about the 
 line (x0,y0) - (x1,y1). 
 | 
AffineTransformation | 
rotate(double theta)
Deprecated.  
Updates the value of this transformation
 to that of a rotation transformation composed 
 with the current value. 
 | 
AffineTransformation | 
rotate(double sinTheta,
      double cosTheta)
Deprecated.  
Updates the value of this transformation
 to that of a rotation transformation composed 
 with the current value. 
 | 
static AffineTransformation | 
rotationInstance(double theta)
Deprecated.  
Creates a transformation for a rotation
 about the origin 
 by an angle theta. 
 | 
static AffineTransformation | 
rotationInstance(double sinTheta,
                double cosTheta)
Deprecated.  
Creates a transformation for a rotation 
 by an angle theta,
 specified by the sine and cosine of the angle. 
 | 
AffineTransformation | 
scale(double xScale,
     double yScale)
Deprecated.  
Updates the value of this transformation
 to that of a scale transformation composed 
 with the current value. 
 | 
static AffineTransformation | 
scaleInstance(double xScale,
             double yScale)
Deprecated.  
  | 
AffineTransformation | 
setToIdentity()
Deprecated.  
Sets this transformation to be the identity transformation. 
 | 
AffineTransformation | 
setToReflection(double x,
               double y)
Deprecated.  
Sets this transformation to be a reflection 
 about the line defined by vector (x,y). 
 | 
AffineTransformation | 
setToReflection(double x0,
               double y0,
               double x1,
               double y1)
Deprecated.  
  | 
AffineTransformation | 
setToReflectionBasic(double x0,
                    double y0,
                    double x1,
                    double y1)
Deprecated.  
Explicitly computes the math for a reflection. 
 | 
AffineTransformation | 
setToRotation(double sinTheta,
             double cosTheta)
Deprecated.  
Sets this transformation to be a rotation 
 by specifying the sin and cos of the rotation angle directly. 
 | 
AffineTransformation | 
setToScale(double xScale,
          double yScale)
Deprecated.  
Sets this transformation to be a scaling. 
 | 
AffineTransformation | 
setToShear(double xShear,
          double yShear)
Deprecated.  
Sets this transformation to be a shear. 
 | 
AffineTransformation | 
setToTranslation(double dx,
                double dy)
Deprecated.  
Sets this transformation to be a translation. 
 | 
AffineTransformation | 
setTransformation(AffineTransformation trans)
Deprecated.  
Sets this transformation to be a copy of the given one 
 | 
AffineTransformation | 
setTransformation(double m00,
                 double m01,
                 double m02,
                 double m10,
                 double m11,
                 double m12)
Deprecated.  
Sets this transformation's matrix to have the given values. 
 | 
AffineTransformation | 
shear(double xShear,
     double yShear)
Deprecated.  
Updates the value of this transformation
 to that of a shear transformation composed 
 with the current value. 
 | 
static AffineTransformation | 
shearInstance(double xShear,
             double yShear)
Deprecated.  
  | 
java.lang.String | 
toString()
Deprecated.  
Gets a text representation of this transformation. 
 | 
com.vividsolutions.jts.geom.Coordinate | 
transform(com.vividsolutions.jts.geom.Coordinate src,
         com.vividsolutions.jts.geom.Coordinate dest)
Deprecated.  
  | 
com.vividsolutions.jts.geom.CoordinateSequence | 
transform(com.vividsolutions.jts.geom.CoordinateSequence seq)
Deprecated.  
  | 
AffineTransformation | 
translate(double x,
         double y)
Deprecated.  
Updates the value of this transformation
 to that of a translation transformation composed 
 with the current value. 
 | 
static AffineTransformation | 
translationInstance(double x,
                   double y)
Deprecated.  
  | 
public AffineTransformation()
public AffineTransformation(double[] matrix)
matrix - an array containing the 6 values { m00, m01, m02, m10, m11, m12 }java.lang.NullPointerException - if matrix is nulljava.lang.ArrayIndexOutOfBoundsException - if matrix is too smallpublic AffineTransformation(double m00,
                    double m01,
                    double m02,
                    double m10,
                    double m11,
                    double m12)
m00 - the entry for the [0, 0] element in the transformation matrixm01 - the entry for the [0, 1] element in the transformation matrixm02 - the entry for the [0, 2] element in the transformation matrixm10 - the entry for the [1, 0] element in the transformation matrixm11 - the entry for the [1, 1] element in the transformation matrixm12 - the entry for the [1, 2] element in the transformation matrixpublic AffineTransformation(AffineTransformation trans)
trans - the transformation to copypublic AffineTransformation(com.vividsolutions.jts.geom.Coordinate src0,
                    com.vividsolutions.jts.geom.Coordinate src1,
                    com.vividsolutions.jts.geom.Coordinate src2,
                    com.vividsolutions.jts.geom.Coordinate dest0,
                    com.vividsolutions.jts.geom.Coordinate dest1,
                    com.vividsolutions.jts.geom.Coordinate dest2)
src0 - source point 0src1 - source point 1src2 - source point 2dest0 - the mapped point for source point 0dest1 - the mapped point for source point 1dest2 - the mapped point for source point 2public static AffineTransformation reflectionInstance(double x0, double y0, double x1, double y1)
x0 - the x-ordinate of a point on the reflection liney0 - the y-ordinate of a point on the reflection linex1 - the x-ordinate of a another point on the reflection liney1 - the y-ordinate of a another point on the reflection linepublic static AffineTransformation reflectionInstance(double x, double y)
x - the x-ordinate of a point on the reflection liney - the y-ordinate of a point on the reflection linepublic static AffineTransformation rotationInstance(double theta)
theta - the rotation angle, in radianspublic static AffineTransformation rotationInstance(double sinTheta, double cosTheta)
sinTheta - the sine of the rotation anglecosTheta - the cosine of the rotation anglepublic static AffineTransformation scaleInstance(double xScale, double yScale)
public static AffineTransformation shearInstance(double xShear, double yShear)
public static AffineTransformation translationInstance(double x, double y)
public AffineTransformation setToIdentity()
| 1 0 0 | | 0 1 0 | | 0 0 1 |
public AffineTransformation setTransformation(double m00, double m01, double m02, double m10, double m11, double m12)
m00 - the entry for the [0, 0] element in the transformation matrixm01 - the entry for the [0, 1] element in the transformation matrixm02 - the entry for the [0, 2] element in the transformation matrixm10 - the entry for the [1, 0] element in the transformation matrixm11 - the entry for the [1, 1] element in the transformation matrixm12 - the entry for the [1, 2] element in the transformation matrixpublic AffineTransformation setTransformation(AffineTransformation trans)
trans - a transformation to copypublic double[] getMatrixEntries()
m00, m01, m02, m10, m11, m12
public double getDeterminant()
If the determinant is zero, the transform is singular (not invertible), and operations which attempt to compute an inverse will throw a NoninvertibleTransformException.| m00 m01 m02 | | m10 m11 m12 | = m00 * m11 - m01 * m10 | 0 0 1 |
getInverse()public AffineTransformation getInverse() throws NoninvertibleTransformationException
The matrix of the inverse is equal to the inverse of the matrix for the transformation. It is computed as follows:
  
                 1    
 inverse(A)  =  ---   x  adjoint(A) 
                det 
             =   1       |  m11  -m01   m01*m12-m02*m11  |
                ---   x  | -m10   m00  -m00*m12+m10*m02  |
                det      |  0     0     m00*m11-m10*m01  |
             = |  m11/det  -m01/det   m01*m12-m02*m11/det |
               | -m10/det   m00/det  -m00*m12+m10*m02/det |
               |   0           0          1               |
 NoninvertibleTransformationExceptiongetDeterminant()public AffineTransformation setToReflectionBasic(double x0, double y0, double x1, double y1)
x0 - y0 - x1 - y1 - public AffineTransformation setToReflection(double x0, double y0, double x1, double y1)
public AffineTransformation setToReflection(double x, double y)
d = sqrt(x2 + y2) sin = x / d; cos = x / d; Tref = Trot(sin, cos) x Tscale(1, -1) x Trot(-sin, cos)
x - the x-component of the reflection line vectory - the y-component of the reflection line vectorpublic AffineTransformation setToRotation(double sinTheta, double cosTheta)
| cosTheta -sinTheta 0 | | sinTheta cosTheta 0 | | 0 0 1 |
sinTheta - the sine of the rotation anglecosTheta - the cosine of the rotation anglepublic AffineTransformation setToScale(double xScale, double yScale)
| xScale 0 dx | | 1 yScale dy | | 0 0 1 |
xScale - the amount to scale x-ordinates byyScale - the amount to scale y-ordinates bypublic AffineTransformation setToShear(double xShear, double yShear)
Note that a shear of (1, 1) is not equal to shear(1, 0) composed with shear(0, 1). Instead, shear(1, 1) corresponds to a mapping onto the line x = y.| 1 xShear 0 | | yShear 1 0 | | 0 0 1 |
xShear - the x component to shear byyShear - the y component to shear bypublic AffineTransformation setToTranslation(double dx, double dy)
| 1 0 dx | | 1 0 dy | | 0 0 1 |
dx - the x component to translate bydy - the y component to translate bypublic AffineTransformation reflect(double x0, double y0, double x1, double y1)
x0 - the x-ordinate of a point on the line to reflect aroundy0 - the y-ordinate of a point on the line to reflect aroundx1 - the x-ordinate of a point on the line to reflect aroundy1 - the y-ordinate of a point on the line to reflect aroundpublic AffineTransformation reflect(double x, double y)
x - the x-ordinate of the line to reflect aroundy - the y-ordinate of the line to reflect aroundpublic AffineTransformation rotate(double theta)
theta - the angle to rotate bypublic AffineTransformation rotate(double sinTheta, double cosTheta)
sinTheta - the sine of the angle to rotate bycosTheta - the cosine of the angle to rotate bypublic AffineTransformation scale(double xScale, double yScale)
xScale - the value to scale by in the x directionyScale - the value to scale by in the y directionpublic AffineTransformation shear(double xShear, double yShear)
xShear - the value to shear by in the x directionyShear - the value to shear by in the y directionpublic AffineTransformation translate(double x, double y)
x - the value to translate by in the x directiony - the value to translate by in the y directionpublic AffineTransformation compose(AffineTransformation trans)
AffineTransformation 
 with this transformation.
 This produces a transformation whose effect 
 is equal to applying this transformation 
 followed by the argument transformation.
 Mathematically,
 A.compose(B) = TB x TA
trans - an affine transformationpublic AffineTransformation composeBefore(AffineTransformation trans)
AffineTransformation.
 This produces a transformation whose effect 
 is equal to applying the argument transformation 
 followed by this transformation.
 Mathematically,
 A.composeBefore(B) = TA x TB
trans - an affine transformationpublic com.vividsolutions.jts.geom.Coordinate transform(com.vividsolutions.jts.geom.Coordinate src,
                                               com.vividsolutions.jts.geom.Coordinate dest)
public com.vividsolutions.jts.geom.CoordinateSequence transform(com.vividsolutions.jts.geom.CoordinateSequence seq)
public void filter(com.vividsolutions.jts.geom.Coordinate pt)
filter in interface com.vividsolutions.jts.geom.CoordinateFilterpublic boolean isIdentity()
public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectobj - an object to testpublic java.lang.String toString()
AffineTransformation[[m00, m01, m02], [m10, m11, m12]]
toString in class java.lang.Objectpublic java.lang.Object clone()
clone in class java.lang.Object