DOC PREVIEW
UVA CS 445 - Splines

This preview shows page 1-2-3-4-5-6 out of 17 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 17 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 17 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 17 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 17 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 17 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 17 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 17 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CS 445/645 Fall 2001Last ClassAssignment 4, part 2QuaternionsGimbal LockMultiplication OrderInterpolationLocal RotationsSlide 9QuaternionImplementing QuaternionsUser InteractionSlide 13Slide 14Cube MappingOther thingsMaking MoviesCS 445/645Fall 2001SplinesLast 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 HullsAssignment 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 ideasQuaternions•Remember why we don’t like Euler angles–Gimbal lock–Arbitrary multiplication order–InterpolationGimbal 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 xMultiplication Order•(x, y, z) = RzRyRx–Rotate x degrees about x-axis–Rotate y degrees about y-axis–Rotate z degrees about z-axis•Axis order is not defined–(y, z, x), (x, z, y), (z, y, x)… are all legal–Pick oneInterpolationLocal 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 started720720100009999817.0017452374.00100017452374.09999817.10000)1cos(0)1sin(00100)1sin(0)1cos(00010001100009999817.0017452374.00100017452374.09999817.?720Local Rotations•Not only is the Euler computation expensive•But it won’t provide the correct result•Matrices may not be orthonormalQuaternion•Doesn’t suffer from Gimbal Lock•Multiplication order is clear•Interpolation is sensible•Compositions are cheapImplementing 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 stackUser 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 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 parametersUser 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 rotationsCube Mapping•Consider projection of triangle onto 2 faces of cubeOther things•glTexSubImage2D•glUnproject•glDepthFunc (GL_LEQUAL)Making Movies•Next


View Full Document

UVA CS 445 - Splines

Documents in this Course
Lighting

Lighting

49 pages

Color

Color

20 pages

Clipping

Clipping

10 pages

Shadows

Shadows

95 pages

Color

Color

37 pages

Radiosity

Radiosity

49 pages

Clipping

Clipping

59 pages

Assign 3

Assign 3

28 pages

Color

Color

17 pages

Load more
Download Splines
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Splines and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Splines 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?