math.geom2d.transform
Class AbstractAffineTransform2D

java.lang.Object
  extended by math.geom2d.transform.AbstractAffineTransform2D
All Implemented Interfaces:
AffineTransform2D, Bijection2D, Transform2D
Direct Known Subclasses:
GenericAffineTransform2D, GlideReflection2D, Homothecy2D, LineReflection2D, Rotation2D, Scaling2D, Translation2D

public abstract class AbstractAffineTransform2D
extends java.lang.Object
implements AffineTransform2D

Base class for generic affine transforms in the plane. They include rotations, translations, shears, homotheties, and combinations of these. Such transformations can be constructed by using coefficients specification, or by creating specialized instances, by using static methods.

To implement an affine transform, use either GenericAffineTransform2D, or a specialized class like Translation2D, Rotation2D, Homothecy2D...


Nested Class Summary
static class AbstractAffineTransform2D.Identity2D
           
 
Constructor Summary
AbstractAffineTransform2D()
           
 
Method Summary
 AffineTransform2D compose(AffineTransform2D that)
          Return the composition of this affine transform with the given affine transform.
static AffineTransform2D createRotation(double angle)
          Return a rotation around the origin, with angle in radians.
static AffineTransform2D createRotation(double cx, double cy, double angle)
          Return a rotation around the specified point, with angle in radians.
static AffineTransform2D createRotation(Point2D center, double angle)
          Return a rotation around the specified point, with angle in radians.
static AffineTransform2D createScaling(double sx, double sy)
          Return a scaling by the given coefficients, centered on the origin.
static AffineTransform2D createScaling(Point2D center, double sx, double sy)
          Return a scaling by the given coefficients, centered on the given point.
static AffineTransform2D createTranslation(double dx, double dy)
          Return a translation by the given vector.
static AffineTransform2D createTranslation(Vector2D vect)
          Return a translation by the given vector.
 boolean equals(java.lang.Object obj)
           
 boolean isDirect()
          Check if the transform is direct, i.e. it preserves the orientation of transformed shapes.
static boolean isDirect(AffineTransform2D trans)
          Check if the transform is direct, i.e. it preserves the orientation of transformed shapes.
 boolean isIdentity()
          Check if the transform is equivalent to the identity transform.
static boolean isIdentity(AffineTransform2D trans)
           
 boolean isIsometry()
          Check if the transform is an isometry, i.e. a compound of translation, rotation and reflection.
static boolean isIsometry(AffineTransform2D trans)
          Check if the transform is an isometry, i.e. a compound of translation, rotation and reflection.
 boolean isMotion()
          Check if the transform is a motion, i.e. a compound of translations and rotation.
static boolean isMotion(AffineTransform2D trans)
          Check if the transform is a motion, i.e. a compound of translations and rotation.
 boolean isSimilarity()
           
static boolean isSimilarity(AffineTransform2D trans)
          Check if the transform is an similarity, i.e. transformation which keeps unchanged the global shape, up to a scaling factor.
 Point2D transform(java.awt.geom.Point2D src)
          Transforms a point
 Point2D[] transform(java.awt.geom.Point2D[] src, Point2D[] dst)
          Transforms an array of points, and returns the transformed points.
 Point2D transform(java.awt.geom.Point2D src, Point2D dst)
          Transforms a point, share memory
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface math.geom2d.transform.AffineTransform2D
getAffineMatrix, getCoefficients
 
Methods inherited from interface math.geom2d.transform.Bijection2D
getInverseTransform
 

Constructor Detail

AbstractAffineTransform2D

public AbstractAffineTransform2D()
Method Detail

createRotation

public static final AffineTransform2D createRotation(double angle)
Return a rotation around the origin, with angle in radians.


createRotation

public static final AffineTransform2D createRotation(Point2D center,
                                                     double angle)
Return a rotation around the specified point, with angle in radians.


createRotation

public static final AffineTransform2D createRotation(double cx,
                                                     double cy,
                                                     double angle)
