Matrix = | D E F |, S(sx, sy, px, py) = | 0 sy dy |
| G H I | | 0 0 1 |
where
dx = px - sx * px
dy = py - sy * py
sets Matrix to:
| A B C | | sx 0 dx | | A*sx B*sy A*dx+B*dy+C |
Matrix * S(sx, sy, px, py) = | D E F | | 0 sy dy | = | D*sx E*sy D*dx+E*dy+F |
| G H I | | 0 0 1 | | G*sx H*sy G*dx+H*dy+I |
参数:
-`sx:int/float` 水平缩放值
-`sy:int/float` 垂直缩放值
-`px:int/float` 中心点坐标,默认为`0`
-`py:int/float` 中心点坐标,默认为`0`
返回:`None`
返回类型:`None`
---
### `postScale(sx, sy, |px, py)`
Sets Matrix to Matrix constructed from scaling by (sx, sy) about pivot point (px, py), multiplied by Matrix.
设置矩阵为比例缩放矩阵,比例缩放的值为sx和sy,缩放的中心点为(px, py),然后乘以矩阵。
Given:
| J K L | | sx 0 dx |
Matrix = | M N O |, S(sx, sy, px, py) = | 0 sy dy |
| P Q R | | 0 0 1 |
where
dx = px - sx * px
dy = py - sy * py
sets Matrix to:
| sx 0 dx | | J K L | | sx*J+dx*P sx*K+dx*Q sx*L+dx+R |
S(sx, sy, px, py) * Matrix = | 0 sy dy | | M N O | = | sy*M+dy*P sy*N+dy*Q sy*O+dy*R |
| 0 0 1 | | P Q R | | P Q R |
参数:
-`sx:int/float` 水平缩放值
-`sy:int/float` 垂直缩放值
-`px:int/float` 中心点坐标,默认为`0`
-`py:int/float` 中心点坐标,默认为`0`
返回:`None`
返回类型:`None`
---
### `setRotate(degrees, |px, py)`
Sets Matrix to rotate by degrees about a pivot point at (px, py). The pivot point is unchanged when mapped with Matrix. Positive degrees rotates clockwise.
Sets Matrix to Matrix multiplied by Matrix constructed from rotating by degrees about pivot point (px, py).
设置矩阵为矩阵乘以旋转矩阵,旋转的角度为degrees,旋转的中心点为(px, py)。
Given:
| A B C | | c -s dx |
Matrix = | D E F |, R(degrees, px, py) = | s c dy |
| G H I | | 0 0 1 |
where
c = cos(degrees)
s = sin(degrees)
dx = s * py + (1 - c) * px
dy = -s * px + (1 - c) * py
sets Matrix to:
| A B C | | c -s dx | | Ac+Bs -As+Bc A*dx+B*dy+C |
Matrix * R(degrees, px, py) = | D E F | | s c dy | = | Dc+Es -Ds+Ec D*dx+E*dy+F |
| G H I | | 0 0 1 | | Gc+Hs -Gs+Hc G*dx+H*dy+I |
参数:
-`degrees:int/float` 旋转角度
-`px:int/float` 中心点坐标,默认为`0`
-`py:int/float` 中心点坐标,默认为`0`
返回:`None`
返回类型:`None`
---
### `postRotate(degrees, |px, py)`
Sets Matrix to Matrix constructed from rotating by degrees about pivot point (0, 0), multiplied by Matrix.
设置矩阵为旋转矩阵,旋转的角度为degrees,旋转的中心点为(0, 0),然后乘以矩阵。
Given:
| J K L | | c -s dx |
Matrix = | M N O |, R(degrees, px, py) = | s c dy |
| P Q R | | 0 0 1 |
where
c = cos(degrees)
s = sin(degrees)
dx = s * py + (1 - c) * px
dy = -s * px + (1 - c) * py
sets Matrix to:
|c -s dx| |J K L| |cJ-sM+dx*P cK-sN+dx*Q cL-sO+dx+R|
R(degrees, px, py) * Matrix = |s c dy| |M N O| = |sJ+cM+dy*P sK+cN+dy*Q sL+cO+dy*R|
|0 0 1| |P Q R| | P Q R|
参数:
-`degrees:int/float` 旋转角度
-`px:int/float` 中心点坐标,默认为`0`
-`py:int/float` 中心点坐标,默认为`0`
返回:`None`
返回类型:`None`
---
### `setTranslate(dx, dy)`
Sets Matrix to translate by (dx, dy).
设置矩阵为平移矩阵,平移的值为(dx, dy)。
参数:
-`dx:int/float` 水平平移值
-`dy:int/float` 垂直平移值
返回:`None`
返回类型:`None`
---
### `preTranslate(dx, dy)`
Sets Matrix to Matrix multiplied by Matrix constructed from translation (dx, dy).
设置矩阵为矩阵乘以平移矩阵,平移的值为(dx, dy)。
Given:
| A B C | | 1 0 dx |
Matrix = | D E F |, T(dx, dy) = | 0 1 dy |
| G H I | | 0 0 1 |
sets Matrix to:
| A B C | | 1 0 dx | | A B A*dx+B*dy+C |
Matrix * T(dx, dy) = | D E F | | 0 1 dy | = | D E D*dx+E*dy+F |
| G H I | | 0 0 1 | | G H G*dx+H*dy+I |
参数:
-`dx:int/float` 水平平移值
-`dy:int/float` 垂直平移值
返回:`None`
返回类型:`None`
---
### `postTranslate(dx, dy)`
Sets Matrix to Matrix constructed from translation (dx, dy) multiplied by Matrix.
This can be thought of as moving the point to be mapped after applying Matrix.
设置矩阵为平移矩阵,平移的值为(dx, dy),然后乘以矩阵。
Given:
| J K L | | 1 0 dx |
Matrix = | M N O |, T(dx, dy) = | 0 1 dy |
| P Q R | | 0 0 1 |
sets Matrix to:
| 1 0 dx | | J K L | | J+dx*P K+dx*Q L+dx*R |
T(dx, dy) * Matrix = | 0 1 dy | | M N O | = | M+dy*P N+dy*Q O+dy*R |
| 0 0 1 | | P Q R | | P Q R |
参数:
-`dx:int/float` 水平平移值
-`dy:int/float` 垂直平移值
返回:`None`
返回类型:`None`
---
### `setPolyToPoly(src, dst)`
Sets Matrix to map src to dst. count must be zero or greater, and four or less. If count is zero, sets Matrix to identity and returns true. If count is one, sets Matrix to translate and returns true. If count is two or more, sets Matrix to map Point if possible; returns false if Matrix cannot be constructed. If count is four, Matrix may include perspective.
设置矩阵,将src的坐标列表映射到dst的坐标列表。坐标的数目需大于等于0,小于等于4。
- 如果数目为0,将矩阵设置为单位矩阵
- 如果数目为1,将矩阵设置为平移矩阵
- 如果数目大于等于2,将矩阵设置为映射坐标(有可能没有正确的映射)
- 如果数目为4,矩阵可能包含透视值
参数:
-`src:[float]` 源点坐标列表
-`dst:[float]` 目标点坐标列表
返回:`None`
返回类型:`None`
---
### `invert()`
Sets inverse to reciprocal matrix, returning true if Matrix can be inverted. Geometrically, if Matrix maps from source to destination, inverse Matrix maps from destination to source. If Matrix can not be inverted, inverse is unchanged.
Copies nine scalar values contained by Matrix into list, in member value ascending order: kMScaleX, kMSkewX, kMTransX, kMSkewY, kMScaleY, kMTransY, kMPersp0, kMPersp1, kMPersp2.