GAMES101-现代计算机图形学入门 Lecture03 Transformation 笔记
点和向量的齐次坐标表示
-
2D 点 = \((x,y,0)^T\)
-
2D 向量 = \((x,y,1)^T\)
该表达形式可简便的表示点和点,向量和向量,点和向量的运算:
- 点 \(-\) 点 \(=\) 向量
- 向量 \(\pm\) 向量 \(=\) 向量
- 点 \(\pm\) 向量 \(=\) 点
- 点 \(+\) 点 \(=\) 两点连线的中点
2D 模型变换(齐次坐标)
Scale
\[\begin{pmatrix}
x^{'} \\
y^{'} \\
1
\end{pmatrix}
=
\begin{pmatrix}
a & 0 & 0 \\
0 & b & 0 \\
0 & 0 & 1
\end{pmatrix}
\begin{pmatrix}
x \\
y \\
1
\end{pmatrix}
\]
Reflection
\[\begin{pmatrix}
x^{'} \\
y^{'} \\
1
\end{pmatrix}
=
\begin{pmatrix}
-1 & 0 & 0 \\
0 & 1 & 0 \\
0 & 0 & 1
\end{pmatrix}
\begin{pmatrix}
x \\
y \\
1
\end{pmatrix}
\]
Shear
\[\begin{pmatrix}
x^{'} \\
y^{'} \\
1
\end{pmatrix}
=
\begin{pmatrix}
1 & a & 0 \\
0 & 1 & 0 \\
0 & 0 & 1
\end{pmatrix}
\begin{pmatrix}
x \\
y \\
1
\end{pmatrix}
\]
Rotate
\[\begin{pmatrix}
x^{'} \\
y^{'} \\
1
\end{pmatrix}
=
\begin{pmatrix}
cos \ \theta & -sin \ \theta & 0 \\
sin \ \theta & cos \ \theta & 0 \\
0 & 0 & 1
\end{pmatrix}
\begin{pmatrix}
x \\
y \\
1
\end{pmatrix}
\]
Translation
\[\begin{pmatrix}
x^{'} \\
y^{'} \\
1
\end{pmatrix}
=
\begin{pmatrix}
1 & 0 & t_x \\
0 & 1 & t_y \\
0 & 0 & 1
\end{pmatrix}
\begin{pmatrix}
x \\
y \\
1
\end{pmatrix}
\]

浙公网安备 33010602011771号