1 / 17

CS 445/645 Fall 2001

CS 445/645 Fall 2001. Splines. Last Class. Hermite and B é zier Splines Understand how these curves are defined The G matrix Understand how the curve definitions lead to the coefficient matrices The M matrix Blending functions Convex Hulls. Assignment 4, part 2. One-week extension…

elvina
Download Presentation

CS 445/645 Fall 2001

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS 445/645Fall 2001 Splines

  2. Last Class • Hermite and Bézier Splines • Understand how these curves are defined • The G matrix • Understand how the curve definitions lead to the coefficient matrices • The M matrix • Blending functions • Convex Hulls

  3. Assignment 4, part 2 • One-week extension… • Program due December 5th at midnight • Quaternions not required • Will be extra credit • Reason for extension • We think you can have more fun with this assignment if you play with a couple new ideas

  4. Quaternions • Remember why we don’t like Euler angles • Gimbal lock • Arbitrary multiplication order • Interpolation

  5. Gimbal Lock • Occurs when two axes are aligned • Second and third rotations have effect of transforming earlier rotations • ex: Rot x, Rot y, Rot z • If Rot y = 90 degrees, Rot z == -Rot x

  6. Multiplication Order • (qx, qy, qz) = RzRyRx • Rotate qx degrees about x-axis • Rotate qy degrees about y-axis • Rotate qz degrees about z-axis • Axis order is not defined • (y, z, x), (x, z, y), (z, y, x)… are all legal • Pick one

  7. Interpolation

  8. Local Rotations • Multiple applications of small Euler angles cause numerical errors and drift • Consider 720 rotations about y of 1 degree • Should end up back where you started

  9. Local Rotations • Not only is the Euler computation expensive • But it won’t provide the correct result • Matrices may not be orthonormal

  10. Quaternion • Doesn’t suffer from Gimbal Lock • Multiplication order is clear • Interpolation is sensible • Compositions are cheap

  11. Implementing Quaternions • Instead of storing xrot and yrot • Store quaternion • Initially quaternion is set to (0, 0, 0, 1) • If user moves mouse, multiply initial quaternion by a second quaternion corresponding to the rotation the user caused • When drawing scene convert current quaternion to rotation matrix and multiply on stack

  12. User Interaction • In handleMouseMovement() • You can keep track of the change in x and y between when the user clicked the mouse and released • Imagine the user had a sticky finger and touched the surface of a sphere encircling your model and then spun the sphere with their finger • How would the sphere have rotated?

  13. User Interaction • Compute points of surface of sphere where user first clicked and released • Use these points to compute • Amount of rotation (in degrees) • Cross product of vectors between sphere center and these two points • These will be your quaternion parameters

  14. User Interaction • Compute amount of rotation (cos (theta / 2) is scalar of quaternion) • Multiply rotation by scalar so rotations match mouse translation • Axis of rotation (use cross product) • Zero-out the z-component of axis • Normalize axis of rotation • Multiply axis of rotation by sin (theta/2) • You might have to normalize again • Multiply previous quaternion by this new quaternion to compose rotations

  15. Cube Mapping • Consider projection of triangle onto 2 faces of cube

  16. Other things • glTexSubImage2D • glUnproject • glDepthFunc (GL_LEQUAL)

  17. Making Movies • Next Class

More Related