Académique Documents
Professionnel Documents
Culture Documents
Class -11
Basic transformations - translation, scaling,
rotation and reflection
CO-ORDINATE SYSTEM
Three types of coordinate systems are needed in order to input, store, and
display model geometry and graphics. These are the model coordinate system
(MCS), the working coordinate system (WCS), and the screen coordinate
system (SCS).
Y W2
B
E3
X W2
E2
Z
A
Y W1
E1
Y
X W1
Z W1
x max , y max
Ys
Xs
0, 0
Transformations
changing
rules
geometric: translate, rotate, scaling, mirroring
and shearing objects on screen / in space
mapping from model space to screen space
11/17/16
Homogeneous Coordinates
Composite Transformation (or ) Concatenated
Transformation
Inverse transformation
2D Transforms Translation
x' x t x , y ' y t y
x'
P' , P
y '
P' P T
tx
,T
y
ty
Rotation 1
(x,y)
r
(x,y)
y = r sin ()
Rotation 2
x = x cos y sin
Y = x sin + y cos
P = R.P
R = cos
sin
- sin
cos
Scaling 1
X = x. sx y = y.sy
x
sx 0
x
y
0 sy
y
P = S . P
Homogeneous Coordinates
As translations do not have a 2 x 2 matrix representation,
we introduce homogeneous coordinates to allow a 3 x 3 matrix
representation. A point (x, y) can be re-written in homogeneous coordinates as
(xh, yh, h)
xh
x
h
yh
y
h
We
We
X
Y
1
1 0 tx
1 ty
0 1
P = T ( tx , ty ) . P
Cos -Sin 0
Sin
Cos 0
P= R() .P
2D Scaling in HC
X
Y
1
Sx
Sy
P= S(sx, sy) .P
(a)
(b)
(c)
(d)
Original Position
of Object and
pivot point
Translation of
object so that
pivot point
(xr,yr)is at origin
Rotation was
about origin
xr
cos
-sin 0
-xr
yr
sin
cos 0
-yr
cos
sin
(a)
(b)
(c)
scaling was
about origin
(d)
Translation of the object
so that the Fixed point
is returned to position
(xf,yf)
xf
sx
-xf
yf
sy
-yf
sx
xf(1- sx)
sy
yf(1- sy)
0 -1 0
0
1
Reflected position
Reflected position
2
1
1
3
-1 0
Reflection perpendicular to xy
plane
Reflected position
3
-1 0
-1
2
1
1
2
3
Original position
Original position
3
2
1
1
3
Reflected position
2
3D Transformation
Translation
Rotation
Scaling
Mirroring
/ Reflection
Translation in 3D
Remembering
matrices
x
T t x , t y
y
T t x , t y , t z
1 0 tx
tx
0 1 t y
ty 0 0 1
1 0 0 tx
x tx
0
1
0
t
y
y t y
0 0 1 tz
z t z
0
0
0
1
cos
R
sin
cos
sin
sin
cos
0
cos
sin
R (0,0,1, )
0
sin
sin
cos
0
cos
0
0 0
0 0
1 0
0 1
R=(0,0,1,)
0
1
R=(1,0,0,)
R (1,0,0, )
0
1
0 cos
0 sin
0
0
0
sin
cos
0
0
0
R=(0,1,0,)
R(0,1,0, )
cos
0
0 sin 0
1 0 0
sin 0 cos 0
0
0 0 1
Scale in 3D
sx
S sx , s y
0
0 x
*
s y y
sx
S s x , s y , s z 0
0
0
sy
0
sx
0
0
0
0
s z
x
* y
z
sy
0
0
1
sx
0
sy
0
0
sz
0
0
3D Transformations - Summary
Use homogeneous coordinates, just as in 2D
case.
Transformations are now 4x4 matrices.
x
z (out of page)
Note:
Convenient to think of display as
Being left-handed !!
( z into the screen )
Rotation in 3D
sin
cos
0
0
0
0
1
0
0
0
0
R x ( )
0
1
0 cos
0 sin
0
0
0
sin
cos
0
0
0
R y ( )
cos
0
sin
0 sin
1
0
0 cos
0
0
0
0
Inverse transformations
The inverse of the transformation is the inverse of its matrix
Composition of transformations
Series of transformation of matrices are
P' T ( x1 , y1 ) S ( S x , S y ) T ( x1 , y1 ) P
Inverse transformations
The
1 0 tx
1
T 0 1 ty
0 0 1
Inverse transformations
Rotation:
cos
1
R sin
0
sin
cos
0
0
1
Inverse transformations
Scaling:
0
1 / sx
S (sx , s y ) 0 1 / s y
0
0
0
0
Reflection -3D
Reflection in 3D
Reflection about the y-axis Reflection about the x-axis
11/17/16
1 0 0
0 1 0
0 0 1
37
1 0 0
0 1 0
0 0 1
Reflection 3D
11/17/16
38
0 1 0
1 0 0
0 0 1
1 0 0
0 1 0
0
Shear
1 shx
0 1
0 0
0
1
Shear
The
x x shx y, y y
'
'
3D Shear
xy Shear: SHxyP
1 0 shx 0
0 1 sh 0
y
0 0 1 0
0 0 0 1
x
y
z
1
Compositing Matrices
Remember:
So
in our case:
p = Ry-1 Rx -1 Rz Rx Ry p
Homogeneous Coordinates
Homogeneous
coordinates: represent
coordinates in 3 dimensions with a 4vector
x / w x
y / w y
( x, y , z )
z / w z
1 w
Homogeneous Coordinates
4x4:
0
0
0
1
0 cos() sin( ) 0
Rx
0 sin( ) cos() 0
0
0
1
0
Homogeneous Coordinates
cos()
0
Ry
sin( )
0 sin( )
1
0
0 cos()
0
0
0
0
Homogeneous Coordinates
cos() sin( ) 0 0
sin( ) cos() 0 0
Rz
0
0
1 0
0
0 1
0
Homogeneous Coordinates
Sx 0
0 Sy
0
0
0
0
0
0
Sz 0
0 1
4x4:
Homogeneous Coordinates
1
0
T
0
0
1
0
0
0 T x
0 T y
1 T z
0 1
Translation Matrices
x'
y'
z'
w'
1 0 0
0 1 0
0
0
0 0 1 10
0 0 0 1
1 0 0 0
0 0 1 0
0 1 0 0
0 0 0 1
x
y
z
w
Translation Matrices
x'
y'
z'
w'
1 0 0
0 0 1
0 1
0 0
0
0
0 x
0 y
10 z
1 w