3D Rotation: more than just a hobby

Similar documents
Quaternions and Rotations

Quaternions and Rotations

12.1 Quaternions and Rotations

Quaternions and Rotations

Quaternions and Rotations

CS354 Computer Graphics Rotations and Quaternions

3D Rotations and Complex Representations. Computer Graphics CMU /15-662, Fall 2017

Coordinate Transformations. Coordinate Transformation. Problem in animation. Coordinate Transformation. Rendering Pipeline $ = $! $ ! $!

3D Transformations and Complex Representations. Computer Graphics CMU /15-662, Fall 2016

Motivation. Parametric Curves (later Surfaces) Outline. Tangents, Normals, Binormals. Arclength. Advanced Computer Graphics (Fall 2010)

Orientation & Quaternions

3D Game Engine Programming. Understanding Quaternions. Helping you build your dream game engine. Posted on June 25, 2012 by Jeremiah van Oosten

Animation. Keyframe animation. CS4620/5620: Lecture 30. Rigid motion: the simplest deformation. Controlling shape for animation

CS 445 / 645 Introduction to Computer Graphics. Lecture 21 Representing Rotations

IMAGE-BASED RENDERING AND ANIMATION

Rotations in 3D Graphics and the Gimbal Lock

Animation. CS 4620 Lecture 32. Cornell CS4620 Fall Kavita Bala

Rotations (and other transformations) Rotation as rotation matrix. Storage. Apply to vector matrix vector multiply (15 flops)

Transformation. Jane Li Assistant Professor Mechanical Engineering & Robotics Engineering

Autonomous Navigation for Flying Robots

Visualizing Quaternions

3D Kinematics. Consists of two parts

3D Transformations. CS 4620 Lecture Kavita Bala w/ prior instructor Steve Marschner. Cornell CS4620 Fall 2015 Lecture 11

a a= a a =a a 1 =1 Division turned out to be equivalent to multiplication: a b= a b =a 1 b

Today. Today. Introduction. Matrices. Matrices. Computergrafik. Transformations & matrices Introduction Matrices

ME 597: AUTONOMOUS MOBILE ROBOTICS SECTION 2 COORDINATE TRANSFORMS. Prof. Steven Waslander

Introduction to quaternions. Mathematics. Operations

CS184: Using Quaternions to Represent Rotation

CS 4621 PPA3: Animation

Fundamentals of Computer Animation

Animation. CS 465 Lecture 22

Computer Animation Fundamentals. Animation Methods Keyframing Interpolation Kinematics Inverse Kinematics

Quaternions & Rotation in 3D Space

Why animate humans? Why is this hard? Aspects of the Problem. These lectures. Animation Apreciation 101

CS 475 / CS 675 Computer Graphics. Lecture 16 : Interpolation for Animation

Vector Calculus: Understanding the Cross Product

Fundamentals of 3D. Lecture 3: Debriefing: Lecture 2 Rigid transformations Quaternions Iterative Closest Point (+Kd-trees)

Fundamentals of Computer Animation

3D Transformations World Window to Viewport Transformation Week 2, Lecture 4

Worksheet 5. 3 Less trigonometry and more dishonesty/linear algebra knowledge Less trigonometry, less dishonesty... 4

Selection and Integration of Sensors Alex Spitzer 11/23/14

Part II: OUTLINE. Visualizing Quaternions. Part II: Visualizing Quaternion Geometry. The Spherical Projection Trick: Visualizing unit vectors.

3D Modelling: Animation Fundamentals & Unit Quaternions

Animation. Animation

Maths at the Movies. Chris Budd

CSE 165: 3D User Interaction. Lecture #5: Selection

Visual Recognition: Image Formation

1 Transformations. Chapter 1. Transformations. Department of Computer Science and Engineering 1-1

Lecture 22 of 41. Animation 2 of 3: Rotations, Quaternions Dynamics & Kinematics

Lecture 22 of 41. Animation 2 of 3: Rotations, Quaternions Dynamics & Kinematics

Animation and Quaternions

CS770/870 Spring 2017 Quaternions

Quaternion to Euler Angle Conversion for Arbitrary Rotation Sequence Using Geometric Methods

Full Screen Layout. Main Menu Property-specific Options. Object Tools ( t ) Outliner. Object Properties ( n ) Properties Buttons

Quaternions. Mike Bailey. A Useful Concept: Spherical Linear Interpolation. sin(1 t) sin t

Articulated Characters

Reading. Topics in Articulated Animation. Character Representation. Animation. q i. t 1 t 2. Articulated models: Character Models are rich, complex

Graphics for VEs. Ruth Aylett

Animations. Hakan Bilen University of Edinburgh. Computer Graphics Fall Some slides are courtesy of Steve Marschner and Kavita Bala

CMSC 425: Lecture 6 Affine Transformations and Rotations

Interesting Application. Linear Algebra

Today. Parity. General Polygons? Non-Zero Winding Rule. Winding Numbers. CS559 Lecture 11 Polygons, Transformations

Rotation with Quaternions

