Linear transformation TL is a mapping between vector spaces. Linear combination is invariant under TL.
TL(i=0∑Ncivi)=c0TL(v0)+⋯+cNTL(vN)
In 3D space, TL can be represented by a 3x3 matrix A.
TL(v)=A3×3v3×1
Examples of linear transformation
2D rotation [cosθsinθ−sinθcosθ]
2D scaling [sx00sy]
2D shear
along x-axis [10s1]
along y-axis [1s01]
2D reflection
along x-axis [100−1]
along y-axis [−1001]
3D rotation
along x-axis (pitch) 1000cosθsinθ0−sinθcosθ
along y-axis (yaw) cosψ0−sinψ010sinψ0cosψ
along z-axis (roll) cosϕsinϕ0−sinϕcosϕ0001
Any linear transformation between 3D spaces can be represented as a combination of rotation, shear, and scaling. In fact, rotation can be represented as a combination of scaling and two-axes shear, or as a combination of two one-axis shear transformation! This can be efficient than computing cosine and sine values.
Linear transformation as a change of basis
Array is usually written as column-major Representation.
Av=[a1a2a3]xyz
In fact, each column is a linear tranform of basis.
a1=A100,a2=A010,a3=A001
Instead of viewing linear transformation as transforming vector, we can view as changing basis.
Affine transformation TA is a mapping between affine spaces. TA maps vectors to vectors, and points to points. TA is a linear transformation on vectors. Affine combination is invariant under TA.
TA(i=0∑Ncipi)=c0TA(p0)+⋯+cNTA(pN)
In 3D space, TA can be represented by a 3x3 matrix A with a 3x1 translation vector.
TA(p)=A3×3p3×1+t3×1
Homogeneous Coordinates
With homogeneous coordinates, any affine transformation between 3D spaces can also be represented by a 4x4 matrix.
Rigid transformation TR is a special case of affine transformation that consists of rotation and translation.
TR preserves distances between all points. (Therefore preserves angles as well - SSS Congruence)
TR preserves cross product for all vectors. (i.e. TR is not reflection)
In 3D space, TR can be represented by a 3x3 rotation matrixR with a 3x1 translation vector.
TR(p)=R3×3p3×1+t3×1
Rotation matrix
Rotation matrix rotates basis, so column vectors should be normalized and orthogonal. Therefore RTR=I, i.e. R−1=RT.
Also, we only choose matrices with a determinant of 1. Determinant of -1 means reflection! In mathematics, rotation matrices in 3D space are called SO(3) (Special orthogonal group).
Euler angles
Any rotation matrix can be decomposed as a product of three elemental rotation matrices!
R=Rx(θ)Ry(ψ)Rz(ϕ)
c.f. In 2D sapce, degree of rotation is 1. In 4D space, degree of rotation is 6???
Actually, 12 different combinations exists. Just don't rotate along same axis twice! XYZ, XYX, XZY, XZX, YZX, YZY, YXZ, YXY, ZXY, ZXZ, ZYX, ZYZ
Problems of Euler angles
Gimbal Lock: In certain alignments of the axes, we lose degree of freedom. Not unique: Two different euler angles can represent the same rotation.