Return a rotation around the specified point, with angle in radians. If the angular distance of the angle with a multiple of PI/2 is lower than the threshold Shape2D.ACCURACY, the method assumes equality.


createScaling

public static final AffineTransform2D createScaling(double sx,
                                                    double sy)
Return a scaling by the given coefficients, centered on the origin.


createScaling

public static final AffineTransform2D createScaling(Point2D center,
                                                    double sx,
                                                    double sy)
Return a scaling by the given coefficients, centered on the given point.


createTranslation

public static final AffineTransform2D createTranslation(Vector2D vect)
Return a translation by the given vector.


createTranslation

public static final AffineTransform2D createTranslation(double dx,
                                                        double dy)
Return a translation by the given vector.


isIdentity

public static final boolean isIdentity(AffineTransform2D trans)

isDirect

public static final boolean isDirect(AffineTransform2D trans)
Check if the transform is direct, i.e. it preserves the orientation of transformed shapes.

Returns:
true if transform is direct.

isIsometry

public static final boolean isIsometry(AffineTransform2D trans)
Check if the transform is an isometry, i.e. a compound of translation, rotation and reflection. Isometry keeps area of shapes unchanged, but can change orientation (directed or undirected).

Returns:
true in case of isometry.

isMotion

public static final boolean isMotion(AffineTransform2D trans)
Check if the transform is a motion, i.e. a compound of translations and rotation. Motion remains area and orientation (directed or undirected) of shapes unchanged.

Returns:
true in case of motion.

isSimilarity

public static final boolean isSimilarity(AffineTransform2D trans)
Check if the transform is an similarity, i.e. transformation which keeps unchanged the global shape, up to a scaling factor.

Returns:
true in case of similarity.

compose

public AffineTransform2D compose(AffineTransform2D that)
Description copied from interface: AffineTransform2D
Return the composition of this affine transform with the given affine transform. If transforms are represented by matrices this and that, the result can be represented by matrix this*that.

Specified by:
compose in interface AffineTransform2D
Parameters:
that - the transform to compose with
Returns:
the composition of this transform with the given transform

isSimilarity

public boolean isSimilarity()
Specified by:
isSimilarity in interface AffineTransform2D

isMotion

public boolean isMotion()
Description copied from interface: AffineTransform2D
Check if the transform is a motion, i.e. a compound of translations and rotation. Motion preserves area and orientation (directed or undirected) of shapes unchanged.

Specified by:
isMotion in interface AffineTransform2D
Returns:
true in case of motion.

isIsometry

public boolean isIsometry()
Description copied from interface: AffineTransform2D
Check if the transform is an isometry, i.e. a compound of translation, rotation and reflection. Isometries preserves area of shapes unchanged, but can change orientation (directed or undirected).

Specified by:
isIsometry in interface AffineTransform2D
Returns:
true in case of isometry.

isDirect

public boolean isDirect()
Description copied from interface: AffineTransform2D
Check if the transform is direct, i.e. it preserves the orientation of transformed shapes.

Specified by:
isDirect in interface AffineTransform2D
Returns:
true if transform is direct.

isIdentity

public boolean isIdentity()
Description copied from interface: AffineTransform2D
Check if the transform is equivalent to the identity transform.

Specified by:
isIdentity in interface AffineTransform2D
Returns:
true if the transform is identity

transform

public Point2D[] transform(java.awt.geom.Point2D[] src,
                           Point2D[] dst)
Description copied from interface: Transform2D
Transforms an array of points, and returns the transformed points.

Specified by:
transform in interface Transform2D

transform

public Point2D transform(java.awt.geom.Point2D src)
Description copied from interface: Transform2D
Transforms a point

Specified by:
transform in interface Transform2D

transform

public Point2D transform(java.awt.geom.Point2D src,
                         Point2D dst)
Description copied from interface: Transform2D
Transforms a point, share memory

Specified by:
transform in interface Transform2D

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object