Beruflich Dokumente
Kultur Dokumente
homogeneous coordinates
Dr Nicolas Holzschuch
University of Cape Town
e-mail: holzschu@cs.uct.ac.za
Modified by Longin Jan Latecki
latecki@temple.edu
Homogeneous coordinates:
consistent notation
several other good points (later)
Composition of transformations
Transformations for the window system
Transformations in 2D
In the application model:
a 2D description of an object (vertices)
a transformation to apply
Translations
Each vertex is modified:
x = x+tx
y = y+ty
Before
After
A point is a vector:
y
Scaling in 2D
Coordinates multiplied by the
scaling factor:
x = sx x
y = sy y
Before
After
P = SP
x s x
y 0
0 x
sy y
Rotating in 2D
New coordinates depend on both x
and y
x = cosx - sin y
y = sinx + cos y
Before
After
P=RP
x cos
y sin
sin x
cos y
2D transformations,
summary
Vector-matrix notation simplifies writing:
translation is a vector sum
rotation and scaling are matrix-vector
multiplication
How to do this?
Homogeneous coordinates
Introduced in mathematics:
for projections and drawings
used in artillery, architecture
used to be classified material (in the
1850s)
x
Add a third coordinate, w
y
A 2D point is a 3 coordinates vector:
w
Homogeneous coordinates
(2)
Two points are equal if and only if:
x/w = x/w and y/w= y/w
w=0: points at infinity
useful for projections and curve
drawing
Homogenize = divide by
x w.
Homogenized points: y
1
Translations with
homogeneous
x 1
y 0
w 0
0 t x x
1 ty y
0 1 w
x x wt x
y y wt y
w w
x
w
y
w
tx
x
w
y
w
ty
0
sy
0
0 x
0 y
1 w
x sx x
y sy y
w w
x
w
y
w
s
s
x
x w
y
y w
sin
cos
0
0 x
0 y
1 w
x
w
y
w
x cos x sin y
y sin x cos y
w
w
cos wx sin
sin wx cos
y
w
y
w
Composition of
transformations
To compose transformations, multiply
the matrices:
composition of a rotation and a
translation:
M = RT
P=(-TQ)RTQ P
Beware!
Matrix multiplication is not commutative
The order of the transformations is vital
Rotation followed by translation is very
different from translation followed by rotation
careful with the order of the matrices!
Small commutativity:
rotation commute with rotation, translation
with translation
On the screen:
pixel coordinates
integer
restricted viewport: umin/umax, vmin/vmax
ymin
xmin
xmax
M = TST
u
x
v M y
w
w
Model Coordinates
M
Model Coordinates
(T ST )
x
u
y M 1 v
w
w
Pixels coordinates
2D transformations:
conclusion
Simple, consistent matrix notation
using homogeneous coordinates
all transformations expressed as
matrices