Derivative Of Rotation Matrix Direct Matrix Derivation

Transformations Week 9, Lecture 18

Drawing in 3D (viewing, projection, and the rest of the pipeline)

Describe the Orthographic and Perspective projections. How do we combine together transform matrices?

Constructing a Pentagon from a Circle, in Google SketchUp

Intro Right Triangle Trig

Pong in Unity a basic Intro

Animation. Traditional Animation Keyframe Animation. Interpolating Rotation Forward/Inverse Kinematics

1 Historical Notes. Kinematics 5: Quaternions

COMP 175 COMPUTER GRAPHICS. Lecture 10: Animation. COMP 175: Computer Graphics March 12, Erik Anderson 08 Animation

Inertial Measurement Units II!

Ch 10: Game Event Management. Quiz # 4 Discussion

Computer Graphics Introduction. Taku Komura

Computer Animation II

IntroductionToRobotics-Lecture02

Development of intelligent systems

To Do. Outline. Translation. Homogeneous Coordinates. Foundations of Computer Graphics. Representation of Points (4-Vectors) Start doing HW 1

Editing Polygons. Adding material/volume: Extrude. Learning objectives

PSE Game Physics. Session (3) Springs, Ropes, Linear Momentum and Rotations. Oliver Meister, Roland Wittmann

Graphics for VEs. Ruth Aylett

Kinematics and Orientations

Computer Vision Projective Geometry and Calibration. Pinhole cameras

CALCULATING TRANSFORMATIONS OF KINEMATIC CHAINS USING HOMOGENEOUS COORDINATES

CGS 3220 Lecture 13 Polygonal Character Modeling

3D GRAPHICS. design. animate. render

3D Transformations. CS 4620 Lecture 10. Cornell CS4620 Fall 2014 Lecture Steve Marschner (with previous instructors James/Bala)

Overview. Animation is a big topic We will concentrate on character animation as is used in many games today. humans, animals, monsters, robots, etc.

Advanced Computer Graphics Transformations. Matthias Teschner

CS 428: Fall Introduction to. Transformations in OpenGL + hierarchical modeling. Andrew Nealen, Rutgers, /21/2009 1

Hi. I m a three. I m always a three. I never ever change. That s why I m a constant.

Animation Essentially a question of flipping between many still images, fast enough

Rotational Joint Limits in Quaternion Space. Gino van den Bergen Dtecta

Answers. Chapter 2. 1) Give the coordinates of the following points:

Game Mathematics. (12 Week Lesson Plan)

When you move an (unparented and unrotated) item in Layout, generally your mouse movements have the following effects:

Use Parametric notation. Interpret the effect that T has on the graph as motion.

Math background. 2D Geometric Transformations. Implicit representations. Explicit representations. Read: CS 4620 Lecture 6

Transcription:

3D Rotation: more than just a hobby Eric Yang s special talent is the mental rotation of threedimensional objects. Mental rotation is Yang s hobby. I can see textures and imperfections and the play of light and shadows on the objects I rotate, too, Yang says. David Foster Wallace

Outline Rotation from Mouse Event in VTK Projects 2A / 2B Other options Rotation Concepts There s going to be math. I think it will be fun. There won t be any math. It will be a blast! Applications Optional: Gimbal Lock References

Outline Rotation from Mouse Event in VTK Projects 2A / 2B Other options Rotation Concepts There s going to be math. I think it will be fun. There won t be any math. It will be a blast! Applications Optional: Gimbal Lock References

VTK Camera Frame: v1 = position focus v2 = up v3 = up x v1 Label the center of the window (0, 0). Observe click at (w, h) in window. Let f be a factor based on zoom. Rotate camera f * w degrees around v2 and f * h degrees around v3. DEMO

VTK We can implement a different interaction style: Call the center of the window (0, 0). Mouse click down at (w1, h1) in window. Mouse click release at (w2, h2) in window. dw = w2 w1, dh = h2 h1. Let f be a factor based on zoom. Rotate camera actor f * dw degrees around up and f * dh degrees around up cross view. DEMO

VTK VTK calls this version the joystick interaction style. We applied the transformation to the camera. VTK calls this version the trackball interaction style. We applied the transformation to the actor. Can you have joystick interaction style with actor transformation? Yes! Can you write your own interaction style? Yes!

VTK Camera Frame: v1 = position focus v2 = up v3 = up x v1 What if you want to rotate around v1? YOU CAN T! Mouse click gives (w, h) position on window. No way to get three independent pieces of information (rotation about each axis) from two.

Outline Rotation from Mouse Event in VTK Projects 2A / 2B Other options Rotation Concepts There s going to be math. I think it will be fun. There won t be any math. It will be a blast! Applications Optional: Gimbal Lock References

From VTK to Concepts How does VTK store and apply rotations? We ve been working with matrices: DEMO Actually, VTK will try to save space and only compute and cache the matrix representation on demand. We will see different ways to store a rotation in a moment First, an interesting question: why not just use three values rotation about x, y, and z and update these to produce any rotation?

