|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecteu.webtoolkit.jwt.WTransform
public class WTransform
A value class that defines a 2D affine transformation matrix.
The matrix is encoded using 6 parameters:
m11 m12 0
m21 m22 0
dx dy 1
In this representation, getDx() (=
getM31()) and getDy()
(= getM32()) represent the translation
components, and mxy represent a 2D matrix that contains the scale,
rotation (and skew) components.
The transformation is used to represent a tansformed coordinate system, and
provides methods to rotate(),
scale(),
shear() or
translate() this
coordinate system.
There are also 2 methods to decompose an arbitrary matrix into elementary operations:
decomposeTranslateRotateScaleSkew() decomposes into a T ∘
R ∘ Sxx ∘ SxydecomposeTranslateRotateScaleRotate() decomposes into a T ∘
R1 ∘ Sxx ∘ R2with T a translation, R a rotation, Sxx a scale, and Sxy a skew component.
| Nested Class Summary | |
|---|---|
static class |
WTransform.TRSRDecomposition
Result of a TRSR decomposition. |
static class |
WTransform.TRSSDecomposition
Result of a TRSS decomposition. |
| Field Summary | |
|---|---|
static WTransform |
Identity
A constant that represents the identity transform. |
| Constructor Summary | |
|---|---|
WTransform()
Default constructor. |
|
WTransform(double m11,
double m12,
double m21,
double m22,
double dx,
double dy)
Construct a custom matrix by specifying the parameters. |
|
| Method Summary | |
|---|---|
WTransform |
assign(WTransform rhs)
Assignment method. |
WTransform |
clone()
Clone method. |
void |
decomposeTranslateRotateScaleRotate(WTransform.TRSRDecomposition result)
Decomposes the transformation. |
void |
decomposeTranslateRotateScaleSkew(WTransform.TRSSDecomposition result)
Decomposes the transformation. |
static double |
degreesToRadians(double angle)
Utility method to convert degrees to radians. |
boolean |
equals(WTransform rhs)
Indicates whether some other object is "equal to" this one. |
WTransform |
getAdjoint()
Returns the adjoint. |
double |
getDeterminant()
Returns the determinant. |
double |
getDx()
Returns the horizontal translation factor. |
double |
getDy()
Returns the vertical translation factor. |
WTransform |
getInverted()
Returns the inverted transformation. |
double |
getM11()
Returns the horizontal scaling factor. |
double |
getM12()
Returns the vertical shearing factor. |
double |
getM13()
Returns m13 = 0. |
double |
getM21()
Returns the horizontal shearing factor. |
double |
getM22()
Returns the vertical scaling factor. |
double |
getM23()
Returns m23 = 0. |
double |
getM31()
Returns the horizontal translation factor. |
double |
getM32()
Returns the vertical translation factor. |
double |
getM33()
Returns m33 = 1. |
boolean |
isIdentity()
Identity check. |
void |
map(double x,
double y,
java.lang.Double tx,
java.lang.Double ty)
Applys the transformation to a point. |
WPointF |
map(WPointF p)
Applys the transformation to a point. |
WTransform |
multiply(WTransform rhs)
Multiply 2 transform objects. |
WTransform |
multiplyAndAssign(WTransform Y)
Adds a transform that is conceptually applied after this transform. |
void |
reset()
Resets the transformation to the identity. |
WTransform |
rotate(double angle)
Rotates the transformation. |
WTransform |
rotateRadians(double angle)
Rotates the transformation. |
WTransform |
scale(double sx,
double sy)
Scales the transformation. |
WTransform |
shear(double sh,
double sv)
Shears the transformation. |
WTransform |
translate(double dx,
double dy)
Translates the transformation. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final WTransform Identity
isIdentity()| Constructor Detail |
|---|
public WTransform()
Creates the identity transformation matrix.
public WTransform(double m11,
double m12,
double m21,
double m22,
double dx,
double dy)
Creates a matrix from the specified parameters.
| Method Detail |
|---|
public WTransform assign(WTransform rhs)
Copies the transformation from the rhs.
public WTransform clone()
Clones this WTransform object.
clone in class java.lang.Objectpublic boolean equals(WTransform rhs)
Returns true if the transforms are exactly the same.
public boolean isIdentity()
Returns true if the transform represents an identity transformation.
public double getM11()
public double getM12()
public double getM13()
public double getM21()
public double getM22()
public double getM23()
public double getM31()
Is equivalent to getDx()
public double getM32()
Is equivalent to getDy()
public double getM33()
public double getDx()
Is equivalent to getM31()
public double getDy()
Is equivalent to getM32()
public WPointF map(WPointF p)
Returns the transformed point.
map(double x, double y, Double tx, Double ty)
public void map(double x,
double y,
java.lang.Double tx,
java.lang.Double ty)
Sets the point (tx, ty) to the transformation of the
point (x, y).
map(WPointF p)public void reset()
isIdentity(),
WTransform()public WTransform rotate(double angle)
Applies a clock-wise rotation to the current transformation matrix, over
angle degrees.
rotateRadians(double angle)public WTransform rotateRadians(double angle)
Applies a clock-wise rotation to the current transformation matrix, over
angle radians.
rotate(double angle)
public WTransform scale(double sx,
double sy)
Applies a clock-wise rotation to the current transformation matrix, over
angle radians.
shear(double sh, double sv)
public WTransform shear(double sh,
double sv)
Shears the current transformation.
scale(double sx, double sy),
rotate(double angle)
public WTransform translate(double dx,
double dy)
Translates the current transformation.
public WTransform multiplyAndAssign(WTransform Y)
public WTransform multiply(WTransform rhs)
public double getDeterminant()
public WTransform getAdjoint()
public WTransform getInverted()
Returns this if the transformation could not be inverted (
getDeterminant() == 0), and logs an
error instead.
public void decomposeTranslateRotateScaleSkew(WTransform.TRSSDecomposition result)
Decomposes the transformation into elementary operations: translation
(dx, dy), followed by rotation (alpha),
followed by scale (sx, sy) and vertical shearing
factor (sh). The angle is expressed in radians.
This performs a Gram-Schmidt orthonormalization.
public void decomposeTranslateRotateScaleRotate(WTransform.TRSRDecomposition result)
Decomposes the transformation into elementary operations: translation
(dx, dy), followed by rotation (alpha2),
followed by scale (sx, sy) and again a rotation (
alpha2). The angles are expressed in radians.
This performs a Singular Value Decomposition (SVD).
public static double degreesToRadians(double angle)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||