CS计算机代考程序代写 UAns. to Tut. 4

UAns. to Tut. 4
UQn 1
VRP = (30, 30, 30) VPN = (cos300,sin30o,0) VUP = (0, 1, 0)
ZVC = VPN = (cos30o ,sin30o ,0)
ijk
VUP×VPN= 0 1 0 =(0,0,−cos30o)
cos30o sin30o 0 XVC =VUP×VPN=(0,0,−1)
YVC =ZVC ×XVC =(−sin30o,cos30o,0)
cos30o 30−1 sin30o 30 0 30 0001
 0  0
−sin30o cos30o 0
MC1←WC =−1 UQn 2
MC2←WC =MC2←C1MC1←WC
30−1 0 1 0 0  0 cos30o sin30o 30
1 0 0 2−1 0 −sin30o cos30o
=0 0 1 0 −1 0 0 30
00010 0 0 1 
−sin30o cos30o cos30o sin30o 0 0
 0
301 0 0 2−1
300 1 0 0 −1 −1 −1
 0 =−1
300 0 1 0 ( (AB) =B A )
0 0 0 10001   
1

cos30o 30−1 sin30o 30 0 28 0001
Alternatively, there is a much quicker method:
The second camera’s VRP is (30, 30, 30) + 2 XVC1 = (30, 30, 30) + 2(0, 0, -1) = (30, 30, 28). Therefore
cos30o 30−1 sin30o 30 0 28 0001
UQn 3
(Vpx ,Vpy ,Vpz ) = ( 23 ,0.5,−2) Zvp = 0
Since
MC2←WC =−1
 0
−sin30o cos30o 0
 0 = −1
 0  0
−sin30o cos30o 0
 Vpx Vpx  10−V zvpV
 Vpz Vpz  M =01−py z py
parallel
 V vp V 
000pz zpz  vp  000 1
3
M parallel
tanα =
1 0 4 0 = 0 1 0.25 0
0 0 0 0 0 0 0 1
Vpz = 2 ⇒ Cabinet Projection
V 2 +V 2 px py
2

U
Qn 4
100 0 0 1 0 0  0 0 0 −100 000 1
OpenGL command
glortho (100, 300, 100, 300, 100, 1000 )
dnear=100⇒ Znear =−100; dfar=1000⇒ Zfar =−1000
Cavalier projection (xp,yp,1)=(X,Y,Z)+t(−1,1, 2)
Take the 3rd component, t = 12 − Z2
a)
b)
PP
Take the 1st and 2nd components,
PP
xp =X−t=X+ Z − 1 22
yp =Y+t=Y− Z + 1 22
PP
Writing out, 11
1 0 2 − 2 M=0 1 − 1 1 
22 00 0 1
c)
00 0 1
VRP = (200, 200, 200) VUP = (0, 1, 0)
VPN = (200, 200, 200) – (0, 0, 0) = (200, 200, 200) 3

111 ZVC =VPN = 3, 3, 3
ijk XVC=VUP×VPN=0 1 0=(1,0,−1)
111
ijk YVC=ZVC×XVC=11 1=(−1,2,−1)
1 0 −1

1 11 −1 −1  2 − 6 3 200

XVC YVC ZVC VRP  0 2 1 200
M==63
OpenGL command:
gluLookAt (200, 200, 200, 0, 0, 0, 0, 1, 0)
d) Denote 1 as the original camera, 2 as the rotated camera, and w as the world coordinate system. Wish to find M2←W .
0 0 0 1 −1 −1 1 200    2 6 3  0001
M2←W =M2←1M1←W =RZ(−30o)M
1 11 −1
 2 − 6 3 200 =R(300)−10 2 1200
Z63
− 1 − 1 1 200 263 0001
1 11  −1  − 2003 
2 63 2−0.500
=  0 2 1 2000.5 3 0 0
 6 3  2 
−1 −1 1 2000 0 10
 2 6 3 0 0 01 0 0 0 1 
  
4

1 1 1 −1  6 − 2 3 200
=1 1 1200 623
−26 0 13200 0001

5