object AffineTransformation

Represents an affine transformation on the 2D Cartesian plane. It can be used to transform a {link Coordinate} or {link Geometry}. An affine transformation is a mapping of the 2D plane into itself via a series of transformations of the following basic types:

  • reflection (through a line)
  • rotation (around the origin)
  • scaling (relative to the origin)
  • shearing (in both the X and Y directions)
  • 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 |

Transformation Composition

Affine transformations can be composed using the {link #compose} method. Composition is computed via multiplication of the transformation matrices, and is defined as:

A.compose(B) = TB x TA
This produces a transformation whose effect is that of A followed by B. The methods {link #reflect}, {link #rotate}, {link #scale}, {link #shear}, and {link #translate} have the effect of composing a transformation of that type with the transformation they are invoked on.

The composition of transformations is in general not commutative.

Transformation Inversion

Affine transformations may be invertible or non-invertible. If a transformation is invertible, then there exists an inverse transformation which when composed produces the identity transformation. The {link #getInverse} method computes the inverse of a transformation, if one exists.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. AffineTransformation
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  9. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  10. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  11. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  12. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  13. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  14. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  15. def reflectionInstance(x: Double, y: Double): AffineTransformation

    Creates a transformation for a reflection about the line (0,0) - (x,y).

    Creates a transformation for a reflection about the line (0,0) - (x,y).

    x

    the x-ordinate of a point on the reflection line

    y

    the y-ordinate of a point on the reflection line return a transformation for the reflection

  16. def reflectionInstance(x0: Double, y0: Double, x1: Double, y1: Double): AffineTransformation

    Creates a transformation for a reflection about the line (x0,y0) - (x1,y1).

    Creates a transformation for a reflection about the line (x0,y0) - (x1,y1).

    x0

    the x-ordinate of a point on the reflection line

    y0

    the y-ordinate of a point on the reflection line

    x1

    the x-ordinate of a another point on the reflection line

    y1

    the y-ordinate of a another point on the reflection line return a transformation for the reflection

  17. def rotationInstance(sinTheta: Double, cosTheta: Double, x: Double, y: Double): AffineTransformation

    Creates a transformation for a rotation about the point (x,y) by an angle theta, specified by the sine and cosine of the angle.

    Creates a transformation for a rotation about the point (x,y) 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.

    sinTheta

    the sine of the rotation angle

    cosTheta

    the cosine of the rotation angle

    x

    the x-ordinate of the rotation point

    y

    the y-ordinate of the rotation point return a transformation for the rotation

  18. def rotationInstance(theta: Double, x: Double, y: Double): AffineTransformation

    Creates a transformation for a rotation about the point (x,y) by an angle theta.

    Creates a transformation for a rotation about the point (x,y) by an angle theta. Positive angles correspond to a rotation in the counter-clockwise direction.

    theta

    the rotation angle, in radians

    x

    the x-ordinate of the rotation point

    y

    the y-ordinate of the rotation point return a transformation for the rotation

  19. def rotationInstance(sinTheta: Double, cosTheta: Double): AffineTransformation

    Creates a transformation for a rotation by an angle theta, specified by the sine and cosine of the angle.

    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.

    sinTheta

    the sine of the rotation angle

    cosTheta

    the cosine of the rotation angle return a transformation for the rotation

  20. def rotationInstance(theta: Double): AffineTransformation

    Creates a transformation for a rotation about the origin by an angle theta.

    Creates a transformation for a rotation about the origin by an angle theta. Positive angles correspond to a rotation in the counter-clockwise direction.

    theta

    the rotation angle, in radians return a transformation for the rotation

  21. def scaleInstance(xScale: Double, yScale: Double, x: Double, y: Double): AffineTransformation

    Creates a transformation for a scaling relative to the point (x,y).

    Creates a transformation for a scaling relative to the point (x,y).

    xScale

    the value to scale by in the x direction

    yScale

    the value to scale by in the y direction

    x

    the x-ordinate of the point to scale around

    y

    the y-ordinate of the point to scale around return a transformation for the scaling

  22. def scaleInstance(xScale: Double, yScale: Double): AffineTransformation

    Creates a transformation for a scaling relative to the origin.

    Creates a transformation for a scaling relative to the origin.

    xScale

    the value to scale by in the x direction

    yScale

    the value to scale by in the y direction return a transformation for the scaling

  23. def shearInstance(xShear: Double, yShear: Double): AffineTransformation

    Creates a transformation for a shear.

    Creates a transformation for a shear.

    xShear

    the value to shear by in the x direction

    yShear

    the value to shear by in the y direction return a transformation for the shear

  24. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  25. def toString(): String
    Definition Classes
    AnyRef → Any
  26. def translationInstance(x: Double, y: Double): AffineTransformation

    Creates a transformation for a translation.

    Creates a transformation for a translation.

    x

    the value to translate by in the x direction

    y

    the value to translate by in the y direction return a transformation for the translation

  27. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  28. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  29. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

Inherited from AnyRef

Inherited from Any

Ungrouped