cs 445 645 fall 2001 n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
CS 445/645 Fall 2001 PowerPoint Presentation
Download Presentation
CS 445/645 Fall 2001

Loading in 2 Seconds...

play fullscreen
1 / 17

CS 445/645 Fall 2001 - PowerPoint PPT Presentation


  • 140 Views
  • Uploaded on

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…

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'CS 445/645 Fall 2001' - elvina


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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
last class
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
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
quaternions
Quaternions
  • Remember why we don’t like Euler angles
    • Gimbal lock
    • Arbitrary multiplication order
    • Interpolation
gimbal lock
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
multiplication order
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
local rotations
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
local rotations1
Local Rotations
  • Not only is the Euler computation expensive
  • But it won’t provide the correct result
  • Matrices may not be orthonormal
quaternion
Quaternion
  • Doesn’t suffer from Gimbal Lock
  • Multiplication order is clear
  • Interpolation is sensible
  • Compositions are cheap
implementing quaternions
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
user interaction
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?
user interaction1
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
user interaction2
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
cube mapping
Cube Mapping
  • Consider projection of triangle onto 2 faces of cube
other things
Other things
  • glTexSubImage2D
  • glUnproject
  • glDepthFunc (GL_LEQUAL)
making movies
Making Movies
  • Next Class