Affine planar transformation matrix

Description

(3 \times 3) affine planar transformation matrix corresponding to reflection, rotation, scaling and translation in projective geometry. To transform a point p multiply the transformation matrix A with the homogeneous coordinates (x,y,z) of p (e.g. p_{transformed} = Ap).

Usage

1
2
3
4

Arguments

alpha

the angle made by the line of reflection (in radian).

theta

the angle of the rotation (in radian).

pt

the homogeneous coordinates of the rotation center (optional).

s

the (2 \times 1) scaling vector in direction x and y.

v

the (2 \times 1) translation vector in direction x and y.

Value

A (3 \times 3) affine transformation matrix.

References

Richter-Gebert, J├╝rgen (2011). Perspectives on Projective Geometry - A Guided Tour Through Real and Complex Geometry, Springer, Berlin, ISBN: 978-3-642-17285-4

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
p1 <- c(2,5,1)  # homogeneous coordinate

# rotation
r_p1 <- rotation(4.5) %*% p1

# rotation centered in (3,1)
rt_p1 <- rotation(4.5, pt=c(3,1,1)) %*% p1

# translation
t_p1 <- translation(c(2,-4)) %*% p1

# scaling
s_p1 <- scaling(c(-3,1)) %*% p1

# plot
plot(t(p1),xlab="x",ylab="y", xlim=c(-5,5),ylim=c(-5,5),asp=1)
abline(v=0,h=0, col="grey",lty=1)
abline(v=3,h=1, col="grey",lty=3)
points(3,1,pch=4)
points(t(r_p1),col="red",pch=20)
points(t(rt_p1),col="blue",pch=20)
points(t(t_p1),col="green",pch=20)
points(t(s_p1),col="black",pch=20)