Docsity

Matrix Transformations: Rotations, Scalings, and Translations - Prof. Benjamin B. Bederson, Assignments of Computer Graphics

Toggle sidebar
bg1
CMSC427/828E Spring 2000
Homework # 5
March 15, 2000
Assume the following notation:
R
means rotation counterclockwise with angle
,
T
i
means translation to the location (
x
i
;y
i
),
T
i
+
j
means translation to the location
of (
x
i
+
x
j
;y
i
+
y
j
),
T
(
x;y
)
means translation to the location (
x; y
),
S
c
means uniform
scaling with factor c, and
S
(
c
1
;c
2
)
means that non-uniform scaling with
c
in the
x
direction, and
c
2
in the
y
direction. This notation will be used through out the
homework.
φφ+θ−(π/2)
θ
x’
x"
y’
y"
Figure 1: Problem 1 Outline
1.
x
=
x
0
+
x
00
=
a
1
cos
+
a
2
sin(
+
,
2
)
=
a
1
cos
,
a
2
cos(
+
) (1)
y
=
y
0
,
y
00
=
a
1
sin
,
a
2
cos(
+
,
2
)
=
a
1
sin
,
a
2
sin(
+
) (2)
1
pf3
pf4
pf5

Partial preview of the text

Download Matrix Transformations: Rotations, Scalings, and Translations - Prof. Benjamin B. Bederson and more Assignments Computer Graphics in PDF only on Docsity!

CMSC427/828E Spring 2000

Homework # 5

March 15, 2000

Assume the following notation: R means rotation counterclo ckwise with angle  , Ti means translation to the lo cation (xi ; yi ), Ti+j means translation to the lo cation of (xi + xj ; yi + yj ), T(x;y ) means translation to the lo cation (x; y ), Sc means uniform scaling with factor c, and S(c 1 ;c 2 ) means that non-uniform scaling with c in the x direction, and c 2 in the y direction. This notation will b e used through out the homework.

φ (^) φ+θ−(π/2)

θ

x’

y’ x"

y"

Figure 1: Problem 1 Outline

x = x^0 + x^00 = a 1 cos  + a 2 sin( +   2

= a 1 cos  a 2 cos( +  ) (1) y = y 0 y 00 = a 1 sin  a 2 cos( + 

 2

= a 1 sin  a 2 sin( +  ) (2)

The previous metho d is straightforward, but as this is a graphics course, it is b etter to solve using transformations. It is a transformation of the origin to the p oint P.

P = R T(a 1 ;0) R T(a 2 ;0) O^

2 6 4

a 1 cos  a 2 cos ( +  ) a 1 sin  a 2 sin( +  ) 1

3 7 5

  1. (a)

R Sa =

2 6 4

cos  sin  0 sin  cos  0 0 0 1

3 7 5

2 6 4

a 0 0 0 a 0 0 0 1

3 7 5

2 6 4

a cos  a sin  0 a sin  a cos  0 0 0 1

3 7 5 (3)

Sa R =

2 (^64)

a 0 0 0 a 0 0 0 1

3 (^75)

2 (^64)

cos  sin  0 sin  cos  0 0 0 1

3 (^75)

2 (^64)

a cos  a sin  0 a sin  a cos  0 0 0 1

3 (^75) (4)

From equation 3 and equation 4, we reach R Sa = Sa R. Thus, uniform scaling, and rotation are commutative. (b) Now consider two rotations around  and  resp ectively,

R R =

2 6 4

cos  sin  0 sin  cos  0 0 0 1

3 7 5

2 6 4

cos  sin  0 sin  cos  0 0 0 1

3 7 5

2 (^64)

cos  cos  sin  sin  (sin  sin  cos  cos  ) 0 sin  cos  sin  sin  cos  cos  sin  sin  0 0 0 1

3 (^75)

2 (^64)

cos ( +  ) sin( +  ) 0 sin( +  ) cos( +  ) 0 0 0 1

3 (^75)

= R(+ ) (5)

Since addition is commutative =) R(+ ) = R( +).

R R = R R (6)

  1. In the left-handed system, p ositive rotations are cl ock w ise when lo oking from a p ositive axis toward the origin. This de nition of the p ositive rotations allows the same matrices of the right-handed system to b e used in the left-handed system without any mo di cations.
  2. Let's nd the matrix representation of a rotation followed by a translation:

T(x;y ) R =

2 6 4

cos  sin  x sin  cos  y 0 0 1

3 7 5 (9)

Now let's represent a translation followed by a rotation:

R T(x;y ) =

2 6 4

cos  sin  x cos  y sin  sin  cos  x sin  + y cos  0 0 1

3 7 5 (10)

From equations 9 and 10, RT can b e represented by by a rotation followed by translation where

R T(x;y ) = T(x^0 ;y 0 ) R

2 6 4

1 0 x cos  y sin  0 1 x sin  + y cos  0 0 1

3 7 5

2 6 4

cos  sin  0 sin  cos  0 0 0 1

3 7 5

2 (^64)

1 0 x^0 0 1 y 0 0 0 1

3 (^75)

2 (^64)

cos  sin  0 sin  cos  0 0 0 1

3 (^75) (11)

where x^0 = x cos  y sin , and y 0 = x sin  + y cos . Also, recall from problem # 2 that a sequence of rotations can b e replaced by a single rotation, and also, a sequence of translations can b e replaced by a single translation. Note that in the following, T and R represent abstract translation, and abstract rotation, resp ectively. So assume that there is a general sequence S 1 ; S 2 ; : : : ; Sn , where each Si can b e either a R or a T. We want to prove that M = Sn Sn 1 : : : S 1 = T R. The pro of will b e done by induction. At t = 0, M = I , where I is the identity matrix. M = I = T R where the rotation is by angle 0, and the translation to the origin (0; 0). At t = 1, M = S 1 Mold = S 1 T R, if S 1 = T =) M = T T R = T R due to equation 7. Else, if S 1 = R =) M = RT R = T 0 RR = T R due to equation 11. Assume pro of is held for t = n, i.e.; M = Sn Sn 1 : : : S 1 = T R, then at t = n + 1, If Sn+1 = T =) M = T T R = T R, and similarly, if S 1 = R =) M = RT R = T 0 RR = T R due to equation 11. So, it holds for t = n + 1.

Thus, any sequence of rotations, and translations can b e represented by a rota- tion followed by a translation.