数学/草稿-1:修订间差异
来自康健生活
< 数学
| 第244行: | 第244行: | ||
[[文件:Matrix-旋转-1.png|400px|无|matrix-旋转-1]] | [[文件:Matrix-旋转-1.png|400px|无|matrix-旋转-1]] | ||
=== 组合 === | |||
<syntaxhighlight lang="css"> | |||
.box { | |||
transform: rotate(30deg) scale(0.3, 0.6); | |||
}</syntaxhighlight> | |||
组合需要进行矩阵乘法计算 | |||
<math>\begin{bmatrix} | |||
\cos{30^\circ} & -\sin{30^\circ} & 0 \\ | |||
\sin{30^\circ} & \cos{30^\circ} & 0 \\ | |||
0 & 0 & 1 \\ | |||
\end{bmatrix} \times {bmatrix} | |||
0.3 & 0 & 0 \\ | |||
0 & 0.6 & 0 \\ | |||
0 & 0 & 1 \\ | |||
\end{bmatrix} = {bmatrix} | |||
0.258 & -0.3 & 0 \\ | |||
0.15 & 0.516 & 0 \\ | |||
0 & 0 & 1 \\ | |||
\end{bmatrix}</math> | |||
等价于 | |||
<syntaxhighlight lang="css"> | |||
.box { | |||
transform: matrix(0.258, 0.15, -0.3, 0.516, 0, 0); | |||
}</syntaxhighlight> | |||
[[文件:Matrix-组合计算-1.png|400px|无|matrix-组合计算-1]] | |||
== 齐次坐标系 == | == 齐次坐标系 == | ||
2023年8月3日 (四) 13:55的版本
通用公式
假设 。其中,A 为 的 m 行 n 列矩阵,B 为 列的矩阵。B 拆分为列向量,并且列向量的维数就是矩阵的行数。
方法
transform(a, b, c, d, e, f) 与 Matrix 的转换。
推导出来
简化后
状态
缩放
推导出来
scale
.box {
transform: scale(0.3, 0.6);
}
通过公式计算
等价于
.box {
transform: matrix(0.3, 0, 0, 0.6, 0, 0);
}

平移
推导出来
旋转
定义为弧度,并定义 为角度。则 值为
推导出来
假设
假设存在点 E 移动至点 F。设 E 坐标为(x1, y1),F 坐标为(x2, y2),D 坐标为(a, b)。
简要图示:

初中数学:
演算:
推导:
点旋转的角度 是正旋转还是负旋转,当角度是负旋转时 。
验证:
转换为矩阵:
rotate
从 css 语法上开始转换
.box {
transform: rotate(30deg);
}
这个旋转套用公式
等价于
.box {
transform: matrix(0.86, 0.5, -0.5, 0.86, 0, 0);
}

组合
.box {
transform: rotate(30deg) scale(0.3, 0.6);
}
组合需要进行矩阵乘法计算
解析失败 (语法错误): {\displaystyle \begin{bmatrix} \cos{30^\circ} & -\sin{30^\circ} & 0 \\ \sin{30^\circ} & \cos{30^\circ} & 0 \\ 0 & 0 & 1 \\ \end{bmatrix} \times {bmatrix} 0.3 & 0 & 0 \\ 0 & 0.6 & 0 \\ 0 & 0 & 1 \\ \end{bmatrix} = {bmatrix} 0.258 & -0.3 & 0 \\ 0.15 & 0.516 & 0 \\ 0 & 0 & 1 \\ \end{bmatrix}}
等价于
.box {
transform: matrix(0.258, 0.15, -0.3, 0.516, 0, 0);
}
