2

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

4)a) glTranslate(-5.0,1.

0,0);
b) glRotate(90.0,0.0,0.0,1.0);
glTranslate(0.0,7.0,0);
or
glTranslate(5.0,-1.0,0);
glRotate(90.0,0.0,0.0,1.0);
glTranslate(-1.0,2.0,0);
c) glRotate(90.0,0.0,0.0,1.0);
glTranslate(-1.0,2.0,0);

--------------------------------------------------------------------------------

5)
a)
glRotatef(90.0, 0, 0, 1.0);
𝒄𝒐𝒔(𝟗𝟎) − 𝒔𝒊𝒏(𝟗𝟎) 𝟎 𝟎
𝒔𝒊𝒏(𝟗𝟎) 𝒄𝒐𝒔(𝟗𝟎) 𝟎 𝟎
[ ]
𝟎 𝟎 𝟏 𝟎
𝟎 𝟎 𝟎 𝟏

𝟎 −𝟏 𝟎 𝟎
𝟏 𝟎 𝟎 𝟎
[ ]
𝟎 𝟎 𝟏 𝟎
𝟎 𝟎 𝟎 𝟏

glScalef(-1.0, 2.0,-1.0);
−𝟏 𝟎 𝟎 𝟎
𝟎 𝟐 𝟎 𝟎
[ ]
𝟎 𝟎 −𝟏 𝟎
𝟎 𝟎 𝟎 𝟏

glTranslatef(-2.0,-1.0, 2.0);
𝟏 𝟎 𝟎 −𝟐
𝟎 𝟏 𝟎 −𝟏
[ ]
𝟎 𝟎 𝟏 𝟐
𝟎 𝟎 𝟎 𝟏

𝟎 −𝟏 𝟎 𝟎 −𝟏 𝟎 𝟎 𝟎 𝟏 𝟎 𝟎 −𝟐
𝟏 𝟎 𝟎 𝟎 𝟎 𝟐 𝟎 𝟎 𝟎 𝟏 𝟎 −𝟏
[ ]x[ ]x[ ]
𝟎 𝟎 𝟏 𝟎 𝟎 𝟎 −𝟏 𝟎 𝟎 𝟎 𝟏 𝟐
𝟎 𝟎 𝟎 𝟏 𝟎 𝟎 𝟎 𝟏 𝟎 𝟎 𝟎 𝟏
𝟎 −𝟏 𝟎 𝟎 −𝟏 𝟎 𝟎 𝟎
𝟏 𝟎 𝟎 𝟎 𝟎 𝟐 𝟎 −𝟐
=[ ]x[ ]
𝟎 𝟎 𝟏 𝟎 𝟎 𝟎 −𝟏 𝟎
𝟎 𝟎 𝟎 𝟏 𝟎 𝟎 𝟎 𝟏
𝟎 −𝟐 𝟎 𝟐
−𝟏 𝟎 𝟎 𝟎
=[ ]
𝟎 𝟎 −𝟏 𝟎
𝟎 𝟎 𝟎 𝟏

b)
glTranslatef(2.0,1.0,4.0);
𝟏 𝟎 𝟎 𝟐
𝟎 𝟏 𝟎 𝟏
[ ]
𝟎 𝟎 𝟏 𝟒
𝟎 𝟎 𝟎 𝟏

glScalef(1.0, 1.0,0.5);
𝟏 𝟎 𝟎 𝟎
𝟎 𝟏 𝟎 𝟎
[ ]
𝟎 𝟎 𝟎. 𝟓 𝟎
𝟎 𝟎 𝟎 𝟏

glRotatef(90.0, 0, 1.0, 0.0);


𝟎 −𝟏 𝟎 𝟎
𝟏 𝟎 𝟎 𝟎
[ ]
𝟎 𝟎 𝟏 𝟎
𝟎 𝟎 𝟎 𝟏

𝟏 𝟎 𝟎 𝟐 𝟏 𝟎 𝟎 𝟎 𝟎 −𝟏 𝟎 𝟎
𝟎 𝟏 𝟎 𝟏 𝟎 𝟏 𝟎 𝟎 𝟏 𝟎 𝟎 𝟎
=[ ]x [ ]x[ ]
𝟎 𝟎 𝟏 𝟒 𝟎 𝟎 𝟎. 𝟓 𝟎 𝟎 𝟎 𝟏 𝟎
𝟎 𝟎 𝟎 𝟏 𝟎 𝟎 𝟎 𝟏 𝟎 𝟎 𝟎 𝟏
= ……..

