改进排版

This commit is contained in:
2025-02-23 20:51:53 +08:00
parent 2bf0000c22
commit 791c17ebdf
21 changed files with 1946 additions and 1827 deletions
+5 -4
View File
@@ -142,13 +142,14 @@ $$
### 2.5叉积
#### 2.5.1 定义
对于两个三维矢量$\vec{a}, \vec{b}$,定义它们的叉积
$$
\vec{\boldsymbol a}\times\vec{\boldsymbol b}=\begin{vmatrix}
$$\begin{aligned}
\vec{\boldsymbol a}\times\vec{\boldsymbol b}&=\begin{vmatrix}
\vec{\boldsymbol i}& \vec{\boldsymbol j} & \vec{\boldsymbol k}\cr
a_x & a_y & a_z \cr
b_x & b_y & b_z
\end{vmatrix}=
(a_yb_z-a_zb_y)\vec{\boldsymbol{i}}+(a_zb_x-a_xb_z)\vec{\boldsymbol{j}}+(a_xb_y-a_yb_x)\vec{\boldsymbol{k}}
\end{vmatrix}\\
&=(a_yb_z-a_zb_y)\vec{\boldsymbol{i}}+(a_zb_x-a_xb_z)\vec{\boldsymbol{j}}+(a_xb_y-a_yb_x)\vec{\boldsymbol{k}}
\end{aligned}
$$
#### 2.5.2 叉积的几何意义
在三维几何中,向量a和向量b的叉乘结果是一个向量,更为熟知的叫法是法向量,该向量垂直于a和b向量构成的平面。
+16 -7
View File
@@ -7,19 +7,23 @@ $\boldsymbol A_{ij}$表示第$i$行第$j$列的元素,
$\boldsymbol A_{i,*}$表示第$i$行所有元素,
$\boldsymbol A_{*,j}$表示第$j$列所有元素,
$$
\boldsymbol A=\begin{bmatrix}
\begin{aligned}
\boldsymbol A&=\begin{bmatrix}
A_{11}&A_{12}&A_{13}\\
A_{21}&A_{22}&A_{23}\\
A_{31}&A_{32}&A_{33}
\end{bmatrix}=\begin{bmatrix}
\end{bmatrix}\\
&=\begin{bmatrix}
\leftarrow & A_{1,*} & \rightarrow \\
\leftarrow & A_{2,*} & \rightarrow \\
\leftarrow & A_{3,*} & \rightarrow
\end{bmatrix}=\begin{bmatrix}
\end{bmatrix}\\
&=\begin{bmatrix}
\uparrow & \uparrow & \uparrow \\
A_{*,1} & A_{*,2} & A_{*,3} \\
\downarrow & \downarrow & \downarrow
\end{bmatrix}
\end{aligned}
$$
### 3.2 加法
如果矩阵$\boldsymbol A$是一个$m\times n$的矩阵,矩阵$\boldsymbol B$是一个$m\times n$的矩阵,那么$\boldsymbol A +\boldsymbol B$是一个$m\times n$的矩阵$\boldsymbol C$,并且
@@ -72,11 +76,13 @@ $$
#### 3.4.2 举例
$$
\boldsymbol A=\begin{bmatrix}
\begin{aligned}
\boldsymbol A&=\begin{bmatrix}
2&-1&8\\3&6&-4\end{bmatrix}\\
\boldsymbol A^T=\begin{bmatrix}
\boldsymbol A^T&=\begin{bmatrix}
2&3\\-1&6\\8&-4
\end{bmatrix}
\end{aligned}
$$
### 3.4.3 正交矩阵
@@ -140,10 +146,13 @@ $$
#### 3.8.2 举例
$$
\det{\begin{bmatrix}
\begin{aligned}
&\det{\begin{bmatrix}
A_{11}&A_{12}\\
A_{21}&A_{22}
\end{bmatrix}}=A_{11}\det[A_{22}]-A_{12}\det[A_{21}]=A_{11}A_{22}-A_{12}A_{21}
\end{bmatrix}}\\
&=A_{11}\det[A_{22}]-A_{12}\det[A_{21}]=A_{11}A_{22}-A_{12}A_{21}
\end{aligned}
$$
$$\begin{split}
+38 -35
View File
@@ -2,9 +2,9 @@
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="800"
height="600"
viewBox="0 0 211.66666 158.75001"
width="450"
height="850"
viewBox="0 0 119.0625 224.89585"
version="1.1"
id="svg8"
inkscape:version="1.4 (86a8ad7, 2024-10-11)"
@@ -25,17 +25,17 @@
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.2727922"
inkscape:cx="194.45437"
inkscape:cy="181.49074"
inkscape:cx="386.94455"
inkscape:cy="626.57518"
inkscape:document-units="px"
inkscape:current-layer="layer1"
inkscape:current-layer="svg8"
showgrid="true"
units="px"
inkscape:snap-intersection-paths="true"
inkscape:window-width="2560"
inkscape:window-height="1476"
inkscape:window-x="-12"
inkscape:window-y="-12"
inkscape:window-height="1494"
inkscape:window-x="-11"
inkscape:window-y="-11"
inkscape:window-maximized="1"
inkscape:snap-midpoints="true"
inkscape:pagecheckerboard="0"
@@ -1041,29 +1041,7 @@
height="100%" />
<g
inkscape:label=""
transform="translate(98.26326,225.85645)"
id="g24"
style="stroke:none;stroke-width:1.00013;stroke-dasharray:none;stroke-opacity:1">
<g
fill="#000000"
fill-opacity="1"
id="g2-1"
transform="matrix(0.352778,0,0,0.352778,-1.10547,0.448292)"
style="stroke:none;stroke-width:2.835;stroke-dasharray:none;stroke-opacity:1">
<g
id="use1-1"
transform="translate(1.993,9.573)"
style="stroke:none;stroke-width:2.835;stroke-dasharray:none;stroke-opacity:1">
<path
d="m 15,-6.75 c 0.859375,0.734375 1.921875,1.28125 2.59375,1.578125 -0.734375,0.34375 -1.75,0.875 -2.59375,1.59375 H 1.875 c -0.34375,0 -0.734375,0 -0.734375,0.421875 0,0.40625 0.375,0.40625 0.71875,0.40625 H 14.0625 C 13.078125,-1.796875 12,0.015625 12,0.296875 c 0,0.21875 0.265625,0.21875 0.390625,0.21875 0.171875,0 0.3125,0 0.390625,-0.171875 0.4375,-0.78125 1.015625,-1.875 2.359375,-3.078125 1.421875,-1.25 2.8125,-1.8125 3.890625,-2.125 0.34375,-0.125 0.359375,-0.140625 0.40625,-0.1875 0.04687,-0.015625 0.04687,-0.078125 0.04687,-0.125 0,-0.03125 0,-0.078125 -0.03125,-0.109375 l -0.0625,-0.046875 C 19.359375,-5.34375 19.328125,-5.375 18.9375,-5.5 c -2.78125,-0.828125 -4.84375,-2.703125 -6,-4.90625 -0.234375,-0.421875 -0.25,-0.4375 -0.546875,-0.4375 -0.125,0 -0.390625,0 -0.390625,0.21875 0,0.28125 1.0625,2.078125 2.0625,3.046875 H 1.859375 c -0.34375,0 -0.71875,0 -0.71875,0.40625 C 1.140625,-6.75 1.53125,-6.75 1.875,-6.75 Z m 0,0"
id="path2-1"
style="stroke:none;stroke-width:2.835;stroke-dasharray:none;stroke-opacity:1" />
</g>
</g>
</g>
<g
inkscape:label=""
transform="rotate(90,-56.438026,205.0227)"
transform="rotate(90,-103.52201,164.59076)"
id="g24-7"
style="stroke:none;stroke-width:1.00013;stroke-dasharray:none;stroke-opacity:1">
<g
@@ -1083,9 +1061,32 @@
</g>
</g>
</g>
<g
inkscape:label=""
transform="rotate(90,-132.74809,193.6589)"
id="g24-7-9"
style="stroke:none;stroke-width:1.00013;stroke-dasharray:none;stroke-opacity:1">
<g
fill="#000000"
fill-opacity="1"
id="g2-1-8-4"
transform="matrix(0.352778,0,0,0.352778,-1.10547,0.448292)"
style="stroke:none;stroke-width:2.835;stroke-dasharray:none;stroke-opacity:1">
<g
id="use1-1-8-8"
transform="translate(1.993,9.573)"
style="stroke:none;stroke-width:2.835;stroke-dasharray:none;stroke-opacity:1">
<path
d="m 15,-6.75 c 0.859375,0.734375 1.921875,1.28125 2.59375,1.578125 -0.734375,0.34375 -1.75,0.875 -2.59375,1.59375 H 1.875 c -0.34375,0 -0.734375,0 -0.734375,0.421875 0,0.40625 0.375,0.40625 0.71875,0.40625 H 14.0625 C 13.078125,-1.796875 12,0.015625 12,0.296875 c 0,0.21875 0.265625,0.21875 0.390625,0.21875 0.171875,0 0.3125,0 0.390625,-0.171875 0.4375,-0.78125 1.015625,-1.875 2.359375,-3.078125 1.421875,-1.25 2.8125,-1.8125 3.890625,-2.125 0.34375,-0.125 0.359375,-0.140625 0.40625,-0.1875 0.04687,-0.015625 0.04687,-0.078125 0.04687,-0.125 0,-0.03125 0,-0.078125 -0.03125,-0.109375 l -0.0625,-0.046875 C 19.359375,-5.34375 19.328125,-5.375 18.9375,-5.5 c -2.78125,-0.828125 -4.84375,-2.703125 -6,-4.90625 -0.234375,-0.421875 -0.25,-0.4375 -0.546875,-0.4375 -0.125,0 -0.390625,0 -0.390625,0.21875 0,0.28125 1.0625,2.078125 2.0625,3.046875 H 1.859375 c -0.34375,0 -0.71875,0 -0.71875,0.40625 C 1.140625,-6.75 1.53125,-6.75 1.875,-6.75 Z m 0,0"
id="path2-1-2-8"
style="stroke:none;stroke-width:2.835;stroke-dasharray:none;stroke-opacity:1" />
</g>
</g>
</g>
</g>
<g
id="g26">
id="g26"
transform="translate(-87.931676,63.402272)">
<path
style="fill:none;stroke:#0000ff;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 145.48648,83.40865 31.32432,7.80112 -3.58316,31.04593"
@@ -1527,7 +1528,8 @@
</g>
</g>
<g
id="g25">
id="g25"
transform="translate(-87.30805,69.014933)">
<path
sodipodi:nodetypes="ccccc"
inkscape:connector-curvature="0"
@@ -2128,7 +2130,8 @@
y="0"
x="0" />
<g
id="g23">
id="g23"
transform="translate(10.809568,2.078763)">
<path
id="path5983"
d="m 25.324104,43.60594 a 8.5879527,13.208604 0 0 1 0.978868,3.63203"

