二维几何变换
- 齐次坐标就是用n+1维矢量表示n维矢量,(p(x,y))的齐次坐标表示为((wx,wy,w)=(X,Y,w))。
- 二维规范化齐次坐标:(w=1)时,(p(x,y,1))
- 类似三维规范化齐次坐标为((x,y,z,1))
- 齐次坐标的 目的:避免了平移变换使用矩阵加法运算,是为了规范化编程。
[ \left [\begin{matrix} x^\\ y^
\ 1 \end{matrix}\right ]= \left [\begin{matrix} x+T_x \ y+T_y \ 1 \end{matrix}\right ]= \left [\begin{matrix} 1 & 0 & T_x \ 0 & 1 & T_y \ 0 & 0 &1 \end{matrix}\right ] \left [\begin{matrix} x \ y \ 1 \end{matrix}\right ] ]
[ \left [\begin{matrix} x^\\ y^
\ 1 \end{matrix}\right ]= \left [\begin{matrix} xS_x \ yS_y \ 1 \end{matrix}\right ]= \left [\begin{matrix} S_x & 0 & 0 \ 0 & S_y & 0 \ 0 & 0 & 1 \end{matrix}\right ] \left [\begin{matrix} x \ y \ 1 \end{matrix}\right ] ]
[ \left [\begin{matrix} x^\\ y^
\ 1 \end{matrix}\right ]= \left [\begin{matrix} xcos\beta-ysin\beta \ xsin\beta+ycos\beta \ 1 \end{matrix}\right ]= \left [\begin{matrix} cos\beta & -sin\beta &0 \ sin\beta & cos\beta & 0 \ 0 & 0 & 1 \end{matrix}\right ] \left [\begin{matrix} x \ y \ 1 \end{matrix}\right ] ]
三维变换
[ T= \left [ \begin{matrix} a & b & c & l \ d & e & f & m \ g & h & i & n \ p & q & r & s \end{matrix} \right] ]
其中:
- 比例、旋转、反射、错切变换:
[ T_1= \left[\begin{matrix} a & b & c \ d & e & f \ g & h & i \end{matrix}\right] ]
- 比例变换
[ T= \left [ \begin{matrix} S_x & 0 & 0 & 0 \ 0 & S_y & 0 & 0 \ 0 & 0 & S_z & 0 \ 0 & 0 & 0 & 1 \end{matrix} \right] ]
- 旋转变换
[R_{xyz}(\beta ,\alpha ,\gamma)=R_x(\beta )R_y(\alpha )R_z(\gamma) ]
绕x轴旋转变换
[ T= \left [ \begin{matrix} 1 & 0 & 0 & 0 \ 0 & cos\beta & -sin\beta & 0 \ 0 & sin\beta & cos\beta & 0 \ 0 & 0 & 0 & 1 \end{matrix} \right] ]
绕y轴旋转变换
[ T= \left [ \begin{matrix} cos\alpha & 0 & sin\alpha & 0 \ 0 & 1 & 0 & 0 \ -sin\alpha & 0 & cos\alpha & 0 \ 0 & 0 & 0 & 1 \end{matrix} \right] ]
绕z轴旋转变换
[ T= \left [ \begin{matrix} cos\gamma & -sin\gamma & 0 & 0 \ sin\gamma & cos\gamma & 0 & 0 \ 0 & 0 & 1 & 0 \ 0 & 0 & 0 & 1 \end{matrix} \right] ]
- 旋转变换的性质:(1)旋转变换矩阵是 正交矩阵(R^T_\theta =R^{-1}\theta);(2)(R{- \theta}=R^{-1}_\theta)
- 反射变换
[]
关于x轴的反射
[ T= \left [ \begin{matrix} 1 & 0 & 0 & 0 \ 0 & -1 & 0 & 0 \ 0 & 0 & -1 & 0 \ 0 & 0 & 0 & 1 \end{matrix} \right] ]
关于y轴的反射
[ T= \left [ \begin{matrix} -1 & 0 & 0 & 0 \ 0 & 1 & 0 & 0 \ 0 & 0 & -1 & 0 \ 0 & 0 & 0 & 1 \end{matrix} \right] ]
关于z轴的反射
[ T= \left [ \begin{matrix} -1 & 0 & 0 & 0 \ 0 & -1 & 0 & 0 \ 0 & 0 & 1 & 0 \ 0 & 0 & 0 & 1 \end{matrix} \right] ]
- 错切变换
[]
沿x方向错切
[ T= \left [ \begin{matrix} 1 & b & c & 0 \ 0 & 1 & 0 & 0 \ 0 & 0 & 1 & 0 \ 0 & 0 & 0 & 1 \end{matrix} \right] ]
沿y方向错切
[ T= \left [ \begin{matrix} 1 & 0 & 0 & 0 \ d & 1 & f & 0 \ 0 & 0 & 1 & 0 \ 0 & 0 & 0 & 1 \end{matrix} \right] ]
沿z方向错切
[ T= \left [ \begin{matrix} 1 & 0 & 0 & 0 \ 0 & 1 & 0 & 0 \ g & h & 1 & 0 \ 0 & 0 & 0 & 1 \end{matrix} \right] ]
- 平移变换:
[ T_2= \left[\begin{matrix} l \ m \ n \end{matrix}\right] ]
[ T= \left [ \begin{matrix} 1 & 0 & 0 & T_x\ 0 & 1 & 0 & T_y \ 0 & 0 & 1 & T_z \ 0 & 0 & 0 & 1 \end{matrix} \right] ]
- 投影变换:
[ T_3= \left[\begin{matrix} p & q & r \end{matrix}\right] ]
- 复杂的变换可以由简单变换组合得到
- 变换的顺序很重要,因为矩阵乘法不支持交换律,比如先旋转再平移与先平移再旋转的结果往往是不同的 (变换顺序,从右向左看)。
[先旋转R,再平移T ]
[\left[\begin{matrix} x^, \ y^, \ z^, \ 1 \end{matrix}\right] =TR \left[\begin{matrix} x \ y \ z \ 1 \end{matrix}\right] ]
[先平移T,再旋转R ]
[\left[\begin{matrix} x^, \ y^, \ z^, \ 1 \end{matrix}\right] =RT \left[\begin{matrix} x \ y \ z \ 1 \end{matrix}\right] ]
- 对于如下变换,是 *先做线性变换,再平移
[T=\left[\begin{matrix} a & b & c & t_x \ d & e & f & t_y \ g & h & i & t_z \ 0 & 0 & 0 & 1 \end{matrix}\right] ]
- 相对特定点(C)的旋转:先整体平移到坐标原点,再旋转变换,最后再整体移动到原坐标点
[T(C)R(\alpha )T(-C) ]
Original: https://www.cnblogs.com/brilliantM/p/14782171.html
Author: 帅气无敌朋子
Title: 二维与三维坐标变换
原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/685397/
转载文章受原作者版权保护。转载请注明原作者出处!