-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
139 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
# GAMES101 笔记 | ||
|
||
## 课程注解 | ||
|
||
### 旋转变换矩阵是正交矩阵 | ||
|
||
|
||
### 先平移再线性变换 | ||
|
||
$$ | ||
\begin{pmatrix} | ||
a&b&c&t_x\\ | ||
d&e&f&t_y\\ | ||
g&h&i&t_z\\ | ||
0&0&0&1\\ | ||
\end{pmatrix}= | ||
\begin{pmatrix} | ||
a&b&c&0\\ | ||
d&e&f&0\\ | ||
g&h&i&0\\ | ||
0&0&0&1\\ | ||
\end{pmatrix}\begin{pmatrix} | ||
1&0&0&t_x\\ | ||
0&1&0&t_y\\ | ||
0&0&1&t_z\\ | ||
0&0&0&1\\ | ||
\end{pmatrix} | ||
$$ | ||
|
||
|
||
$$ | ||
变换=线性变换\times平移变换 | ||
$$ | ||
|
||
|
||
### 透视投影 | ||
|
||
![1689059400149](image/一些笔记/1689059400149.png) | ||
|
||
对远端平面上的任意一点,x、y坐标的缩放如下图所示 | ||
|
||
n为原点与近端平面的距离 | ||
|
||
![1689059532544](image/一些笔记/1689059532544.png) | ||
|
||
因此变换后的齐次坐标为 | ||
|
||
$$ | ||
\begin{pmatrix} | ||
nx/z\\ny/z\\z'\\1 | ||
\end{pmatrix}==\begin{pmatrix} | ||
nx\\ny\\zz'\\z | ||
\end{pmatrix} | ||
$$ | ||
|
||
设变换矩阵的为 | ||
|
||
$$ | ||
\begin{pmatrix} | ||
n&0&0&0\\ | ||
0&n&0&0\\ | ||
A&B&C&D\\ | ||
0&0&1&0\\ | ||
\end{pmatrix} | ||
$$ | ||
|
||
近端平面上任意一点的坐标不变(规定)为n | ||
|
||
$$ | ||
\begin{pmatrix} | ||
x\\y\\n\\1 | ||
\end{pmatrix}==\begin{pmatrix} | ||
nx\\ny\\n^2\\n | ||
\end{pmatrix} | ||
$$ | ||
|
||
因此 | ||
|
||
$$ | ||
\begin{pmatrix} | ||
A&B&C&D | ||
\end{pmatrix}\begin{pmatrix} | ||
x\\y\\n\\1 | ||
\end{pmatrix}=Ax+By+Cn+D=n^2\\ | ||
=>A=B=0 | ||
$$ | ||
|
||
远端平面上任意一点的z坐标不变(规定)为f | ||
|
||
$$ | ||
\begin{pmatrix} | ||
0&0&C&D | ||
\end{pmatrix}\begin{pmatrix} | ||
x\\y\\f\\1 | ||
\end{pmatrix}=Cf+D=f^2 | ||
$$ | ||
|
||
联立解得 | ||
|
||
$$ | ||
C=n+f\\ | ||
D=-nf | ||
$$ | ||
|
||
因此透视投影的变换矩阵为 | ||
|
||
$$ | ||
\begin{pmatrix} | ||
n&0&0&0\\ | ||
0&n&0&0\\ | ||
0&0&n+f&-nf\\ | ||
0&0&1&0\\ | ||
\end{pmatrix} | ||
$$ | ||
|
||
对梯形中的任意一点,变换之后的坐标为 | ||
|
||
$$ | ||
\begin{pmatrix} | ||
n&0&0&0\\ | ||
0&n&0&0\\ | ||
0&0&n+f&-nf\\ | ||
0&0&1&0\\ | ||
\end{pmatrix}\begin{pmatrix} | ||
x\\y\\z\\1 | ||
\end{pmatrix}=\begin{pmatrix} | ||
nx\\ny\\(n+f)z-nf\\z | ||
\end{pmatrix}\\ | ||
其中\ f\le z\le n\lt0 | ||
$$ | ||
|
||
计算可知 | ||
|
||
$$ | ||
\frac{(n+f)z-nf}{z}\le z | ||
$$ | ||
|
||
因此变换之后,梯形体内部的z坐标相比变换前变小了,也即变远了 |