Before

Width:  |  Height:  |  Size: 196 KiB

After

Width:  |  Height:  |  Size: 196 KiB

+16 -14
View File
@@ -2,9 +2,9 @@
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="800"
height="350"
viewBox="0 0 211.66666 92.604173"
width="400"
height="520"
viewBox="0 0 105.83333 137.58334"
version="1.1"
id="svg8"
inkscape:version="1.4 (86a8ad7, 2024-10-11)"
@@ -24,17 +24,17 @@
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.4778532"
inkscape:cx="390.4312"
inkscape:cy="79.168892"
inkscape:cx="359.6433"
inkscape:cy="321.7505"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="true"
units="px"
inkscape:snap-intersection-paths="true"
inkscape:window-width="2560"
inkscape:window-height="1476"
inkscape:window-x="-12"
inkscape:window-y="-12"
inkscape:window-height="1494"
inkscape:window-x="-11"
inkscape:window-y="-11"
inkscape:window-maximized="1"
inkscape:snap-midpoints="true"
inkscape:pagecheckerboard="0"
@@ -344,17 +344,17 @@
</rdf:RDF>
</metadata>
<g
transform="translate(0, -191.167)"
transform="translate(0,-191.167)"
id="layer1"
inkscape:groupmode="layer"
inkscape:label="Layer 1">
<g
inkscape:label=""
transform="translate(92.626275,235.43594)"
transform="rotate(90,-92.786122,150.90655)"
id="g24"
style="stroke:none;stroke-width:1.00013;stroke-dasharray:none;stroke-opacity:1"
inkscape:transform-center-x="2.6854835"
inkscape:transform-center-y="6.6241925">
inkscape:transform-center-x="6.6241936"
inkscape:transform-center-y="-2.6854843">
<g
fill="#000000"
fill-opacity="1"
@@ -373,7 +373,8 @@
</g>
</g>
<g
id="g6">
id="g6"
transform="translate(7.340321,-9.846772)">
<path
sodipodi:nodetypes="ccccc"
inkscape:connector-curvature="0"
@@ -778,7 +779,8 @@
</g>
</g>
<g
id="g14">
id="g14"
transform="translate(-99.183849,51.203215)">
<path
style="fill:none;stroke:#0000ff;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 155.48005,203.41996 31.32432,7.80112 -3.58316,31.04593"

