Java Doc for AffineTransformation.java in  » GIS » openjump » com » vividsolutions » jump » geom » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » GIS » openjump » com.vividsolutions.jump.geom 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.vividsolutions.jump.geom.AffineTransformation

AffineTransformation
public class AffineTransformation implements Cloneable,CoordinateFilter(Code)
This class represents a affine transformation on the 2D Cartesian plane. It can be used to transform a 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:
  • reflection
  • rotation
  • scaling
  • shearing
  • translation
In general, affine transformations preserve straightness and parallel lines, but do not preserve distance or shape.

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:
 | x' |  = T x | x |
 | y' |        | y |
 | 1  |        | 1 |
 
Affine transformations can be composed using the AffineTransformation.compose method. Composition is not commutative. Composition is computed via multiplication of the transformation matrices as follows:
 A.compose(B) = TB x TA
 
This produces a transformation whose effect is that of A followed by B. The methods AffineTransformation.reflect , AffineTransformation.rotate , AffineTransformation.scale , AffineTransformation.shear , and AffineTransformation.translate have the effect of composing a transformation of that type with the transformation they are applied to.
author:
   Martin Davis



Constructor Summary
public  AffineTransformation()
    
public  AffineTransformation(double[] matrix)
     Constructs a new transformation whose matrix has the specified values.
public  AffineTransformation(double m00, double m01, double m02, double m10, double m11, double m12)
     Constructs a new transformation whose matrix has the specified values.
public  AffineTransformation(AffineTransformation trans)
     Constructs a transformation which is a copy of the given one.
public  AffineTransformation(Coordinate src0, Coordinate src1, Coordinate src2, Coordinate dest0, Coordinate dest1, Coordinate dest2)
     Constructs a transformation which maps the given source points into the given destination points.

Method Summary
public  Objectclone()
    
public  AffineTransformationcompose(AffineTransformation trans)
     Composes the given AffineTransformation with this transformation.
public  AffineTransformationcomposeBefore(AffineTransformation trans)
     Composes this transformation with the given AffineTransformation .
public  booleanequals(Object obj)
     Tests if an object is an AffineTransformation and has the same matrix as this transformation.
public  voidfilter(Coordinate pt)
    
public  doublegetDeterminant()
     Computes the determinant of the transformation matrix.
