注意,以下都是矩阵左乘向量!
我们均假设点的坐标为 (x,y),Transform 后的点为 (x′,y′)
-
Rotation
假设旋转角度为 θ,则
[x′y′]=R(θ)[xy]
-
Translation
可以表示为向量加法:
[x′y′]=[x′y′]+[txty]
-
Scaling
假设关于某个点放大,即 (x′−cx)←s(x−cx),(我们这里先忽略 cx)有
[x′y′]=[sx00sy][xy]
-
Reflection
即关于 x,y-axis 进行反转
[x′y′]=B(1,0,−1)[xy]
-
Shear
transformed shape appears as if the object were composed of internal layers that had been caused to slide over each other
[x′y′]=[10a1][xy][x′y′]=[1b01][xy]
Homogeneous Coordinates
把二维的点 (x,y) 拓展到三维 (xh,yh,h) 使得 xh=xh,yh=yh. 则称 (xh,yh,h) 是 (x,y) 的 Homogeneous Coordinates.
故在三维空间里,二维点 (x,y) 对应的是三维空间里的 z=1 平面. 所有和 (x,y) 等价的 Homogeneous Coordinates 构成经过 (0,0,0),(x,y,1) 的直线.
把二维点的坐标表示为三维有另一个好处:我们可以把 translation 也表示成 Matrix Multiplication 的形式了.
不管有多少矩阵,我们发现其都可以写成如下形式:
x′y′1=ad0be0cf1xy1