Docsity

Study Guide for Computer Graphics | CSE 167, Study notes of Computer Graphics

Partial preview of the text

Download Study Guide for Computer Graphics | CSE 167 and more Study notes Computer Graphics in PDF only on Docsity!

Review

CSE167: Computer Graphics Instructor: Steve Rotenberg UCSD, Fall 2005

Final

 The final is on Tuesday, December 6  (^) From 11:30-2:  Center Hall, room 105  (^) It will cover material from the entire quarter  It will be similar to the midterm, but with 20 questions  (^) There will not be any questions on C++ or OpenGL

Example: Distance to Plane

 A plane is described by a point p on the plane and a unit normal n. Find the distance from point x to the plane

p •

n

- x

Example: Distance to Plane

The distance is the length of the projection

of x - p onto n :

p •

n

- x

x-p

dist = ( x − p ) ⋅ n

Example: Target ‘Lock On’

 For an airplane to get a missile locked on, the target must be within a 10 degree cone in front of the plane. If the plane’s matrix is M and the target position is t , find an expression that determines if the plane can get a lock on. a b c d

  • t

Example: Target ‘Lock On’

 We want to check the angle between the heading vector (- c ) and the vector from d to t:  (^) We can speed that up by comparing the cosine instead ( cos(10°)=.985 )

−

cos 10

1

d t
d t c
if

( )

d t
d t c
if

Example: Camera ‘Look At’

Our eye is located at position e and we

want to look at a target at position t.

Generate an appropriate camera matrix

M.

Example: Camera ‘Look At’

Our eye is located at position e and we

want to look at a target at position t.

Generate an appropriate camera matrix

M.

Two possible approaches include:

 Measure angles and rotate matrix into place  (^) Construct a , b , c , & d vectors of M directly

Example: Camera ‘Look At’ Method 2: Build Matrix Directly 

The d vector is just the position of the

camera, which is e :

The c vector is a unit length vector that

points directly behind the viewer:

e t
e t
c
d = e

Example: Camera ‘Look At’ Method 2: Build Matrix Directly  (^) The a vector is a unit length vector that points to the right of the viewer. It is perpendicular to the c axis. To keep the camera from rolling, we also want the a vector to lay flat in the xz-plane, perpendicular to the y-axis.  (^) Note that a cross product with the y-axis can be optimized as follows:

y c
y c
a
×
×

[ ] [ ] z x

0 1 0 × c = c 0 − c

Example: Camera ‘Look At’ Method 2: Build Matrix Directly 

Summary:

b = c × a
e t
e t
c
d = e
y c
y c
a
×
×

Position Vector Dot Matrix

z x z y z z z z y x y y y z y y x x x y x z x x z y x z z z z y y y y x x x x v v a v b v c d v v a v b v c d v v a v b v c d v v v a b c d a b c d a b c d ′ = + + +

v M v

v ′^ = a + b + c + d

x y z

v v v

Position Vector Dot Matrix

v ′^ = a + b + c + d x y z v v v v=(.5,.5,0,1) x y Local Space (0,0,0) x y World Space (0,0,0) a b d Matrix M

Position Vector Dot Matrix

v ′^ = a + b + c + d x y z v v v v=(.5,.5,0,1) x y Local Space (0,0,0) x y World Space (0,0,0) a b d v ’