Before

Width:  |  Height:  |  Size: 90 KiB

After

Width:  |  Height:  |  Size: 90 KiB

+8 -6
View File
@@ -58,9 +58,11 @@ $$
#### 3.2.1 **结果**
围绕$x,y,z$轴旋转$\theta$的旋转矩阵
$$
\boldsymbol{R_x}=\begin{bmatrix}1&0&0\\0&\cos(\theta)&-\sin(\theta)\\0&\sin(\theta)&\cos(\theta)\end{bmatrix}
\boldsymbol{R_y}=\begin{bmatrix}\cos(\theta)&0&\sin(\theta)\\ 0&1&0\\ -\sin(\theta)&0&\cos(\theta)\end{bmatrix}
\boldsymbol{R_z}=\begin{bmatrix}\cos(\theta)&-\sin(\theta)&0 \\ \sin(\theta)&\cos(\theta)&0\\ 0&0&1\end{bmatrix}
\begin{aligned}
\boldsymbol{R_x}&=\begin{bmatrix}1&0&0\\0&\cos(\theta)&-\sin(\theta)\\0&\sin(\theta)&\cos(\theta)\end{bmatrix}\\
\boldsymbol{R_y}&=\begin{bmatrix}\cos(\theta)&0&\sin(\theta)\\ 0&1&0\\ -\sin(\theta)&0&\cos(\theta)\end{bmatrix}\\
\boldsymbol{R_z}&=\begin{bmatrix}\cos(\theta)&-\sin(\theta)&0 \\ \sin(\theta)&\cos(\theta)&0\\ 0&0&1\end{bmatrix}
\end{aligned}
$$
#### 3.2.2 **求解过程**
以$R_z$为例
@@ -134,7 +136,7 @@ R_n(\vec{v})&=\vec{v}-\vec{v}+\vec{v}\cos(\theta)+(1-\cos(\theta))(\vec{v}\cdot\
&=\vec{v}+(1-\cos(\theta))[(\vec{v}\cdot\vec{n})\vec{n}-\vec{v}]+(\vec{n}\times\vec{v})\sin(\theta)\\
&=\vec{v}+(1-\cos(\theta))[(\vec{v}\cdot\vec{n})\vec{n}-(\vec{n}\cdot\vec{n})\vec{v}]+(\vec{n}\times\vec{v})\sin(\theta)
\end{split}$$
根据矢量[三重积公式](/graphics/math/math_01.html#_2-7-%E4%B8%89%E9%87%8D%E7%A7%AF),可以得到
根据矢量[三重积公式](/note/graphics/math/math_01.html#_2-7-%E4%B8%89%E9%87%8D%E7%A7%AF),可以得到
$$
(\vec{v}\cdot\vec{n})\vec{n}-(\vec{n}\cdot\vec{n})\vec{v}=\vec{n}\times(\vec{n}\times\vec{v})
$$
@@ -142,7 +144,7 @@ $$
$$
R_n(\vec{v})=\vec{v}+(1-\cos(\theta))[\vec{n}\times(\vec{n}\times\vec{v})]+(\vec{n}\times\vec{v})\sin(\theta)
$$
使用向量$\vec{n}$的[叉乘矩阵](./graphics/math/math_01.html#_2-5-4-%E5%8F%89%E7%A7%AF%E7%9A%84%E7%9F%A9%E9%98%B5%E5%BD%A2%E5%BC%8F)$[\boldsymbol{n}]_{\times}$来代替叉乘,这里记矩阵$\boldsymbol{M_n}$为向量$\vec{n}$的叉积矩阵
使用向量$\vec{n}$的[叉乘矩阵](/note/graphics/math/math_01.html#_2-5-4-%E5%8F%89%E7%A7%AF%E7%9A%84%E7%9F%A9%E9%98%B5%E5%BD%A2%E5%BC%8F)$[\boldsymbol{n}]_{\times}$来代替叉乘,这里记矩阵$\boldsymbol{M_n}$为向量$\vec{n}$的叉积矩阵
$$
\boldsymbol{M_n}=\begin{bmatrix}
0&-n_z&n_y\\
@@ -168,7 +170,7 @@ R_n(\vec{\boldsymbol{i}})&=c\vec{i}+(1-c)(\vec{i}\cdot\vec{n})\vec{n}
R_n(\vec{\boldsymbol{j}})&=[(1-c)xy-sz,c+(1-c)y^2,(1-c)yz+sx]^T\\
R_n(\vec{\boldsymbol{k}})&=[(1-c)xz+sy,(1-c)yz-sx,c+(1-c)z^2]^T
\end{split}$$
代入公式[1.3.1](/graphics/math/transform_01.html#_1-3-使用矩阵表示)得到
代入公式[1.3.1](/note/graphics/math/transform_01.html#_1-3-使用矩阵表示)得到
$$
\boldsymbol{R_n}=\begin{bmatrix}
c+(1-c)x^2& (1-c)xy-sz&(1-c)xz+sy\\
+12 -2
View File
@@ -22,7 +22,14 @@ $$
0&0&1
\end{bmatrix}\begin{bmatrix}x\\y\\0\end{bmatrix}=\begin{bmatrix}x\\y\\0\end{bmatrix}
$$
两个矢量的和或者差$\vec{\boldsymbol{u}}\pm\vec{\boldsymbol{v}}=[u_x,u_y,u_z,0]\pm[v_x,v_y,v_z,0]=[u_x\pm v_x,u_y\pm v_y,u_z\pm v_z,0]$仍然是一个矢量,而两个点的差也是矢量,点和矢量的和或者差也是矢量
两个矢量的和或者差
$$
\begin{aligned}
\vec{\boldsymbol{u}}\pm\vec{\boldsymbol{v}}&=[u_x,u_y,u_z,0]\pm[v_x,v_y,v_z,0]\\
&=[u_x\pm v_x,u_y\pm v_y,u_z\pm v_z,0]
\end{aligned}
$$
仍然是一个矢量,而两个点的差也是矢量,点和矢量的和或者差也是矢量
$$\begin{split}
{vector}+{vector}&={vector} \\
{point}-{point}&={vector} \\
@@ -31,7 +38,10 @@ $$\begin{split}
\end{split}$$
其次坐标表示的两个点的和也是有意义的,表示两个点的中点
$$
[x_1,y_1,1]+[x_2,y_2,1]=[x_1+x_2,y_1+y_2,2]=[\frac{x_1+x_2}{2}, \frac{y_1+y_2}{2}, 1]
\begin{aligned}
[x_1,y_1,1]+[x_2,y_2,1]&=[x_1+x_2,y_1+y_2,2]\\
&=[\frac{x_1+x_2}{2}, \frac{y_1+y_2}{2}, 1]
\end{aligned}
$$
### 4.2 齐次矩阵表达
+1 -1
View File
@@ -11,7 +11,7 @@
### 7.2 法线变换矩阵
以上图为例,设$\vec{\boldsymbol{u}}=\vec{ab}$,那么$\vec{\boldsymbol{u}}\cdot\vec{\boldsymbol{n}}=0$,用矩阵的方式表达,$\mathrm{u}=[u_x, u_y, u_z]$, $\mathrm{n}=[n_x, n_y, n_z]$,就是$\mathrm{u}\mathrm{n}^T=0$
设从$\vec{ab}$到$\vec{a'b'}$的变换矩阵为$A$,根据转置矩阵的[基本运算规则](/graphics/math/math_02.html#_3-5-基本运算规则) ,可以得到
设从$\vec{ab}$到$\vec{a'b'}$的变换矩阵为$A$,根据转置矩阵的[基本运算规则](/note/graphics/math/math_02.html#_3-5-基本运算规则) ,可以得到
$$\begin{split}
0&=\mathrm{u}\mathrm{n}^T\\
&=\mathrm{u}(\mathrm{AA^{-1}})\mathrm{n}^T \\
+5 -2
View File
@@ -26,7 +26,7 @@ $$\begin{split}
\end{split}$$
### 9.2 计算
根据[坐标系变换公式](/graphics/math/transform_02.html#_6-2-3-%E7%BB%84%E5%90%88%E5%90%8E%E7%9A%84%E5%9D%90%E6%A0%87%E8%BD%AC%E6%8D%A2%E7%9F%A9%E9%98%B5),设摄像机在世界坐标系中的位置为$e$,摄像机的三个轴的单位轴向量为$\vec{\boldsymbol{i}'}, \vec{\boldsymbol{j}'}, \vec{\boldsymbol{k}'}$视图变换矩阵为
根据[坐标系变换公式](/note/graphics/math/transform_02.html#_6-2-3-%E7%BB%84%E5%90%88%E5%90%8E%E7%9A%84%E5%9D%90%E6%A0%87%E8%BD%AC%E6%8D%A2%E7%9F%A9%E9%98%B5),设摄像机在世界坐标系中的位置为$e$,摄像机的三个轴的单位轴向量为$\vec{\boldsymbol{i}'}, \vec{\boldsymbol{j}'}, \vec{\boldsymbol{k}'}$视图变换矩阵为
$$
M_{view}=\begin{bmatrix}
i_x'&i_y'&i_z'&-\vec{\boldsymbol{e}}\cdot\vec{\boldsymbol{i}}' \\
@@ -161,12 +161,15 @@ $$\begin{split}
#### 10.2.3 合并后的矩阵
最终得到合并后的投影矩阵为
$$
\boldsymbol{M}_{\text{persp}\rightarrow\text{ccv}}=\boldsymbol{M}_{\text{ortho}\rightarrow\text{ccv}}\boldsymbol{M}_{\text{persp}\rightarrow\text{ortho}}=\begin{bmatrix}
\begin{aligned}
\boldsymbol{M}_{\text{persp}\rightarrow\text{ccv}}&=\boldsymbol{M}_{\text{ortho}\rightarrow\text{ccv}}\boldsymbol{M}_{\text{persp}\rightarrow\text{ortho}}\\
&=\begin{bmatrix}
\frac{2n}{w}&0&0&0\\
0&\frac{2n}{h}&0&0\\
0&0&-\frac{n+f}{n-f}&\frac{2nf}{n-f}\\
0&0&1&0
\end{bmatrix}
\end{aligned}
$$
在大部分工程项目中,摄像机的输入参数一般是如下几个
* 宽高比 $aspect=w/h$