CS计算机代考程序代写 1

1

1

U
Ans. to Tut. 4

UQn 1

VRP = (30, 30, 30) VPN = )0,30sin,30(cos 0 o VUP = (0, 1, 0)

)0,30sin,30(cos ooVC == VPNZ

)30cos,0,0(
030sin30cos
010 o

oo

kji
−==×VPNVUP

)1,0,0( −=×= VPNVUPXVC

)0,30cos,30sin( ooVCVCVC −=×= XZY

1

1

1000
30001
3030sin30cos0
3030cos30sin0









=
oo

oo

WCCM

UQn 2

WCCCCWCC ←←← = 1122 MMM

11

1000
30001
3030sin30cos0
3030cos30sin0

1000
0100
0010
2001

−−















=
oo

oo

=

1

1000
0100
0010
2001

1000
30001
3030sin30cos0
3030cos30sin0
























oo

oo

( 111)( −−− = ABAB )

2

=

1

1000
28001
3030sin30cos0
3030cos30sin0










oo

oo

Alternatively, there is a much quicker method:

The second camera’s VRP is (30, 30, 30) + 2 1VCX = (30, 30, 30) + 2(0, 0, -1) = (30,
30, 28). Therefore

1

2

1000
28001
3030sin30cos0
3030cos30sin0









=
oo

oo

WCCM

UQn 3

)2,5.0,
2
3

(),,( −=pzpypx VVV 0=vpZ

Since











=

1000
0000
025.010

0
4
3

01

parallelM

2tan
22
=

+
=

pypx

pz

VV

V
α ⇒ Cabinet Projection













=

1000
000

10

01

vp

pz

py
vp

pz

py

pz

px
vp

pz

px

parallel

z
V
V

z
V
V

V
V

z
V
V

M

3

U

Qn 4

a)








1000
100000
0010
0001

OpenGL command

glortho (100, 300, 100, 300, 100, 1000 )

dnear = 100 ⇒ 100−=nearZ ; dfar = 1000 ⇒ 1000−=farZ

b) Cavalier projection

)2,1,1(t)Z,Y,X()1,y,x( pp −+=

Take the 3Prd P component,

2

Z
2

1
t −=

Take the 1Pst P and 2 PndP components,

2
1

2
−+=−=

Z
XtXx p

2

1
2
+−=+=

Z
YtYy p

Writing out,













=

1000
1000
2

1
2

1
10

2
1

2
1

01

M

c) VRP = (200, 200, 200) VUP = (0, 1, 0)

VPN = (200, 200, 200) – (0, 0, 0) = (200, 200, 200)

4

VPNZVC = = 





3

1
,

3
1

,
3

1

)1,0,1(
111
010 −==×=
kji

VC VPNVUPX

)1,2,1(
101

111 −−=

=×=
kji

VCVCVC XZY

1

1

1000

200
3

1
6

1
2

1

200
3

1
6

2
0

200
3

1
6

1
2

1

1000















−−

=







=
VRPZYX

M VCVCVC

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 W2M ← .

MMMM )30(1122

o
ZWW R −== ←←←

=

1

10

1000

200
3

1
6

1
2

1

200
3

1
6

2
0

200
3

1
6

1
2

1

)30(















−−

ZR

=

1

1000
0100

00
2
3

5.0

005.0
2
3

1000

200
3

1
6

1
2

1

200
3

1
6

2
0

200
3

1
6

1
2

1










































−−

5

=

1

1000

200
3

1
0

6
2

200
3

1
2

1
6

1

200
3

1
2

1
6

1