Euler Angles Euler s Rotation Theorem (pt 1): any rotation can be represented as rotations about the coordinate axes This is less complicated than the full rotation matrix. Why don t we just do this? DEMO It doesn t work in general. See the optional section on Gimbal Lock. However... if your application doesn t hit these bad angles and you really, really care about performance, this could be the way to go. See this video for an example in Autodesk Maya: link People in the twenty-first century are developing complex software. People in the eighteenth century developed complex hats.

Matrix Representation This is what we have been using. Pros: No bad rotations! Can easily handle translation and scaling Cons: 16 doubles to store 4x4 matrix Multiplication is kind of slow can be compressed can be optimized http://xkcd.com/184/

Axis-Angle Representation Euler s Rotation Theorem (pt 2): any 3D rotation can be represented as a single rotation around some vector. Pros: Sometimes useful to conceptualize a transformation this way. Cons: How do you actually implement it? How do you multiply two of these? (You need trig functions. It s slow.) An API usually has methods that will accept rotations in this form. (Under the hood: the transformation is likely converted to some other form before being applied, but the user doesn t have to care.)

Quaternion Representation Any 3D rotation can be described by a 4-tuple called a quaternion. Pros: Only need to store four doubles. Multiplication is faster than matrices. Renormalizing (due to floating point precision loss) is faster than matrices. Methods for interpolating quaternions. Cons: Applying the transformation to geometry is slower than matrices. Related to axis-angle form, but not as easy to directly visualize. Here as he walked by on the 16 th of October 1843 Sir William Rowan Hamilton in a flash of genius discovered the fundamental formula for quaternion multiplication i^2 = j^2 = k^2 = ijk = -1 & cut it on a stone of this bridge

Outline Rotation from Mouse Event in VTK Projects 2A / 2B Other options Rotation Concepts There s going to be math. I think it will be fun. There won t be any math. It will be a blast! Applications Optional: Gimbal Lock References

Applications Animation: could be lots of tiny transformations, matrix renormalization (orthogonalization) will be slow, want to use quaternions Robotics: the robot s sensors need to communicate with each other about their orientation in world space Camera Calibration: noisy readings from camera need to be averaged (s)lerping quaternions!

Outline Rotation from Mouse Event in VTK Projects 2A / 2B Other options Rotation Concepts There s going to be math. I think it will be fun. There won t be any math. It will be a blast! Applications Optional: Gimbal Lock References

Gimbal Lock Gimbal: A mechanical device for rotation. Widely used in navigation, robotics, photography, etc. Actually need four gimbals to guarantee three degrees of freedom under any circumstances!

Gimbal Lock Can represent axis rotations using matrices: X: [ 1 0 0 ] [ 0 cos(a) -sin(a) ] [ 0 sin(a) cos(a) ] Y: [ cos(b) 0 sin(b) ] [ 0 1 0 ] [ -sin(b) 0 cos(b) ] Z: [ cos(c) -sin(c) 0 ] [ sin(c) cos(c) 0 ] [ 0 0 1 ] Let b = 90: Y: [ 0 0 1 ] [ 0 1 0 ] [ -1 0 0 ] Suppose rotation order is XYZ: XYZ: [ 0 0 1 ] [ sin(a + c) cos(a + c) 0 ] [ -cos(a + c) sin(a + c) 0 ] change in either angle a or angle c has exact same effect!! (not good)

Gimbal Lock Solved Can represent axis rotations using matrices: X: [ 1 0 0 ] [ 0 cos(a) -sin(a) ] [ 0 sin(a) cos(a) ] Y: [ cos(b) 0 sin(b) ] [ 0 1 0 ] [ -sin(b) 0 cos(b) ] Z: [ cos(c) -sin(c) 0 ] [ sin(c) cos(c) 0 ] [ 0 0 1 ] R1: a = 0, b = 90, c = 0 R1: [ 0 0 1 ] [ 0 1 0 ] [ -1 0 0 ] R2: a free, b = 0, c free R2: [ cos(c) -sin(c) 0 ] [ cos(a)sin(c) cos(a)cos(c) -sin(a) ] [ sin(a)sin(c) sin(a)cos(c) cos(a) ] R2 R1: [ 0 -sin(c) cos(c) ] [ sin(a) cos(a)cos(c) cos(a)sin(c) ] [ -cos(a) sin(a)cos(c) sin(a)sin(c) ] This works fine! The variables a and c are independent and this produces the desired transformation. This works because we use two full rotation matrices for the transformation.

Outline Rotation from Mouse Event in VTK Projects 2A / 2B Other options Rotation Concepts There s going to be math. I think it will be fun. There won t be any math. It will be a blast! Applications Optional: Gimbal Lock References

References VTK Examples: http://www.vtk.org/wiki/vtk/examples lots of great VTK starter code Lecture Demos: http://ix.cs.uoregon.edu/~hampton2/graphics/ Great book for learning more about the mathematical structure of rotations (and lots of other fun stuff): Algebra, Michael Artin The excerpt on the title page is from a story in Brief Interviews with Hideous Men, David Foster Wallace, pp. 196 199. It s a great book!