make geometry transform of a given Polygon2D with given Transform or AffineTransform parameters.
GeometryTransform
00 Remarks
Transform(相似变换) 是AffineTransform(仿射变换)** 的一个特例:从 Transform 到 AffineTransform:总是可以。因为 Transform 类所描述的变换(旋转、平移、缩放)是 AffineTransform 类(仿射变换)的一个子集。任何相似变换都可以用一个仿射变换矩阵来表示。
Transform->AffineTransform** 的转换是直接且总是可行的:从 AffineTransform 到 Transform:不一定可以。只有当 AffineTransform 不包含剪切效果时,才可以等价转换为一个 Transform 对象。如果 AffineTransform 包含剪切,那么它无法用 theta, scalex, scaley 这几个参数来唯一描述。AffineTransform->Transform* 的转换需要检查是否存在剪切。通过检查矩阵左上角 2x2 部分的两个列向量是否正交(`ab + d*e ≈ 0`)来判断。
变换的矩阵表示
一个 2D 点 (x, y) 用齐次坐标表示为 [x, y, 1]。变换矩阵 M 与之相乘得到新的点 [x', y', 1]。
Transform 的组合矩阵
Transform 类描述的变换顺序通常是:缩放 -> 旋转 -> 平移。
缩放矩阵 (S):
| scalex 0 0 | | 0 scaley 0 | | 0 0 1 |
旋转矩阵 ® (注意:VB.NET 的 Math.Sin 和 Math.Cos 使用弧度):
| cos(theta) -sin(theta) 0 | | sin(theta) cos(theta) 0 | | 0 0 1 |
平移矩阵 (T):
| 1 0 tx | | 0 1 ty | | 0 0 1 |
最终的组合矩阵 M_transform 是 T R S:
M_transform = T R S = | cos(theta)scalex -sin(theta)scaley tx | | sin(theta)scalex cos(theta)scaley ty | | 0 0 1 |
AffineTransform 的矩阵
AffineTransform 类直接定义了矩阵的元素:
M_affine = | a b c | | d e f | | 0 0 1 |
其中 x' = ax + by + c 和 y' = dx + ey + f。
01 Syntax
02 Methods
| Name | Overloads | Summary |
|---|---|---|
| ApplyTo | 1 | Apply the current transformation parameters to the target polygon object. |
03 Members
Apply the current transformation parameters to the target polygon object.
| Name | Type | Description |
|---|---|---|
polygon | Polygon2D | - |