public  AffineTransformationgetInverse()
     Computes the inverse of this transformation, if one exists. The inverse is the transformation which when composed with this one produces the identity transformation. A transformation has an inverse if and only if it is not singular (i.e.
public  double[]getMatrixEntries()
     Gets an array containing the entries of the transformation matrix.
public  booleanisIdentity()
     Tests if this transformation is the identity transformation.
public  AffineTransformationreflect(double x0, double y0, double x1, double y1)
     Updates the value of this transformation to that of a reflection transformation composed with the current value.
public  AffineTransformationreflect(double x, double y)
     Updates the value of this transformation to that of a reflection transformation composed with the current value.
public static  AffineTransformationreflectionInstance(double x0, double y0, double x1, double y1)
     Creates a transformation for a reflection about the line (x0,y0) - (x1,y1).
public static  AffineTransformationreflectionInstance(double x, double y)
     Creates a transformation for a reflection about the line (0,0) - (x,y).
public  AffineTransformationrotate(double theta)
     Updates the value of this transformation to that of a rotation transformation composed with the current value.
public  AffineTransformationrotate(double sinTheta, double cosTheta)
     Updates the value of this transformation to that of a rotation transformation composed with the current value.
public static  AffineTransformationrotationInstance(double theta)
     Creates a transformation for a rotation about the origin by an angle theta.
public static  AffineTransformationrotationInstance(double sinTheta, double cosTheta)
     Creates a transformation for a rotation by an angle theta, specified by the sine and cosine of the angle. This allows providing exact values for sin(theta) and cos(theta) for the common case of rotations of multiples of quarter-circles.
public  AffineTransformationscale(double xScale, double yScale)
     Updates the value of this transformation to that of a scale transformation composed with the current value.
public static  AffineTransformationscaleInstance(double xScale, double yScale)
    
public  AffineTransformationsetToIdentity()
     Sets this transformation to be the identity transformation.
public  AffineTransformationsetToReflection(double x0, double y0, double x1, double y1)
    
public  AffineTransformationsetToReflection(double x, double y)
     Sets this transformation to be a reflection about the line defined by vector (x,y).
public  AffineTransformationsetToReflectionBasic(double x0, double y0, double x1, double y1)
     Explicitly computes the math for a reflection.
public  AffineTransformationsetToRotation(double sinTheta, double cosTheta)
     Sets this transformation to be a rotation by specifying the sin and cos of the rotation angle directly.
public  AffineTransformationsetToScale(double xScale, double yScale)
     Sets this transformation to be a scaling.
public  AffineTransformationsetToShear(double xShear, double yShear)
     Sets this transformation to be a shear.
public  AffineTransformationsetToTranslation(double dx, double dy)
     Sets this transformation to be a translation.
public  AffineTransformationsetTransformation(double m00, double m01, double m02, double m10, double m11, double m12)
     Sets this transformation's matrix to have the given values.
public  AffineTransformationsetTransformation(AffineTransformation trans)
    
public  AffineTransformationshear(double xShear, double yShear)
     Updates the value of this transformation to that of a shear transformation composed with the current value.
public static  AffineTransformationshearInstance(double xShear, double yShear)
    
public  StringtoString()
     Gets a text representation of this transformation.
public  Coordinatetransform(Coordinate src, Coordinate dest)
    
public  CoordinateSequencetransform(CoordinateSequence seq)
    
public  AffineTransformationtranslate(double x, double y)
     Updates the value of this transformation to that of a translation transformation composed with the current value.
public static  AffineTransformationtranslationInstance(double x, double y)
    


Constructor Detail
AffineTransformation
public AffineTransformation()(Code)
Constructs a new identity transformation



AffineTransformation
public AffineTransformation(double[] matrix)(Code)
Constructs a new transformation whose matrix has the specified values.
Parameters:
  matrix - an array containing the 6 values { m00, m01, m02, m10, m11, m12 }
throws:
  NullPointerException - if matrix is null
throws:
  ArrayIndexOutOfBoundsException - if matrix is too small



AffineTransformation
public AffineTransformation(double m00, double m01, double m02, double m10, double m11, double m12)(Code)
Constructs a new transformation whose matrix has the specified values.
Parameters:
  m00 - the entry for the [0, 0] element in the transformation matrix
Parameters:
  m01 - the entry for the [0, 1] element in the transformation matrix
Parameters:
  m02 - the entry for the [0, 2] element in the transformation matrix
Parameters:
  m10 - the entry for the [1, 0] element in the transformation matrix
Parameters:
  m11 - the entry for the [1, 1] element in the transformation matrix
Parameters:
  m12 - the entry for the [1, 2] element in the transformation matrix



AffineTransformation
public AffineTransformation(AffineTransformation trans)(Code)
Constructs a transformation which is a copy of the given one.
Parameters:
  trans - the transformation to copy



AffineTransformation
public AffineTransformation(Coordinate src0, Coordinate src1, Coordinate src2, Coordinate dest0, Coordinate dest1, Coordinate dest2)(Code)
Constructs a transformation which maps the given source points into the given destination points.
Parameters:
  src0 - source point 0
Parameters:
  src1 - source point 1
Parameters:
  src2 - source point 2
Parameters:
  dest0 - the mapped point for source point 0
Parameters:
  dest1 - the mapped point for source point 1
Parameters:
  dest2 - the mapped point for source point 2




Method Detail
clone
public Object clone()(Code)
Clones this transformation a copy of this transformation



compose
public AffineTransformation compose(AffineTransformation trans)(Code)
Composes the given 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
 

Parameters:
  trans - an affine transformation this transformation, with an updated matrix



composeBefore
public AffineTransformation composeBefore(AffineTransformation trans)(Code)
Composes this transformation with the given 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
 

Parameters:
  trans - an affine transformation this transformation, with an updated matrix



equals
public boolean equals(Object obj)(Code)
Tests if an object is an AffineTransformation and has the same matrix as this transformation.
Parameters:
  obj - an object to test true if the given object is equal to this object



filter
public void filter(Coordinate pt)(Code)



getDeterminant
public double getDeterminant()(Code)
Computes the determinant of the transformation matrix. The determinant is computed as:
 | m00 m01 m02 |
 | m10 m11 m12 | = m00 * m11 - m01 * m10
 |  0   0   1  |
 
If the determinant is zero, the transform is singular (not invertible), and operations which attempt to compute an inverse will throw a NoninvertibleTransformException. the determinant of the transformation
See Also:   AffineTransformation.getInverse()



getInverse
public AffineTransformation getInverse() throws NoninvertibleTransformationException(Code)
Computes the inverse of this transformation, if one exists. The inverse is the transformation which when composed with this one produces the identity transformation. A transformation has an inverse if and only if it is not singular (i.e. its determinant is non-zero). Geometrically, an transformation is non-invertible if it maps the plane to a line or a point. If no inverse exists this method will throw a 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               |
 
a new inverse transformation
throws:
  NoninvertibleTransformationException -
See Also:   AffineTransformation.getDeterminant()



getMatrixEntries
public double[] getMatrixEntries()(Code)
Gets an array containing the entries of the transformation matrix. Only the 6 non-trivial entries are returned, in the sequence:
 m00, m01, m02, m10, m11, m12
 
an array of length 6



isIdentity
public boolean isIdentity()(Code)
Tests if this transformation is the identity transformation. true if this is the identity transformation



reflect
public AffineTransformation reflect(double x0, double y0, double x1, double y1)(Code)
Updates the value of this transformation to that of a reflection transformation composed with the current value.
Parameters:
  x0 - the x-ordinate of a point on the line to reflect around
Parameters:
  y0 - the y-ordinate of a point on the line to reflect around
Parameters:
  x1 - the x-ordinate of a point on the line to reflect around
Parameters:
  y1 - the y-ordinate of a point on the line to reflect around this transformation, with an updated matrix



reflect
public AffineTransformation reflect(double x, double y)(Code)
Updates the value of this transformation to that of a reflection transformation composed with the current value.
Parameters:
  x - the x-ordinate of the line to reflect around
Parameters:
  y - the y-ordinate of the line to reflect around this transformation, with an updated matrix



reflectionInstance
public static AffineTransformation reflectionInstance(double x0, double y0, double x1, double y1)(Code)
Creates a transformation for a reflection about the line (x0,y0) - (x1,y1).
Parameters:
  x0 - the x-ordinate of a point on the reflection line
Parameters:
  y0 - the y-ordinate of a point on the reflection line
Parameters:
  x1 - the x-ordinate of a another point on the reflection line
Parameters:
  y1 - the y-ordinate of a another point on the reflection line a transformation for the reflection



reflectionInstance
public static AffineTransformation reflectionInstance(double x, double y)(Code)
Creates a transformation for a reflection about the line (0,0) - (x,y).
Parameters:
  x - the x-ordinate of a point on the reflection line
Parameters:
  y - the y-ordinate of a point on the reflection line a transformation for the reflection



rotate
public AffineTransformation rotate(double theta)(Code)
Updates the value of this transformation to that of a rotation transformation composed with the current value.
Parameters:
  theta - the angle to rotate by this transformation, with an updated matrix



rotate
public AffineTransformation rotate(double sinTheta, double cosTheta)(Code)
Updates the value of this transformation to that of a rotation transformation composed with the current value.
Parameters:
  sinTheta - the sine of the angle to rotate by
Parameters:
  cosTheta - the cosine of the angle to rotate by this transformation, with an updated matrix



rotationInstance
public static AffineTransformation rotationInstance(double theta)(Code)
Creates a transformation for a rotation about the origin by an angle theta. Positive angles correspond to a rotation in the counter-clockwise direction.
Parameters:
  theta - the rotation angle, in radians a transformation for the rotation



rotationInstance
public static AffineTransformation rotationInstance(double sinTheta, double cosTheta)(Code)
Creates a transformation for a rotation by an angle theta, specified by the sine and cosine of the angle. This allows providing exact values for sin(theta) and cos(theta) for the common case of rotations of multiples of quarter-circles.
Parameters:
  sinTheta - the sine of the rotation angle
Parameters:
  cosTheta - the cosine of the rotation angle a transformation for the rotation



scale
public AffineTransformation scale(double xScale, double yScale)(Code)
Updates the value of this transformation to that of a scale transformation composed with the current value.
Parameters:
  xScale - the value to scale by in the x direction
Parameters:
  yScale - the value to scale by in the y direction this transformation, with an updated matrix



scaleInstance
public static AffineTransformation scaleInstance(double xScale, double yScale)(Code)



setToIdentity
public AffineTransformation setToIdentity()(Code)
Sets this transformation to be the identity transformation. The identity transformation has the matrix:
 | 1 0 0 |
 | 0 1 0 |
 | 0 0 1 |
 
this transformation, with an updated matrix



setToReflection
public AffineTransformation setToReflection(double x0, double y0, double x1, double y1)(Code)



setToReflection
public AffineTransformation setToReflection(double x, double y)(Code)
Sets this transformation to be a reflection about the line defined by vector (x,y). The transformation for a reflection is computed by:
 d = sqrt(x2 + y2)  
 sin = x / d;
 cos = x / d;
 Tref = Trot(sin, cos) x Tscale(1, -1) x Trot(-sin, cos)

Parameters:
  x - the x-component of the reflection line vector
Parameters:
  y - the y-component of the reflection line vector this transformation, with an updated matrix



setToReflectionBasic
public AffineTransformation setToReflectionBasic(double x0, double y0, double x1, double y1)(Code)
Explicitly computes the math for a reflection. May not work.
Parameters:
  x0 -
Parameters:
  y0 -
Parameters:
  x1 -
Parameters:
  y1 - this transformation, with an updated matrix



setToRotation
public AffineTransformation setToRotation(double sinTheta, double cosTheta)(Code)
Sets this transformation to be a rotation by specifying the sin and cos of the rotation angle directly. The transformation matrix for the rotation has the value:
  
 |  cosTheta  -sinTheta   0 |
 |  sinTheta   cosTheta   0 |
 |         0          0   1 |
 

Parameters:
  sinTheta - the sine of the rotation angle
Parameters:
  cosTheta - the cosine of the rotation angle this transformation, with an updated matrix



setToScale
public AffineTransformation setToScale(double xScale, double yScale)(Code)
Sets this transformation to be a scaling. The transformation matrix for a scale has the value:
  
 |  xScale      0  dx |
 |  1      yScale  dy |
 |  0           0   1 |
 

Parameters:
  xScale - the amount to scale x-ordinates by
Parameters:
  yScale - the amount to scale y-ordinates by this transformation, with an updated matrix



setToShear
public AffineTransformation setToShear(double xShear, double yShear)(Code)
Sets this transformation to be a shear. The transformation matrix for a shear has the value:
  
 |  1      xShear  0 |
 |  yShear      1  0 |
 |  0           0  1 |
 
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.
Parameters:
  xShear - the x component to shear by
Parameters:
  yShear - the y component to shear by this transformation, with an updated matrix



setToTranslation
public AffineTransformation setToTranslation(double dx, double dy)(Code)
Sets this transformation to be a translation. For a translation by the vector (x, y) the transformation matrix has the value:
  
 |  1  0  dx |
 |  1  0  dy |
 |  0  0   1 |
 

Parameters:
  dx - the x component to translate by
Parameters:
  dy - the y component to translate by this transformation, with an updated matrix



setTransformation
public AffineTransformation setTransformation(double m00, double m01, double m02, double m10, double m11, double m12)(Code)
Sets this transformation's matrix to have the given values.
Parameters:
  m00 - the entry for the [0, 0] element in the transformation matrix
Parameters:
  m01 - the entry for the [0, 1] element in the transformation matrix
Parameters:
  m02 - the entry for the [0, 2] element in the transformation matrix
Parameters:
  m10 - the entry for the [1, 0] element in the transformation matrix
Parameters:
  m11 - the entry for the [1, 1] element in the transformation matrix
Parameters:
  m12 - the entry for the [1, 2] element in the transformation matrix this transformation, with an updated matrix



setTransformation
public AffineTransformation setTransformation(AffineTransformation trans)(Code)
Sets this transformation to be a copy of the given one
Parameters:
  trans - a transformation to copy this transformation, with an updated matrix



shear
public AffineTransformation shear(double xShear, double yShear)(Code)
Updates the value of this transformation to that of a shear transformation composed with the current value.
Parameters:
  xShear - the value to shear by in the x direction
Parameters:
  yShear - the value to shear by in the y direction this transformation, with an updated matrix



shearInstance
public static AffineTransformation shearInstance(double xShear, double yShear)(Code)



toString
public String toString()(Code)
Gets a text representation of this transformation. The string is of the form:
 AffineTransformation[[m00, m01, m02], [m10, m11, m12]]
 
a string representing this transformation



transform
public Coordinate transform(Coordinate src, Coordinate dest)(Code)



transform
public CoordinateSequence transform(CoordinateSequence seq)(Code)



translate
public AffineTransformation translate(double x, double y)(Code)
Updates the value of this transformation to that of a translation transformation composed with the current value.
Parameters:
  x - the value to translate by in the x direction
Parameters:
  y - the value to translate by in the y direction this transformation, with an updated matrix



translationInstance
public static AffineTransformation translationInstance(double x, double y)(Code)



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.