--------------------------------------------------------------------------------
6)
--------------------------------------------------------------------------------
7)
glTranslate (4.0,-3.0,2.0);
glRotate (90,0.0,0.0,1.0);

𝟏 𝟎 𝟎 𝟒
𝟎 𝟏 𝟎 −𝟑
T=[ ]
𝟎 𝟎 𝟏 𝟐
𝟎 𝟎 𝟎 𝟏
𝟎 −𝟏 𝟎 𝟎
𝟏 𝟎 𝟎 𝟎
R=[ ]
𝟎 𝟎 𝟏 𝟎
𝟎 𝟎 𝟎 𝟏

𝟏 𝟎 𝟎 𝟒 𝟎 −𝟏 𝟎 𝟎 𝟎 −𝟏 𝟎 𝟒
𝟎 𝟏 𝟎 −𝟑 𝟏 𝟎 𝟎 𝟎 𝟏 𝟎 𝟎 −𝟑
TxR=[ ] 𝐱[ ]=[ ]
𝟎 𝟎 𝟏 𝟐 𝟎 𝟎 𝟏 𝟎 𝟎 𝟎 𝟏 𝟐
𝟎 𝟎 𝟎 𝟏 𝟎 𝟎 𝟎 𝟏 𝟎 𝟎 𝟎 𝟏

--------------------------------------------------------------------------------
8)
𝟎 −𝟏 𝟎 𝟎
𝟏 𝟎 𝟎 𝟎
R(z,90)=[ ]
𝟎 𝟎 𝟏 𝟎
𝟎 𝟎 𝟎 𝟏

𝟏 𝟎 𝟎 𝟒
𝟎 𝟏 𝟎𝟏
T(4,1,0)=[ ]
𝟎 𝟎 𝟏 𝟎
𝟎 𝟎 𝟎 𝟏

rot(z,90) trans(4,1,0) = trans(x,y,0) rot(z, theta)


𝟎 −𝟏 𝟎 𝟎 𝟏 𝟎 𝟎 𝟒 𝟏 𝟎 𝟎 𝒙
𝟏 𝟎 𝟎 𝟎 𝟎 𝟏 𝟎𝟏 𝟎 𝟏 𝟎𝒚
[ ]x[ ]=[ ] x rot(z, theta)
𝟎 𝟎 𝟏 𝟎 𝟎 𝟎 𝟏 𝟎 𝟎 𝟎 𝟏 𝟎
𝟎 𝟎 𝟎 𝟏 𝟎 𝟎 𝟎 𝟏 𝟎 𝟎 𝟎 𝟏
𝟎 −𝟏 𝟎 −𝟏 𝟏 𝟎 𝟎 𝒙 𝒄(𝒕𝒉) − 𝒔(𝒕𝒉) 𝟎 𝟎
𝟏 𝟎 𝟎 𝟒 𝟎 𝟏 𝟎𝒚 𝒔(𝒕𝒉) 𝒄(𝒕𝒉) 𝟎 𝟎
[ ]=[ ]x[ ]
𝟎 𝟎 𝟏 𝟎 𝟎 𝟎 𝟏 𝟎 𝟎 𝟎 𝟏 𝟎
𝟎 𝟎 𝟎 𝟏 𝟎 𝟎 𝟎 𝟏 𝟎 𝟎 𝟎 𝟏

𝒄(𝒕𝒉) − 𝒔(𝒕𝒉) 𝟎 𝒙
𝒔(𝒕𝒉) 𝒄(𝒕𝒉) 𝟎 𝒚
=[ ]
𝟎 𝟎 𝟏 𝟎
𝟎 𝟎 𝟎 𝟏

c(th) = 0 and s(th) = 1


so, th = 90
x = -1
y=4
R(z,90) ➔ glRotate (90.0.0,0.0,1.0);
T(4,1,0); ➔ glTranslate (4,1,0);
T(-1,4,0); ➔ glTranslate (4,1,0);
R(z,90) ➔ glRotate (90.0.0,0.0,1.0);

--------------------------------------------------------------------------------
9)

You might also like