1. Affine Transformations – Definition
Definition:
An affine transformation is a geometric transformation that preserves:
- Points, straight lines, and planes
- Parallelism of lines (parallel lines remain parallel)
Affine transformations are widely used in 2D and 3D computer graphics for moving, rotating, resizing, or skewing objects.
Mathematically, in 2D, an affine transformation can be represented as:
[x′ y′]=[ab cd][x y]+[tx ty]
Or in homogeneous coordinates (common in graphics):
[x′ y′ 1]=[abtx cdty 001][x y 1]
Where (tx,ty) are translation components, and the 2×2 matrix defines rotation, scaling, or shear.
2. Types of Affine Transformations
A. Translation
Definition:
- Moving an object from one position to another without changing its shape, size, or orientation.
Formula in 2D:
x′=x+tx,y′=y+ty
Matrix Form (homogeneous coordinates):
T=[10tx 01ty 001]
Example:
- Moving a triangle 5 units right and 3 units up.
B. Rotation
Definition:
- Rotating an object around the origin or a pivot point by an angle θ.
Formula in 2D (around origin):
x′=xcosθ−ysinθ,y′=xsinθ+ycosθ
Matrix Form:
R=[cosθ−sinθ0 sinθcosθ0 001]
Note: To rotate around a point (px,py), first translate to origin, rotate, then translate back.
C. Scaling
Definition:
- Changing the size of an object in the x and/or y direction.
Formula in 2D:
x′=sx⋅x,y′=sy⋅y
Matrix Form:
S=[sx00 0sy0 001]
Notes:
- Uniform scaling: sx=sy → preserves shape
- Non-uniform scaling: sx=sy → may stretch/compress
D. Shear
Definition:
- Shifting one coordinate proportionally to another, effectively slanting the shape.
Formulas in 2D:
- X-shear: x′=x+shx⋅y,y′=y
- Y-shear: x′=x,y′=y+shy⋅x
Matrix Forms:
X-shear: Hx=[1shx0 010 001],Y-shear: Hy=[100 shy10 001]
Example:
- Slanting a rectangle so that its top edge moves more than the bottom edge.
3. Key Properties of Affine Transformations
- Straight lines remain straight
- Parallel lines remain parallel
- Ratios of distances along a line are preserved
- Shapes may change size or orientation but basic collinearity is preserved
4. Summary Table
| Transformation |
Effect |
Matrix Form (2D Homogeneous) |
| Translation |
Move object |
[10tx 01ty 001] |
| Rotation |
Rotate object |
[cosθ−sinθ0 sinθcosθ0 001] |
| Scaling |
Resize object |
[sx00 0sy0 001] |
| Shear |
Slant object |
X-shear: [1shx0 010 001]Y-shear: [100 shy10 001] |