#include <Wt/WTransform>
Public Member Functions | |
WTransform () | |
Default constructor. | |
WTransform (double m11, double m12, double m21, double m22, double dx, double dy) | |
Construct a custom matrix by specifying the parameters. | |
WTransform & | operator= (const WTransform &rhs) |
Assignment operator. | |
bool | operator== (const WTransform &rhs) const |
Comparison operator. | |
bool | operator!= (const WTransform &rhs) const |
Comparison operator. | |
bool | isIdentity () const |
Identity check. | |
double | m11 () const |
Returns the horizontal scaling factor. | |
double | m12 () const |
Returns the vertical shearing factor. | |
double | m13 () const |
Returns m13 = 0. | |
double | m21 () const |
Returns the horizontal shearing factor. | |
double | m22 () const |
Returns the vertical scaling factor. | |
double | m23 () const |
Returns m23 = 0. | |
double | m31 () const |
Returns the horizontal translation factor. | |
double | m32 () const |
Returns the vertical translation factor. | |
double | m33 () const |
Returns m33 = 1. | |
double | dx () const |
Returns the horizontal translation factor. | |
double | dy () const |
Returns the vertical translation factor. | |
WPointF | map (const WPointF &p) const |
Apply the transformation to a point. | |
void | map (double x, double y, double *tx, double *ty) const |
Apply the transformation to a point. | |
void | reset () |
Resets the transformation to the identity. | |
WTransform & | rotate (double angle) |
Rotate the transformation. | |
WTransform & | rotateRadians (double angle) |
Rotate the transformation. | |
WTransform & | scale (double sx, double sy) |
Scale the transformation. | |
WTransform & | shear (double sh, double sv) |
Shear the transformation. | |
WTransform & | translate (double dx, double dy) |
Translate the transformation. | |
void | decomposeTranslateRotateScaleSkew (double &dx, double &dy, double &alpha, double &sx, double &sy, double &sh) const |
Decompose the transformation. | |
void | decomposeTranslateRotateScaleRotate (double &dx, double &dy, double &alpha1, double &sx, double &sy, double &alpha2) const |
Decompose the transformation. |
The matrix is encoded using 6 parameters:
m11 m12 0 m21 m22 0 dx dy 1
In this representation, dx (=m31) and dy (=m32) represent the translation components, and mxy represent a 2D matrix that contains the scale, rotation (and skew) components.
Wt::WTransform::WTransform | ( | ) |
Default constructor.
Creates the identity transformation matrix.
Wt::WTransform::WTransform | ( | double | m11, | |
double | m12, | |||
double | m21, | |||
double | m22, | |||
double | dx, | |||
double | dy | |||
) |
Construct a custom matrix by specifying the parameters.
Creates a matrix from the specified parameters.
WTransform & Wt::WTransform::operator= | ( | const WTransform & | rhs | ) |
Assignment operator.
Copies the transformation from the rhs.
bool Wt::WTransform::operator== | ( | const WTransform & | rhs | ) | const |
Comparison operator.
Returns true if the transforms are exactly the same.
bool Wt::WTransform::operator!= | ( | const WTransform & | rhs | ) | const |
Comparison operator.
Returns true if the transforms are different.
bool Wt::WTransform::isIdentity | ( | ) | const |
Identity check.
Returns true if the transform represents an identity transformation.
double Wt::WTransform::m31 | ( | ) | const [inline] |
Returns the horizontal translation factor.
Is equivalent to dx()
double Wt::WTransform::m32 | ( | ) | const [inline] |
Returns the vertical translation factor.
Is equivalent to dy()
double Wt::WTransform::dx | ( | ) | const [inline] |
Returns the horizontal translation factor.
Is equivalent to m31()
double Wt::WTransform::dy | ( | ) | const [inline] |
Returns the vertical translation factor.
Is equivalent to m32()
Apply the transformation to a point.
Returns the transformed point.
void Wt::WTransform::map | ( | double | x, | |
double | y, | |||
double * | tx, | |||
double * | ty | |||
) | const |
Apply the transformation to a point.
Sets the point (tx, ty) to the transformation of the point (x, y).
void Wt::WTransform::reset | ( | ) |
WTransform & Wt::WTransform::rotate | ( | double | angle | ) |
Rotate the transformation.
Applies a clock-wise rotation to the current transformation matrix, over angle degrees.
WTransform & Wt::WTransform::rotateRadians | ( | double | angle | ) |
Rotate the transformation.
Applies a clock-wise rotation to the current transformation matrix, over angle radians.
WTransform & Wt::WTransform::scale | ( | double | sx, | |
double | sy | |||
) |
Scale the transformation.
Applies a clock-wise rotation to the current transformation matrix, over angle radians.
WTransform & Wt::WTransform::shear | ( | double | sh, | |
double | sv | |||
) |
Shear the transformation.
Shears the current transformation
WTransform & Wt::WTransform::translate | ( | double | dx, | |
double | dy | |||
) |
Translate the transformation.
Translates the current transformation
void Wt::WTransform::decomposeTranslateRotateScaleSkew | ( | double & | dx, | |
double & | dy, | |||
double & | alpha, | |||
double & | sx, | |||
double & | sy, | |||
double & | sh | |||
) | const |
Decompose the transformation.
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.
void Wt::WTransform::decomposeTranslateRotateScaleRotate | ( | double & | dx, | |
double & | dy, | |||
double & | alpha1, | |||
double & | sx, | |||
double & | sy, | |||
double & | alpha2 | |||
) | const |
Decompose the transformation.
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.