1. 平移(translation)
点 (x,y)平移到 (x',y'),经过的距离为 (tx, ty). 则
x' = x + tx
y' = y + ty
或者
P' = P + T
其中,
2. 旋转(以坐标原点为中心喜转动角度 , 逆时针 大于0,顺时针 小于0
假设点(x,y)绕原点逆时针转动 到(x',y'). 那么
三角函数展开,最后可以得出:
3. 绕任一点()旋转:
3.1 平移点()到原点 T()
3.2 旋转R()
3.3 平移该点到原来位置 T()
P' = T() * R() * T()
4.缩放(scaling)
通过缩放参数()改变对象的大小
一个副作用是目标的位置也变了
5.以任一点P(,)为中心缩放
5.1 平移对象到点P额原点重合T()
5.2 缩放对象S()
5.3把对象移动到原来的位置 T()
6.仿射变换(Affine Transformation)
上面提到的平移,旋转,缩放还有错切(shearing) 都是仿射变换。
仿射变换后的点是原来的点的线性组合
任意一个2维仿射变换都可以分解成旋转,缩放,错切(shearing)和平移这几个有序步骤。
Affine matrix = translation x shearing x scaling x rotation
如果对点P应用变换矩阵 M1, 然后 应用M2, 然后M3,
一般变换矩阵不不符合交换律 (AxB != BxA)
参考:
https://web.cse.ohio-state.edu/~shen.94/681/Site/Slides_files/transformation_review.pdf