80 likes | 336 Views
Deriving the rotation matrix:. 1. Convert Cartesian coordinate (x,y) to polar coordinate:. 2. Rotate p to p’: ____ remain unchanged, while ____ is changed to ______. Then (x’,y’) becomes ( rcos( f+q) , _________ ). 3. Use trigonometry identity:.
E N D
Deriving the rotation matrix: 1. Convert Cartesian coordinate (x,y) to polar coordinate: 2. Rotate p to p’: ____ remain unchanged, while ____ is changed to ______. Then (x’,y’) becomes ( rcos(f+q), _________ ). 3. Use trigonometry identity:
Given three coordinates in floats, write the codes that draw these three lines. p1 p2 glBegin (GL_LINES); glEnd(); p3 glBegin (GL_LINE_STRIP); glEnd(); glBegin (GL_LINE_LOOP); glEnd();
Modelview Matrix Viewing Transform Model Transform world coordinates e n w o [-1,1]3 [R3 | R4] [R3 | R4] [R3 | R4] Fill in the missing words, and circle the correct dimension With the following settings, determine the coordinates in each stage: O____ coordinates: ( ). W____ coordinates: ( ). E____ coordinates: ( ). N____ coordinates: ( ).
Explain the components of Phong illumination model: What they are, and how they are computed Ambient: Explain these unit vectors: p: a point on surface Diffuse: n: v: Specular: r: l: • In OpenGL, these vectors are computed in eye coordinate space. • The code to the right declares the vertex (p) and normal (n) in object space. • To convert p to eye space: • To convert n to eye space: • To obtain l vector (for point light) • To obtain v vector:
Design three macros (using #define) that return the largest of the given elements: Max2(x,y). Test if you get 4 with Max2 (1+2, 4). • 2. Use Max2 to construct Max3(x,y,z) and Max4(x,y,z,t) 3. Write a summation to evaluate • 4. OpenGL 2D: • On XY plane, construct grid lines, [-10,10]2, spacing 1 • Left click to create a point, right click to stop construction (# of points < 10) • Control-left-lick to toggle rotation, around first point • Implement “snap to grid” in clicking (points are created on integer points) • 5. OpenGL 3D (viewer) • [configurations shown on white board[ • XZ grid: [-10,10]2, spacing 1, unlit • Gate (glut primitives, cyl+box) • Porsche (OBJ) moving in a circular path • Point light : move in a circular path by arrow keys