Struct Transform2D
Represents a 2D transformation.
Inherited Members
Namespace: TopSolid.Kernel.Automating
Assembly: cs.temp.dll.dll
Syntax
[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
Transform2D(Double, Double, Double, Double, Double, Double, Double, Double, Double)
Initializes a new instance of the Transform2D structure.
Declaration
public Transform2D(double inR00, double inR01, double inTx, double inR10, double inR11, double inTy, double inPx, double inPy, double inSi)
Parameters
Type | Name | Description |
---|---|---|
System.Double | inR00 | |
System.Double | inR01 | |
System.Double | inTx | |
System.Double | inR10 | |
System.Double | inR11 | |
System.Double | inTy | |
System.Double | inPx | |
System.Double | inPy | |
System.Double | inSi |
Fields
Identity
Indentity transformation.
Declaration
public static readonly Transform2D Identity
Field Value
Type | Description |
---|---|
Transform2D |
Px
Perspective factor along X.
Declaration
public double Px
Field Value
Type | Description |
---|---|
System.Double |
Py
Perspective factor along Y.
Declaration
public double Py
Field Value
Type | Description |
---|---|
System.Double |
R00
Rotation[0,0].
Declaration
public double R00
Field Value
Type | Description |
---|---|
System.Double |
R01
Rotation[0,1].
Declaration
public double R01
Field Value
Type | Description |
---|---|
System.Double |
R10
Rotation[1,0].
Declaration
public double R10
Field Value
Type | Description |
---|---|
System.Double |
R11
Rotation[1,1].
Declaration
public double R11
Field Value
Type | Description |
---|---|
System.Double |
Si
Inverse of the global scale factor.
Declaration
public double Si
Field Value
Type | Description |
---|---|
System.Double |
Tx
Translation along X.
Declaration
public double Tx
Field Value
Type | Description |
---|---|
System.Double |
Ty
Translation along Y.
Declaration
public double Ty
Field Value
Type | Description |
---|---|
System.Double |
Methods
SetRotation(Point3D, Double)
Sets the transformation as the rotation about a specified point with a specified angle.
Declaration
public void SetRotation(Point3D inCenter, double inAngle)
Parameters
Type | Name | Description |
---|---|---|
Point3D | inCenter | Rotation center. |
System.Double | inAngle | Rotation angle, in radians. |
SetTranslation(Vector2D)
Sets the transformation as the translation along a specified vector.
Declaration
public void SetTranslation(Vector2D inVector)
Parameters
Type | Name | Description |
---|---|---|
Vector2D | inVector | Translation vector. |