Homogeneous Coordinates(齐次坐标)
在一个二维的空间中,对点做位移操作无法通过二维矩阵作用完成。因此用齐次坐标来完成对所有操作的表示。
齐次坐标中:
2D Point=(x,y,1)T(x, y,\textcolor{orange}1)^T(x,y,1)T 2D Vector=(x,y,0)T(x, y,\textcolor{orange}0)^T(x,y,0)T
对点进行位移操作:
(x′y′w′)=(10tx01ty001).(xy1)=(x+txy+ty1)\begin{pmatrix}x^{'}\\y^{'}\\w^{'}\end{pmatrix}=\begin{pmatrix}1&0&t_x\\0&1&t_y\\0&0&1\end{pmatrix}.\begin{pmatrix}x\\y\\1\end{pmatrix}=\begin{pmatrix}x+t_x\\y+t_y\\1\end{pmatrix}⎝⎛x′y′w′⎠⎞=⎝⎛100010txty1⎠⎞.⎝⎛xy1⎠⎞=⎝⎛x+txy+ty1⎠⎞
www坐标为0或1的有效操作:
vector+vector = vector
vector+point = point
point - point = vector
point + point比较特殊,(xyw)\begin{pmatrix}x\\y\\w\end{pmatrix}⎝⎛xyw⎠⎞表示为一个2D Point(x/wy/w1)\begin{pmatrix}x/w\\y/w\\1\end{pmatrix}⎝⎛x/wy/w1⎠⎞,其中www不为0
因此point + point = point(两点的中点)
Affin Transformation仿射变换
(x′y′1)=(abtxcdty001).(xy1)\begin{pmatrix}x^{'}\\y^{'}\\1\end{pmatrix}=\begin{pmatrix}a&b&t_x\\c&d&t_y\\0&0&1\end{pmatrix}.\begin{pmatrix}x\\y\\1\end{pmatrix}⎝⎛x′y′1⎠⎞=⎝⎛ac0bd0txty1⎠⎞.⎝⎛xy1⎠⎞
Scale 放缩
S(sx,sy)=(sx000sy0001)\bold{S}(s_x, s_y)=\begin{pmatrix}s_x&0&0\\0&s_y&0\\0&0&1\end{pmatrix}S(sx,sy)=⎝⎛sx000sy0001⎠⎞
Rotation 旋转
R(α)=(cosα−sinα0sinαcosα0001)\bold{R}(\alpha)=\begin{pmatrix}\cos{\alpha}&-\sin{\alpha}&0\\\sin{\alpha}&\cos{\alpha}&0\\0&0&1\end{pmatrix}R(α)=⎝⎛cosαsinα0−sinαcosα0001⎠⎞
Translation 位移
T(tx,ty)=(10tx01ty001)\bold{T}(t_x, t_y)=\begin{pmatrix}1&0&t_x\\0&1&t_y\\0&0&1\end{pmatrix}T(tx,ty)=⎝⎛100010txty1⎠⎞
一个矩阵的逆矩阵意味着进行逆操作,如顺时针旋转α\alphaα为R(α)\bold{R}(\alpha)R(α),则R−1(α)\bold{R}^{-1}(\alpha)R−1(α)为逆时针旋转α\alphaα
Composing Transforms复合变换
变换是有顺序的,即矩阵的作用顺序不能随意改变。复杂的变换可以拆分成几个基础的变换矩阵的乘积。
如何表示绕某个点c旋转?
可以先将点c移动到原点,进行旋转,再移动回c。
T(c)⋅R(α)⋅T(−c)\bold{T}(c)\cdot\bold{R}(\alpha)\cdot\bold{T}(-c)T(c)⋅R(α)⋅T(−c)
3维空间中雷同
本文详细介绍了齐次坐标在二维空间中的应用,如何通过齐次坐标实现点的位移操作,并探讨了向量与点的加法运算。此外,还讲解了仿射变换、放缩、旋转和位移等基本操作的矩阵表示,以及矩阵逆操作的意义。最后,提到了如何组合变换矩阵来实现复杂的几何变换,如绕某点旋转。
366

被折叠的 条评论
为什么被折叠?



