Struct Transform2D
Represents a 2D transformation.
Inherited Members
Namespace: TopSolid.Kernel.Automating
Assembly: TopSolid.Kernel.Automating.dll
Syntax
[DataContract]
[AvailableSinceVersion(7, 6, 0, 0)]
public struct Transform2D
Remarks
The transformation is defined by a 3x3 matrix that operates as multiplier on column vectors containing homogeneous coordinates:
[ R00 R01 Tx ]
[ R10 R11 Ty ]
[ Px Py Si ]
That transforms (X, Y, H) into (X', Y', H') as follows:
X' = R00 * X + R01 * Y + Tx * H
Y' = R10 * X + R11 * Y + Ty * H
H' = Px * X + Py * Y + Si * H
R is a non singular transformation matrix, that contains the rotation, reflection,
non-uniform scaling and shearing components.
T is a translation vector.
P represents the perspective terms in viewing transformations. It must be zero in
transformations used for modeling.
Si is the inverse of the global scale factor, it has to be greater than zero.
In the case of conventional coordinates, H is equal to one, and the coordinates of the transformed point are (X'/H', Y'/H').
For instance here is the transformation matrix corresponding to the rotation of angle "a" around the origin point:
[ cos(a) -sin(a) 0 ]
[ sin(a) cos(a) 0 ]
[ 0 0 1 ]
This structure is available since v7.6.
Constructors
| Name | Description |
|---|---|
| Transform2D(double, double, double, double, double, double, double, double, double) | Initializes a new instance of the Transform2D structure. |
Fields
| Name | Description |
|---|---|
| Identity | Indentity transformation. |
| Px | Perspective factor along X. |
| Py | Perspective factor along Y. |
| R00 | Rotation[0,0]. |
| R01 | Rotation[0,1]. |
| R10 | Rotation[1,0]. |
| R11 | Rotation[1,1]. |
| Si | Inverse of the global scale factor. |
| Tx | Translation along X. |
| Ty | Translation along Y. |
Methods
| Name | Description |
|---|---|
| SetRotation(Point3D, double) | Sets the transformation as the rotation about a specified point with a specified angle. |
| SetTranslation(Vector2D) | Sets the transformation as the translation along a specified vector. |