|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.neu.ccs.gui.TransformFactory
TransformFactory provides a collection of static
methods that construct AffineTransform objects for
common 2-dimensional transforms.
Angle measurement is in degrees not radians.
A positive angle is in the direction from the positive x-axis towards the positive y-axis.
Class TransformFactory cannot be instantiated.
AffineTransform| Constructor Summary | |
private |
TransformFactory()
Private constructor to prevent instantiation. |
| Method Summary | |
static AffineTransform |
centeredTransform(double x,
double y,
AffineTransform t)
Returns the affine transform centered at the given point (x, y) constructed by translating the given transform. |
static AffineTransform |
centeredTransform(double x,
double y,
double m00,
double m10,
double m01,
double m11,
double m02,
double m12)
Returns the affine transform centered at the given point (x, y) whose corresponding 2-by-3 matrix at the origin is the given matrix. |
static AffineTransform |
compose(AffineTransform[] transforms)
Returns the transform produced by composition of the transforms in the given array of transforms. |
static AffineTransform |
compose(AffineTransform M,
AffineTransform N)
Returns the transform produced by composition of the transforms M and N with M on the left and N on the right. |
static AffineTransform |
glide(double degrees,
double distance)
Returns the transform to glide (translate) along the line at the given angle in degrees and the given glide distance. |
static AffineTransform |
glidereflect(double x,
double y,
double degrees,
double distance)
Returns the transform to glide and reflect along the line through (x, y) at the given angle in degrees and the given glide distance. |
static AffineTransform |
randomCenteredTransform(double x,
double y,
double maxshift)
Returns a transform that is a perturbation of the identity transform with focus at the given center (x, y). |
static AffineTransform |
randomRotate(double x,
double y,
double maxangle)
Returns a random rotation transform about the given center (x, y) whose rotation angle is bounded by the given maxangle in degrees. |
static AffineTransform |
randomScale(double x,
double y,
double degrees,
double maxdelta)
Returns a random scale with center at (x, y) along the line at the given angle in degrees and with scale factors within maxdelta of 1. |
static AffineTransform |
randomTranslate(double maxshift)
Returns a random translation transform whose shift in each direction is bounded in absolute value by the given value maxshift. |
static AffineTransform |
randomTranslateRotate(double x,
double y,
double maxshift,
double maxangle)
Returns a composite transform that combines a random translation with a random rotation about the given center (x, y). |
static AffineTransform |
reflect(double x,
double y,
double degrees)
Returns the transform to reflect along the line through (x, y) at the given angle in degrees. |
static AffineTransform |
reflectAtOrigin(double dx,
double dy)
Returns a reflection through the line joining the origin and the point dx,dy. |
static AffineTransform |
reflectThroughLine(double x1,
double y1,
double x2,
double y2)
Returns a reflection through the line joining x1,y1 to x2,y2. |
static AffineTransform |
rotate(double x,
double y,
double degrees)
Returns the transform to rotate with center at (x, y) by the given angle in degrees. |
static AffineTransform |
rotateAtOrigin(double dx,
double dy)
Returns a rotation with center at the origin and angle of rotation equal to the angle from the origin to dx,dy. |
static AffineTransform |
rotateAtOrigin(double x1,
double y1,
double x2,
double y2)
Returns a rotation with center at the origin and angle of rotation equal to the angle from x1,y1 to x2,y2. |
static AffineTransform |
rotateAtX1Y1(double x1,
double y1,
double x2,
double y2)
Returns a rotation with center at x1,y1 and angle of rotation equal to the angle from x1,y1 to x2,y2. |
static AffineTransform |
rotateAtX2Y2(double x1,
double y1,
double x2,
double y2)
Returns a rotation with center at x2,y2 and angle of rotation equal to the angle from x1,y1 to x2,y2. |
static AffineTransform |
scale(double x,
double y,
double degrees,
double s,
double t)
Returns the transform to scale with center at (x, y), with scale factor s along the line at the given angle in degrees, and with scale factor t along the perpendicular line. |
static AffineTransform |
shear(double x,
double y,
double degrees,
double s)
Returns the transform to shear with center at (x, y) and with shear factor s along the line at the given angle in degrees. |
static AffineTransform |
transform(double m00,
double m10,
double m01,
double m11,
double m02,
double m12)
Returns the affine transform with the given 2-by-3 matrix. |
static AffineTransform |
translate(double tx,
double ty)
Returns the transform to translate by (tx, ty). |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
private TransformFactory()
| Method Detail |
public static AffineTransform translate(double tx,
double ty)
tx - the x-coordinate of the translatety - the y-coordinate of the translate
public static AffineTransform rotate(double x,
double y,
double degrees)
x - the x-coordinate of the centery - the y-coordinate of the centerdegrees - the rotation angle in degrees
public static AffineTransform scale(double x,
double y,
double degrees,
double s,
double t)
x - the x-coordinate of the centery - the y-coordinate of the centerdegrees - the angle in degrees of the main scaling axiss - the scale factor along the axis at angle degreest - the scale factor along the axis at angle degrees+90
public static AffineTransform shear(double x,
double y,
double degrees,
double s)
Returns the transform to shear with center at (x, y) and with shear factor s along the line at the given angle in degrees.
In the special case when x = 0, y = 0, degrees = 0, this mapping produces the transform: (u, v) maps to (u + s * v, v), which fixes the x-axis and shears parallel to that axis.
In the general case, the fixed axis for the shear is the line at the given angle degrees through the point (x, y).
x - the x-coordinate of the centery - the y-coordinate of the centerdegrees - the angle in degrees of the fixed axis for shears - determines the amount of shear along lines parallel to
the fixed axis for shear
public static AffineTransform reflect(double x,
double y,
double degrees)
x - the x-coordinate of the centery - the y-coordinate of the centerdegrees - the angle in degrees of the line of reflection
public static AffineTransform glide(double degrees,
double distance)
Returns the transform to glide (translate) along the line at the given angle in degrees and the given glide distance.
Equivalent to specifing a translation via polar coordinates with the angle in degrees specified first and the distance specified second.
degrees - the angle in degrees of the line of glidedistance - the translation distance along the line of glide
public static AffineTransform glidereflect(double x,
double y,
double degrees,
double distance)
x - the x-coordinate of the centery - the y-coordinate of the centerdegrees - the angle in degrees of the line of glide reflectiondistance - the translation distance along the line of glide reflection
public static AffineTransform transform(double m00,
double m10,
double m01,
double m11,
double m02,
double m12)
Returns the affine transform with the given 2-by-3 matrix.
The given 2-by-3 matrix has the form:
m00 m01 m02
m10 m11 m12
.
m00 - matrix coefficient for row 0 and column 0m10 - matrix coefficient for row 1 and column 0m01 - matrix coefficient for row 0 and column 1m11 - matrix coefficient for row 1 and column 1m02 - matrix coefficient for row 0 and column 2m12 - matrix coefficient for row 1 and column 2
m00 m10 m01 m11 m02 m12
public static AffineTransform centeredTransform(double x,
double y,
AffineTransform t)
Returns the affine transform centered at the given point (x, y) constructed by translating the given transform.
The affine transform returned is the composite of the following three transforms from left to right:
If the given transform is null, returns the identity
transform.
x - the x-coordinate of the centery - the y-coordinate of the centert - the given affine transform
public static AffineTransform centeredTransform(double x,
double y,
double m00,
double m10,
double m01,
double m11,
double m02,
double m12)
Returns the affine transform centered at the given point (x, y) whose corresponding 2-by-3 matrix at the origin is the given matrix.
The given 2-by-3 matrix has the form:
m00 m01 m02
m10 m11 m12
.
The affine transform returned is the composite of the following three transforms from left to right:
x - the x-coordinate of the centery - the y-coordinate of the centerm00 - matrix coefficient for row 0 and column 0m10 - matrix coefficient for row 1 and column 0m01 - matrix coefficient for row 0 and column 1m11 - matrix coefficient for row 1 and column 1m02 - matrix coefficient for row 0 and column 2m12 - matrix coefficient for row 1 and column 2
public static AffineTransform compose(AffineTransform[] transforms)
Returns the transform produced by composition of the transforms in the given array of transforms.
The composition process takes place by repeated concatenation on the right of the i-th transform with the composite of the earlier transforms in the array.
If the array is null return the identity transform.
If an individual transform is null then ignore that
particular transform in the composition process.
transforms - the array of transforms to compose
public static AffineTransform compose(AffineTransform M,
AffineTransform N)
Returns the transform produced by composition of the transforms M and N with M on the left and N on the right.
This method is equivalent to:
return compose(new AffineTransform[] { M, N });
M - the transform on the leftN - the transform on the right
public static AffineTransform rotateAtOrigin(double dx,
double dy)
Returns a rotation with center at the origin and angle of rotation equal to the angle from the origin to dx,dy.
This rotation is computed directly from the coordinates without the use of trigonometric functions.
Returns the identity transform if dx,dy equals 0,0.
dx - x-coordinate of a pointdy - y-coordinate of a point
public static AffineTransform rotateAtOrigin(double x1,
double y1,
double x2,
double y2)
Returns a rotation with center at the origin and angle of rotation equal to the angle from x1,y1 to x2,y2.
This rotation is computed directly from the coordinates without the use of trigonometric functions.
Returns the identity transform if x1,y1 equals x2,y2.
x1 - x-coordinate of point 1y1 - y-coordinate of point 1x2 - x-coordinate of point 2y2 - y-coordinate of point 2
public static AffineTransform rotateAtX1Y1(double x1,
double y1,
double x2,
double y2)
Returns a rotation with center at x1,y1 and angle of rotation equal to the angle from x1,y1 to x2,y2.
This rotation is computed directly from the coordinates without the use of trigonometric functions.
Returns the identity transform if x1,y1 equals x2,y2.
x1 - x-coordinate of point 1y1 - y-coordinate of point 1x2 - x-coordinate of point 2y2 - y-coordinate of point 2
public static AffineTransform rotateAtX2Y2(double x1,
double y1,
double x2,
double y2)
Returns a rotation with center at x2,y2 and angle of rotation equal to the angle from x1,y1 to x2,y2.
This rotation is computed directly from the coordinates without the use of trigonometric functions.
Returns the identity transform if x1,y1 equals x2,y2.
x1 - x-coordinate of point 1y1 - y-coordinate of point 1x2 - x-coordinate of point 2y2 - y-coordinate of point 2
public static AffineTransform reflectAtOrigin(double dx,
double dy)
Returns a reflection through the line joining the origin and the point dx,dy.
This reflection is computed directly from the coordinates without the use of trigonometric functions.
Returns the reflection through the x-axis if dx,dy equals 0,0.
dx - x-coordinate of a pointdy - y-coordinate of a point
public static AffineTransform reflectThroughLine(double x1,
double y1,
double x2,
double y2)
Returns a reflection through the line joining x1,y1 to x2,y2.
This reflection is computed directly from the coordinates without the use of trigonometric functions.
Returns the horizontal reflection through the common point if x1,y1, equals x2, y2.
x1 - x-coordinate of point 1y1 - y-coordinate of point 1x2 - x-coordinate of point 2y2 - y-coordinate of point 2public static AffineTransform randomTranslate(double maxshift)
maxshift - the bound for the translation along each axis
public static AffineTransform randomRotate(double x,
double y,
double maxangle)
x - the x-coordinate of the centery - the y-coordinate of the centermaxangle - the bound for the rotation angle in degrees
public static AffineTransform randomTranslateRotate(double x,
double y,
double maxshift,
double maxangle)
x - the x-coordinate of the centery - the y-coordinate of the centermaxshift - the bound for the translation along each axismaxangle - the bound for the rotation angle in degrees
public static AffineTransform randomScale(double x,
double y,
double degrees,
double maxdelta)
x - the x-coordinate of the centery - the y-coordinate of the centerdegrees - the angle in degrees of the main scaling axismaxdelta - the bound relative to 1 of the scale factors
public static AffineTransform randomCenteredTransform(double x,
double y,
double maxshift)
Returns a transform that is a perturbation of the identity transform with focus at the given center (x, y).
In the special case when x = 0 and y = 0, the transform returned has the form:
m00 m01 m02
m10 m11 m12
where the diagonal elements satisfy:
abs(mii - 1) <= abs(maxshift)
and the off-diagonal elements satisfy:
abs(mij) <= abs(maxshift)
In the general case, there is the same behavior but centered at (x, y).
x - the x-coordinate of the centery - the y-coordinate of the centermaxshift - the bound on the perturbation coefficients
(double, double, double, double, double, double, double, double)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||