|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object math.geom2d.AffineTransform2D
public class AffineTransform2D
Base class for generic affine transforms in the plane. They include rotations, translations, shears, similarities, and combinations of these. Such transformations can be constructed by using coefficients specification, or by creating specialized instances, by using static methods.
Constructor Summary | |
---|---|
AffineTransform2D()
Creates a new AffineTransform2D, initialized with Identity. |
|
AffineTransform2D(java.awt.geom.AffineTransform transform)
Creates a new transform from a java AWT transform. |
|
AffineTransform2D(AffineTransform2D trans)
Constructor by copy of an existing transform |
|
AffineTransform2D(double[] coefs)
|
|
AffineTransform2D(double xx,
double yx,
double tx,
double xy,
double yy,
double ty)
|
Method Summary | |
---|---|
double[][] |
affineMatrix()
Returns the 3x3 square matrix representing the transform. |
boolean |
almostEquals(GeometricObject2D obj,
double eps)
Checks if the two objects are similar up to a given threshold value. |
java.awt.geom.AffineTransform |
asAwtTransform()
Returns this transform as an instance of java AWT AffineTransform. |
AffineTransform2D |
chain(AffineTransform2D that)
Returns the affine transform created by applying first this affine transform, then the affine transform given by that . |
AffineTransform2D |
clone()
|
double[] |
coefficients()
Returns coefficients of the transform in a linear array of 6 double. |
AffineTransform2D |
concatenate(AffineTransform2D that)
Returns the affine transform created by applying first the affine transform given by that , then this affine transform. |
static AffineTransform2D |
create(AffineTransform2D trans)
Creates a new affine transform by copying coefficients. |
static AffineTransform2D |
create(double[] coefs)
Creates an affine transform defined by an array of coefficients. |
static AffineTransform2D |
create(double xx,
double yx,
double tx,
double xy,
double yy,
double ty)
|
static AffineTransform2D |
createGlideReflection(LinearShape2D line,
double distance)
Create a glide reflection, composed of a reflection by the given line, and a translation in the direction of the line by a distance given by second parameter. |
static AffineTransform2D |
createHomothecy(Point2D center,
double k)
Deprecated. replaced by scaling (0.11.1) |
static AffineTransform2D |
createIdentity()
|
static AffineTransform2D |
createLineReflection(LinearShape2D line)
Creates a reflection by the given line. |
static AffineTransform2D |
createPointReflection(Point2D center)
Returns a center reflection around a point. |
static AffineTransform2D |
createQuadrantRotation(double x0,
double y0,
int numQuadrant)
Creates a rotation composed of the given number of rotations by 90 degrees around the point given by (x0,y0). |
static AffineTransform2D |
createQuadrantRotation(int numQuadrant)
Creates a rotation composed of the given number of rotations by 90 degrees around the origin. |
static AffineTransform2D |
createQuadrantRotation(Point2D center,
int numQuadrant)
Creates a rotation composed of the given number of rotations by 90 degrees around the given point. |
static AffineTransform2D |
createRotation(double angle)
Creates a rotation around the origin, with angle in radians. |
static AffineTransform2D |
createRotation(double cx,
double cy,
double angle)
Creates a rotation around the specified point, with angle in radians. |
static AffineTransform2D |
createRotation(Point2D center,
double angle)
Creates a rotation around the specified point, with angle in radians. |
static AffineTransform2D |
createScaling(double sx,
double sy)
Creates a scaling by the given coefficients, centered on the origin. |
static AffineTransform2D |
createScaling(Point2D center,
double sx,
double sy)
Creates a scaling by the given coefficients, centered on the point given by (x0,y0). |
static AffineTransform2D |
createShear(double shx,
double shy)
Creates a Shear transform, using the classical Java notation. |
static AffineTransform2D |
createTransform(java.awt.geom.AffineTransform transform)
Creates a new transform from a java AWT transform. |
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)
|
AffineTransform2D |
invert()
Returns the inverse transform. |
boolean |
isDirect()
Tests if this affine transform is direct, i.e. the sign of the determinant of the associated matrix is positive. |
static boolean |
isDirect(AffineTransform2D trans)
Checks if the transform is direct, i.e. it preserves the orientation of transformed shapes. |
boolean |
isIdentity()
Tests is this affine transform is equal to the identity transform. |
static boolean |
isIdentity(AffineTransform2D trans)
Checks if the given transform is the identity transform. |
boolean |
isIsometry()
Tests if this affine transform is an isometry, i.e. is equivalent to a compound of translations, rotations and reflections. |
static boolean |
isIsometry(AffineTransform2D trans)
Checks if the transform is an isometry, i.e. a compound of translation, rotation and reflection. |
boolean |
isMotion()
Tests if this affine transform is a motion, i.e. is composed only of rotations and translations. |
static boolean |
isMotion(AffineTransform2D trans)
Checks if the transform is a motion, i.e. a compound of translations and rotations. |
boolean |
isSimilarity()
Tests if this affine transform is a similarity. |
static boolean |
isSimilarity(AffineTransform2D trans)
Checks if the transform is an similarity, i.e. transformation which keeps unchanged the global shape, up to a scaling factor. |
AffineTransform2D |
preConcatenate(AffineTransform2D that)
Return the affine transform created by applying first this affine transform, then the affine transform given by that . |
java.lang.String |
toString()
Displays the coefficients of the transform, row by row. |
Point2D |
transform(Point2D p)
Computes the coordinates of the transformed point. |
Point2D[] |
transform(Point2D[] src,
Point2D[] dst)
Transforms an array of points, and returns the transformed points. |
Methods inherited from class java.lang.Object |
---|
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public AffineTransform2D()
public AffineTransform2D(AffineTransform2D trans)
public AffineTransform2D(java.awt.geom.AffineTransform transform)
public AffineTransform2D(double[] coefs)
public AffineTransform2D(double xx, double yx, double tx, double xy, double yy, double ty)
Method Detail |
---|
public static AffineTransform2D createIdentity()
public static AffineTransform2D create(AffineTransform2D trans)
public static AffineTransform2D create(double[] coefs)
public static AffineTransform2D create(double xx, double yx, double tx, double xy, double yy, double ty)
public static AffineTransform2D createGlideReflection(LinearShape2D line, double distance)
@Deprecated public static AffineTransform2D createHomothecy(Point2D center, double k)
public static AffineTransform2D createLineReflection(LinearShape2D line)
public static AffineTransform2D createPointReflection(Point2D center)
center
- the center of the reflection
public static AffineTransform2D createQuadrantRotation(int numQuadrant)
public static AffineTransform2D createQuadrantRotation(Point2D center, int numQuadrant)
public static AffineTransform2D createQuadrantRotation(double x0, double y0, int numQuadrant)
public static AffineTransform2D createRotation(double angle)
public static AffineTransform2D createRotation(Point2D center, double angle)
public static AffineTransform2D createRotation(double cx, double cy, double angle)
public static AffineTransform2D createScaling(double sx, double sy)
public static AffineTransform2D createScaling(Point2D center, double sx, double sy)
public static AffineTransform2D createShear(double shx, double shy)
shx
- shear in x-axisshy
- shear in y-axis
public static AffineTransform2D createTransform(java.awt.geom.AffineTransform transform)
public static AffineTransform2D createTranslation(Vector2D vect)
public static AffineTransform2D createTranslation(double dx, double dy)
public static boolean isIdentity(AffineTransform2D trans)
public static boolean isDirect(AffineTransform2D trans)
public static boolean isIsometry(AffineTransform2D trans)
public static boolean isMotion(AffineTransform2D trans)
public static boolean isSimilarity(AffineTransform2D trans)
public double[] coefficients()
public double[][] affineMatrix()
public java.awt.geom.AffineTransform asAwtTransform()
public AffineTransform2D concatenate(AffineTransform2D that)
that
, then this affine transform.
This is the equivalent method of the 'concatenate' method in
java.awt.geom.AffineTransform.
that
- the transform to apply first
public AffineTransform2D chain(AffineTransform2D that)
that
. This the
equivalent method of the 'preConcatenate' method in
java.awt.geom.AffineTransform.
shape = shape.transform(T1.chain(T2).chain(T3));
is equivalent to the sequence:
shape = shape.transform(T1);
shape = shape.transform(T2);
shape = shape.transform(T3);
that
- the transform to apply in a second step
public AffineTransform2D preConcatenate(AffineTransform2D that)
that
. This the
equivalent method of the 'preConcatenate' method in
java.awt.geom.AffineTransform.
that
- the transform to apply in a second step
public boolean isSimilarity()
public boolean isMotion()
public boolean isIsometry()
public boolean isDirect()
public boolean isIdentity()
public AffineTransform2D invert()
invert
in interface Bijection2D
public Point2D transform(Point2D p)
transform
in interface Transform2D
public Point2D[] transform(Point2D[] src, Point2D[] dst)
Transform2D
transform
in interface Transform2D
public boolean almostEquals(GeometricObject2D obj, double eps)
GeometricObject2D
almostEquals
in interface GeometricObject2D
obj
- the object to compareeps
- a threshold value, for example the minimal coordinate difference
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public AffineTransform2D clone()
clone
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |