Download presentation
Presentation is loading. Please wait.
Published byRosanna Bates Modified over 6 years ago
1
Computer Graphics Lecture 12 2D Transformations II Taqdees A
Computer Graphics Lecture 12 2D Transformations II Taqdees A. Siddiqi
2
Homogeneous Coordinates
Translation: P′ = P + T Rotation: P′ = R . P Scaling: P′ = S . P
3
Homogeneous Coordinates
From our last discussion we know: P’ = M1 . P + M2 With coordinate positions P and P’ represented as column vectors Matrix M1 is a 2x2 array containing multiplicative factors M2 is a 2 element column matrix containing translation factors
4
Can we find a way to eliminate the matrix addition associated with translation?
Yes, we can. But for that M1 will have to be rewritten as a 3x3 matrix and also the coordinate positions will have to be expressed as a homogeneous coordinate triple: (x, y) as (xh, yh, h) where xh yh x = –––– , y = –––– h h
5
For simplicity, 1 is used as value for h in affine transformations, thus
(x, y) has homogeneous coordinates as (x, y, 1)
6
Translation with Homogeneous Coordinates
The translation can now be expressed using homogeneous coordinates as: Abbreviated as: P’ = T (tx, ty) . P
7
Rotation with Homogeneous Coordinates
The rotation can now be expressed using homogeneous coordinates as: Abbreviated as: P’ = R (θ) . P
8
Scaling with Homogeneous Coordinates
The scaling can now be expressed using homogeneous coordinates as: Abbreviated as: P’ = S (Sx, Sy) . P
9
Composite Transformations
Two successive translations Translation vectors (tx1, ty1) and (tx2, ty2) P’ = T(tx2,ty2) . {T(tx1,ty1) . P} = {T(tx2,ty2) . T(tx1,ty1)} . P Where P and P’ are homogeneous column vectors.
10
Composite Translations
Which means that T(tx2,ty2) . T(tx1,ty1) = T(tx1 + tx2 , ty1 + ty2) hence
11
Composite Rotations Two successive Rotations applied to a point P produce: P’ = R(θ2) . {R(θ1) . P} = {R(θ2) . R(θ1)} . P But since, R(θ2) . R(θ1) = R(θ1 + θ2) Therefore, P’ = R(θ1 + θ2) . P
12
Composite Scalings Two successive scaling operations would produce: or
S(sx2,sy2).S(sx1,sy1) = S(sx1.sx2, sy1.sy2)
13
General Pivot Point Rotation
General pivot point (xr,yr) Translate-Rotate-Translate Translate the object to coincide the pivot with the origin Rotate about the origin Translate back to the original pivot position
15
T(xr , yr) . R(θ) . T(-xr ,-yr) = R(xr, yr , θ)
16
General Fixed Point Scaling
General fixed point (xf,yf) Translate-Scale-Translate Translate the object to coincide the fixed point with the origin Scale w.r.t. origin Translate the object back to the original position
18
T(xf,yf).S(sx,sy).T(-xf,-yf) = S(xf,yf , sx,sy)
19
General Composite Transformations and Computational Efficiency
Translations-Rotations-Scalings
20
rsij are Rotation-Scaling terms
trsi are the translational terms It takes 9 multiplications and 6 additions to evaluate but explicit calculations for transformed-coords: x’ = x.rsxx + y.rsxy + trsx y’ = x.rsyx + y.rsyy + trsy i.e. 4 multiplications and 4 additions
21
If an object is to be scaled and rotated about its centroid coordinates (xc,yc) and then translated, the composite transformation matrix will be: T(tx,ty) . R(xc,yc) . S(xc,yc,sx,sy)
22
T(tx,ty) . R(xc,yc) . S(xc,yc,sx,sy)
23
Order is Important
24
Reverse Order – Changed Position
25
Reflection Mirror image of object relative to axis of reflection
By rotating the object about axis of reflection by 180o
26
Reflection about x-axis
27
Reflection about y-axis
28
Shear Distorts the shape Effect is, of layers sliding off each other
x direction shear y direction shear
29
Shear Y X 1 2 3 4 5 6 7 8 9 10
30
x direction Shear x’ = x + shx . y y’ = y
31
y direction Shear x’ = x y’ = shy . x + y
32
x and y direction Shear x’ = x + shx . y y’ = shy . x + y
33
Computer Graphics Lecture 12 2D Transformations II Taqdees A
Computer Graphics Lecture 12 2D Transformations II Taqdees A. Siddiqi
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.