This commit is contained in:
sloop
2016-07-24 03:17:36 +08:00
committed by GitHub
parent 1a79990ba5
commit 49d4f26620

View File

@@ -114,12 +114,66 @@ Matrix 是一个矩阵,肯定会涉及到一些比较麻烦的理论知识,
线性变换主要有3种: 缩放(scale)、旋转(rotate) 和 错切(skew)。
下面我们就以坐标映射的角度来讲讲这几种操作。
线性变换均可用矩阵乘法完成(不了解矩阵乘法规则的参考下面维基百科)下面我们就来讲讲这几种操作。
**[维基百科-矩阵乘法](https://zh.wikipedia.org/wiki/%E7%9F%A9%E9%99%A3%E4%B9%98%E6%B3%95)**
#### a.缩放
以点(10,10)为例我们将x缩放到原来到0.5倍y缩放到原来到2倍我们可以轻易到算出结果:(10x0.5, 10x2) = (5, 20)
矩阵计算公式:
![](http://latex.codecogs.com/png.latex?
$$
\\left [
\\begin{matrix}
X\\\\
Y
\\end{1}
\\right ]
=
\\left [
\\begin{matrix}
Scale\\_X & 0 \\\\
0 & Scale\\_Y
\\end{1}
\\right ]
.
\\left [
\\begin{matrix}
x\\\\
y
\\end{1}
\\right ]
$$)
用计算示例:
![](http://latex.codecogs.com/png.latex?
$$
\\left [
\\begin{matrix}
5 \\\\
20
\\end{1}
\\right ]
=
\\left [
\\begin{matrix}
0.5 & 0 \\\\
0 & 2
\\end{1}
\\right ]
.
\\left [
\\begin{matrix}
10\\\\
10
\\end{1}
\\right ]
$$)
### 四大常用操作