Interpolating/approximating pp gcurves

Similar documents
Computer Animation. Rick Parent

Splines. Parameterization of a Curve. Curve Representations. Roller coaster. What Do We Need From Curves in Computer Graphics? Modeling Complex Shapes

Fall CSCI 420: Computer Graphics. 4.2 Splines. Hao Li.

3D Modeling Parametric Curves & Surfaces. Shandong University Spring 2013

3D Modeling Parametric Curves & Surfaces

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

3.3 Interpolation of rotations represented by quaternions

Design considerations

Know it. Control points. B Spline surfaces. Implicit surfaces

Parametric curves. Brian Curless CSE 457 Spring 2016

Fundamentals of Computer Animation

Animation Curves and Splines 2

Parametric curves. Reading. Curves before computers. Mathematical curve representation. CSE 457 Winter Required:

Sung-Eui Yoon ( 윤성의 )

CS130 : Computer Graphics Curves. Tamar Shinar Computer Science & Engineering UC Riverside

Parametric Curves. University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell

CGT 581 G Geometric Modeling Curves

Parametric Curves. University of Texas at Austin CS384G - Computer Graphics

Animation. Computer Graphics COMP 770 (236) Spring Instructor: Brandon Lloyd 4/23/07 1

Curve and Surface Basics

2D Spline Curves. CS 4620 Lecture 13

Central issues in modelling

The goal is the definition of points with numbers and primitives with equations or functions. The definition of points with numbers requires a

Introduction to Computer Graphics

COMPUTER AIDED ENGINEERING DESIGN (BFF2612)

Splines. Connecting the Dots

Freeform Curves on Spheres of Arbitrary Dimension

08 - Designing Approximating Curves

A Curve Tutorial for Introductory Computer Graphics

In this course we will need a set of techniques to represent curves and surfaces in 2-d and 3-d. Some reasons for this include

Animation. Animation

Lecture IV Bézier Curves

Trajectory planning in Cartesian space

Computer Graphics Curves and Surfaces. Matthias Teschner

Curves D.A. Forsyth, with slides from John Hart

Spline Notes. Marc Olano University of Maryland, Baltimore County. February 20, 2004

2D Spline Curves. CS 4620 Lecture 18

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

Computer Animation Fundamentals. Animation Methods Keyframing Interpolation Kinematics Inverse Kinematics

Manipulator trajectory planning

Curve Representation ME761A Instructor in Charge Prof. J. Ramkumar Department of Mechanical Engineering, IIT Kanpur

Geometric Modeling of Curves

CS130 : Computer Graphics Curves (cont.) Tamar Shinar Computer Science & Engineering UC Riverside

Curves and Surfaces Computer Graphics I Lecture 9

Curves. Computer Graphics CSE 167 Lecture 11

Quaternions and Rotations

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

Spline Curves. Spline Curves. Prof. Dr. Hans Hagen Algorithmic Geometry WS 2013/2014 1

The Three Dimensional Coordinate System

Bezier Curves, B-Splines, NURBS

COMP3421. Global Lighting Part 2: Radiosity

Information Coding / Computer Graphics, ISY, LiTH. Splines

City Research Online. Permanent City Research Online URL:

Lecture 9: Introduction to Spline Curves

TO DUY ANH SHIP CALCULATION

Friday, 11 January 13. Interpolation

Curves and Surfaces Computer Graphics I Lecture 10

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

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

Reading. Parametric surfaces. Surfaces of revolution. Mathematical surface representations. Required:

Prof. Fanny Ficuciello Robotics for Bioengineering Trajectory planning

Curves and Surface I. Angel Ch.10

Interactive Graphics. Lecture 9: Introduction to Spline Curves. Interactive Graphics Lecture 9: Slide 1

Computer Graphics CS 543 Lecture 13a Curves, Tesselation/Geometry Shaders & Level of Detail

Essential Mathematics for Computational Design

Intro to Curves Week 1, Lecture 2

CSE 167: Introduction to Computer Graphics Lecture #11: Bezier Curves. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2016

Math (Spring 2009): Lecture 5 Planes. Parametric equations of curves and lines

Until now we have worked with flat entities such as lines and flat polygons. Fit well with graphics hardware Mathematically simple

CS 536 Computer Graphics Intro to Curves Week 1, Lecture 2

Visual Recognition: Image Formation

COMPUTER AIDED GEOMETRIC DESIGN. Thomas W. Sederberg

Objects 2: Curves & Splines Christian Miller CS Fall 2011

Curves and Surfaces. CS475 / 675, Fall Siddhartha Chaudhuri

Representing Curves Part II. Foley & Van Dam, Chapter 11

Computer Animation 4-Motion Control SS 13

Advanced Computer Graphics Transformations. Matthias Teschner

Quaternion Interpolation

Background for Surface Integration

PS Geometric Modeling Homework Assignment Sheet I (Due 20-Oct-2017)

Quaternions and Exponentials

Robots are built to accomplish complex and difficult tasks that require highly non-linear motions.

For each question, indicate whether the statement is true or false by circling T or F, respectively.

ECE 600, Dr. Farag, Summer 09

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

Curves and Surfaces. Shireen Elhabian and Aly A. Farag University of Louisville

Fathi El-Yafi Project and Software Development Manager Engineering Simulation

(Discrete) Differential Geometry

(Spline, Bezier, B-Spline)

CSE 167: Introduction to Computer Graphics Lecture 12: Bézier Curves. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2013

Computer Graphics. Curves and Surfaces. Hermite/Bezier Curves, (B-)Splines, and NURBS. By Ulf Assarsson

CSE 167: Introduction to Computer Graphics Lecture #13: Curves. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2017

Curves and Surfaces 1

Physically-Based Modeling and Animation. University of Missouri at Columbia

Intro to Modeling Modeling in 3D

Curves and Curved Surfaces. Adapted by FFL from CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

Computer Graphics Splines and Curves

Quaternions and Rotations

Homework #2. Hidden Surfaces, Projections, Shading and Texture, Ray Tracing, and Parametric Curves

GEOMETRIC TOOLS FOR COMPUTER GRAPHICS

Transcription:

Chap 3 Interpolating Values 1

Outline Interpolating/approximating pp gcurves Controlling the motion of a point along a curve Interpolation of orientation Working with paths

Interpolation between key frames Parameters to be interpolated Position of an object Normal Joint angle between two joints Transparency attribute of an object 3

Interpolation between key frames Interpolation between frames is not trivial Appropriate interpolating function Parameterization ti of fthe function Maintain the desired control of the interpolated values over time Example (-5,0,0) at frame, (5,0,0) art frame 67 Stop at frame and accelerate to reach a max speed by frame 34 Start to decelerate at frame 50 and come to a stop at frame 67 4

Interpolation between key frames desired result undesired result Need a smooth interpolation with user control 5

Interpolation between key frames Solution Generate a space curve Distribute points evenly along curve Speed control: vary points temporally B A Time = 10 Time = 0 C Time = 35 6 D Time = 60

Interpolation functions Interpolation vs. approximation Interpolation Hermite, Catmull-Rom approximation Bezier, B-spline 7

Interpolation functions Complexity => computational efficiency Polynomials Lower than cubic No inflection point, may not fit smoothly to some data points Higher than cubic Doesn t provide any significant advantages, costly to evaluate Piecewise cubic Provides sufficient smoothness Allows enough flexibility to satisfy constraints such as end- point position and tangents 8

Interpolation functions Continuity within a curve Zero-order First order (tangential) Suffices for most animation applications Second order Important when dealing with time-distance curve Continuity between curve segments Hermite, Ct Catmull-Rom, llr cubic Bezier provide first order continuity between segments 9

Interpolation functions 10

Continuity position tangent curvature none (0th order) (1st order) (nd order) At junction of two circular arcs 11

Interpolation functions Global vs. local control 1

Types of Curve Representation Explicit y = f(x) Good for generate points For each input, there is a unique output Implicit f(x,y) = 0 Good for testing ti if a point is on a curve Bad for generating a sequence of points Parametric x = f(u), y = g(u) Good for generating a sequence of points Can be used for multi-valued function of x 13

Example: Representing Unit Circle Cannot be represented explicitly as a function of x f>0 f=0 Implicit form: f<0 f(x,y)=x +y =1 Parametric form: x=cos(u), y=sin(u), 0<u<π u 14

More on 3-D Parametric Curves Parametric form: P(u) = (P x (u), P y (u), P z (u)) x = P x x( (u), y = P y y( (u), z = P z z( (u) u=0.00 u=/3 u=1/3 u=1.0 Space-curve P = P(u) 0.0 <=u<=1.0 15

Polynomial Interpolation An n-th degree polynomial fits a curve to n+1 points Example: fit a second degree curve to three points y(x)= a x + b x + c points to be interpolated (x 1,y 1 ), (x,y ), (x 3,y 3 ) solve for coefficients (a, b, c): 3 linear equations, 3 unknowns called Lagrange Interpolation 16

Polynomial Interpolation (cont.) Result is a curve that is too wiggly, change to any control point affects entire curve (nonlocal) this method is poor We usually want the curve to be as smooth as possible minimize the wiggles high-degree g polynomials are bad Higher degree, higher the wiggles 17

Composite Segments Divide a curve into multiple segments Represent each in a parametric form Maintain continuity between segments position Tangent (C1-continuity vs. G1-continuity) curvature P 1 (u) P (u) P 3 (u) P n (u) 18

Splines: Piecewise Polynomials A spline is a piecewise polynomial - many low degree polynomials are used to interpolate (pass through) the control points Cubic polynomials are the most common lowest order polynomials that interpolate two points and allow the gradient at each point to be defined - C1 continuity is possible Higher or lower degrees are possible, of course 19

A Linear Piecewise Polynomial The simple form for interpolating two points. p1 Each segment is of the form: (this is a vector equation) p p ( u) = up1 + (1 u) p 1 u Two basis (blending) functions 0 1 u 0

Hermite Interpolation Hermite Curves cubic polynomial for two points 3 P ( u) = au + bu + cu + P ( u ) = ( Px ( u ), Py ( u ), Pz ( u )) Hermite interpolation requires Endpoint positions derivatives at endpoints P(0) d control points/knots P(1) P '(0) P' (1) To create a composite curve, use the end of one as the beginning gof the other and share the tangent vector 1

Hermite Curve Formation Cubic polynomial and its derivative 3 P ( u) = a u + b u + c u + x x x ' P ( u ) = 3a u + b u + c x x x x x d x Given P x (0), P x (1), P x (0), P x (1), solve for a, b, c, d 4 equations are given for 4 unknowns P (0) = P + P = P + x d x x (1) = ax + bx + cx d x ' x(0) c x ' x(1) = 3a x + bx cx

Hermite Curve Formation (cont.) Problem: solve for a, b, c, d Solution: P (0) = P + P = P + a b c x d x x (1) = ax + bx + cx d x ' x(0) c x ' x(1) = 3a x + bx cx x x x = = = ( P 3( P P ' x x x (0) d x = P x (0) (0) (1) 3 P P x x (1)) (0)) + P ' x P (0) ' x + (0) P ' x P (1) ' x (1)

Hermite Curves in Matrix Form 3 P ( u ) = au + bu + cu + d P( u) = U T = [ u M is B is U 3, T u MB, u,1] is the coefficient matrix the parameter the geometric information P x (0) P x(1) B = ' P x(0) 1 ' Px (1) 1 1 3 3 1 M = 0 0 1 0 0 0 0 4 ith segment in composite curves Pi P i+ B = ' Pi ' 1 P i + 1

Blending Functions of Hermite Splines Blending Functions of Hermite Splines Each cubic Hermite spline is a linear combination of p 4 blending functions geometric information M B U P T ) ( 3 1 3 M B U u P T ) ( = + + 1 3 3 3 1 3 ) ( p p u u u u + = 1 3 3 ' ' ) ( p p u u u u p 5 3 p u u

Composite Hermite Curve Continuity between connected segments is ensured by using ending tangent vector of one segment as the beginning i tangent tvector of fthe next. 6

Bezier Curves Similar to Hermite Curve Instead of endpoints and tangents, four control points are given points P1 and P4 are on the curve points P and P3 are used to control the shape p 1 = P1, p = P4, p 1 ' = 3(P-P1), p ' = 3(P4 - P3) p( u) = [ 1] 3 u u u 1 3 3 1 P1 3 6 3 0 P 3 3 0 0 P3 1 0 0 0 P4 7

Bezier Curves Another representation Blend the control point position using Bernstein polynomials p( u) = n k = 0 B n where k, B k B k ( u), n( u) P k, n( u) = C( n, k) u (1 u) C( n, k) = n! k!( n k are Bernstein polynomials k)! n k 8

Bezier Curves 9

Composite Bezier Curves How to control the continuity between adjacent Bezier segment? 30

De Casteljau Construction of Bezier Curves How to derive a point on a Bezier curve? 31

Bezier Curves (cont.) Variant of the Hermite spline basis matrix derived from the Hermite basis (or from scratch) Gives more uniform control knobs (series of points) than Hermite Scale factor (3) is chosen to make velocity approximately constant 3

Catmull-Rom Splines With Hermite splines, the designer must arrange for consecutive tangents to be collinear, to get C 1 continuity. Similar for Bezier. This gets tedious. Ct Catmull-Rom: llr an interpolating ti cubic spline with built-in C 1 continuity. Compared to Hermite/Bezier: fewer control points required, but less freedom. 33

Catmull-Rom Splines (cont.) Given n control points in 3-D: p 1, p,, p n, Tangent at p i given by s(p i+1 p i-1 ) for i=..n-1, for some s. Curve between p i and p i+1 is determined by p i-1, p i, p i+1,p i+. 34

Catmull-Rom Splines (cont.) Given n control points in 3-D: p 1, p,, p n, Tangent at p i given by s(p i+1 p i-1 ) for i=..n-1, for some s Curve between p i and p i+1 is determined by p i-1, p i, p i+1, p i+ What about endpoint tangents? (several good answers: extrapolate, t or use extra control points p 0, p n+1 ) Now we have positions and tangents at each knot a Hermite specification. 35

Catmull-Rom Spline Matrix Derived similarly to Hermite and Bezier s is the tension parameter; typically s=1/ When s p ( u ) = U = 1/, T 1 1 0 3 5 0 3 4 1 0 P i 11 1 i 1 Pi 0 Pi + 0 P i+ + 1 36

Catmull-Rom Spline What about endpoint tangents? Provided by users Several good answers: extrapolate, or use extra control points p 0, p n+1 P 1 = (( P1 ( P 1 = (P P ' 0 P1 )) P0 1 P0 ) ) 37

Catmull-Rom Spline Example 38

Drawback Catmull-Rom Spline An internal tangent is not dependent on the position of the internal point relative to its two neighbors 39

p(0) = P p (0) = s(p3 P1) p(0) = P, p (0) = s(p3-p1), p(1) = P3, p (1) = s(p4-p) 1 0 1 0 0 0 0 1 0 1 3 3 1 1 ) ( P P U T = 4 3 0 0 0 0 0 0 0 1 0 1 0 0 ) ( P P s s s s U u p T 4 1 P P s s s s = 3 0 0 3 3 P P P s s s s s s U T 40 4 0 0 1 0 P

Splines and Other Interpolation Forms See Computer Graphics textbooks Review Appendix B.4 in Parent 41

Now What? We have key frames or points We have a way to specify the space curve Now we need to specify velocity to traverse the curve Speed Curves 4

Speed Control The speed of tracing a curve needs to be under the direct control of the animator Varying u at a constant t rate will not necessarily generate P(u) at a constant speed. 43

Non-uniformity in Parametrization Generally, equally spaced samples in parameter space are not equally spaced along the curve u u s( u ) s ( ) 1 ( u1 B s ( u ) = Px ( u ) + Py ( u ) + Pz ( u ) du A Time = 10 Time = 0 C Time = 35 D 44 Time = 60

Arc Length Reparameterization To ensure a constant speed for the interpolated value, the curve has to be parameterized a e ed by arc length (for most applications) Computing arc length Analytic method (many curves do not have, e.g., B- splines) Numeric methods Table and differencing Gaussian quadrature 45

Arc Length Reparameterization Space curve vs. time-distance function Relates time to the distance traveled along the curve, i.e., Relates time to the arc length along the curve 46

Arc Length Reparameterization Given a space curve with arc length parameterization Allow movement along the curve at a constant speed by stepping at equal arc length intervals Allows acceleration and deceleration along the curve by controlling the distance traveled in a given time interval Problems Given a parametric curve and two parameter values u 1 and u, find arclength(u 1,u ) Given an arc length s, and parameter value u 1, find u such that arclength(u 1,u ) = s 47

Arc Length Reparameterization Converting a space curve P(u) to a curve with arc-length ac parameterization a e a Find s=s(u), and u=s -1 (s)=u(s) P*(s)=P(U(s)) P(U( )) Analytic arc-length parameterization is difficult or impossible for most curves, e.g., B- spline curve cannot be parameterized with arc length. Approximate arc-length parameterization ti 48

Forward Differencing Sample the curve at small intervals of the parameter Compute the distance between samples Build a table of arc length for the curve u Arc Length 0.0 0.00 0.1 0.08 0. 0.19 0.3 0.3 0.4 0.45 49

Arc Length Reparameterization Using Forward Differencing Given a parameter u, find the arc length Find the entry in the table closest to this u Or take the u before and after it and interpolate arc length linearly u Arc Length 0.0 0.00 0.1 0.08 0. 0.19 0.3 0.3 0.4 0.45 50

Arc Length Reparameterization Using Forward Differencing Given an arc length s and a parameter u 1, find the parametric value u such that arclength(u 1, u )=s Find the entry in the table u Arc Length 0.0 0.00 closest to this u using 0.1 0.08 binary search 0. 0.19 Or take the u before and after 0.3 0.3 it and interpolate t linearly l 0.4 0.45 51

Arc Length Reparameterization Using Forward Differencing Easy to implement, intuitive, and fast Introduce errors Super-sampling in forming table 1000 equally spaced parameter values + 1000 ebtries in each interval Better interpolation Adaptive forward differencing 5

Arc Length Reparameterization Using Adaptive forward differencing 53

Arc Length Reparameterization Using Arc length integral Numerical Integral s( u) = Px ( u) + Py ( u) + Pz ( u) du Simpson s and trapezoidal integration using evenly spaced intervals Gaussian quadrature using unevenly spaced intervals 54

Speed Control Given a arc-length parameterized space curve, how to control o the speed at which the curve is traced? By a speed-control functions that relate an equally spaced time interval to arc length Input time t, output t arc length: s=s(t) Linear function: constant speed control Most common: ease-in/ease-out Smooth motion from stopped position, accelerate, reach a max velocity, and then decelerate to a stop position 55

Speed Control Function Relates an equally spaced time interval to arc length Input time t, output arc length: s=s(t) Normalized arc length parameter s=ease(t) Start at 0, slowly increase in value and gain speed until the middle value and then decelerate as it approaches to 1. 56

Constant Velocity Speed Curve Moving at 1 m/s if meters and seconds are the units Too simple to be what we want 57

Distance Time Function and Speed Control We have a space curve p=p(u) and a speed control o function s=s(t). For a given t, s=s(t) Find the corresponding value u=u(s) by looking up an arc length table for a given s A point on the space curve with parameter u p=p(u(s(t))) ( ( 58

Speed Control P(u( * ) u* Arc Length Table u Arc Length 0.0 0.00 0.1 0.08 0. 0.19 s* 0.3 0.3 0.4 0.45 Speed Control Curve t* 59

Distance Time Function Assumptions on distance time function The entire arc length of the curve is to be traversed during the given total time Additional optional assumptions The function should be monotonic in t The function should be continuous 60

Ease-in/Ease-out Most useful and most common ways to control motion o along acurve Arc length (distance) Time Equally spaced samples in time specify arc length required for that t frame 61

s Ease-in/Ease-out Sine Interpolation 1 π 1 = ease( t) = sin ( tπ ) +, 0 t 1 1 π/ π/ Arc Length -1 sin( α), π α π Time 6

Ease-in/Ease-out Sine Interpolation The speed of s w.r.t. t is never constant over an interval but rather is always accelerating e a or decelerating. Zero derivatives at t=0 and t=1 indicating smooth accelerating and deceleration at end points. 63

Ease-in/Ease-out Piecing i Curves Together for Ease In/Out Arc Length Linear segment Time Sinusoidal segments 64

Ease-in/Ease-out Piecing i Curves Together for Ease In/Out 65

Ease-in/Ease-out Integrating to avoid the sine function acceleration A velocity Find v such that area = 1 v time D t 1 t arc length t 1 t V 1 = V A*t 1 = - D*(1-t ) time time 66

Ease-in/Ease-out Integrating to avoid the sine function To avoid the transcendental function evaluation while providing a constant speed interval between ease-in and ease-out intervals Acceleration-time time curve Velocity-time curve Velocity-time curve is defined by integral of the acceleration-time curve Distance-time curve is defined by integral of the velocity-time curve 67

Ease-in/Ease-out Integrating to avoid the sine function In ease-in/ease-out function Velocity starts out at 0 and ends at 0 V 1 = V inplies A*t 1 = - D*(1-t ) 68

Ease-in/Ease-out Integrating to avoid the sine function Total distance = 1 implies 1 = ½ V 0 t + V 0 (t -t 1 )+1/ V 0 (1-t ) Users specifies any two of three variables t 1, t, and V 0, and the system can solve for the third 69

Ease-in/Ease-out Integrating to avoid the sine function The result is Parabolic ease-in/ease-out More flexible than the sinusoidal ease-in/ease-out 70

Videos Bunny (Blue Sky Studios, 1998) 71

q Review - Quaternions Similar to axis-angleangle representations 4-tuple of real numbers q=(s, x, y, z) or [s, v]s is a scalar; v is a vector The quaternion for rotating an angle about an axis (an axis-angle rotation): = Rot ( θ,( a, a, a )) x y θ θ = cos( ),sin( ) ( ax, ay, az ) If a is unit length, then q will be also z Y Z a=(a x, a y, a z ) θ X Animation(U), Chap, Tech. Background 7

Review - Quaternions Review Quaternions If a is unit length, then q will be also 3 1 0 + + + = q q q q q sin sin sin cos + + + = θ θ θ θ z y x a a a ( ) sin cos + + + = θ θ y a a a ( ) sin cos + + + = θ θ θ θ z y x a a a sin cos sin cos + = + = θ θ θ θ a Animation(U), Chap, Tech. Background Animation(U), Chap, Tech. Background 73 1 =1 =

Review - Quaternions Rotating some angle around an axis is the same as rotating the negative angle around the negated axis θ θ Rot θ, ( x, y, z) = cos( ), sin( )( x, y, z) = q Animation(U), Chap, Tech. Background 74

Addition Review - Quaternion Math [ s, v ] + [ s, v ] = [ s + s, v + v ] Multiplication 1 1 1 [ s, v ][ s, v ] = [ s s v v, s v + s v + v v ] 1 1 1 Multiplication is associative but not commutative 1 1 1 1 1 q ( = q 1 qq3) ( q1q ) 3 q 1q qq1 Animation(U), Chap, Tech. Background 75

Review - Quaternion Math (cont.) Multiplicative identity: [1, 0,0,0] Inverse [ 1, 0, 0, 0 ] q q = [ ] 1 s, v 1 q = qq 1 = [ 1, 0, 0, 0 ] q qq 1 = Normalization for unit quaternion [ 1, 0, 0, 0] Normalization for unit quaternion ) q q = ) qq q = q q = s + x + y + z z q = s + x + y + Animation(U), Chap, Tech. Background 76

Review Rotating Vectors Using Quaternion A point in space, v, is represented as [0, v] To rotate a vector v using quaternion q Represent the vector as v = [0, v] Represent the rotation as a quaternion q Using quaternion multiplication v' = Rot ( v) = qvq q The proof isn t that hard Note that tthe result v always has zero scalar value 1 Animation(U), Chap, Tech. Background 77

Review - Compose Rotations Rotating a vector v by first quaternion p followed by a quaternion q is like rotation using qp Rot ( Rot ( v )) = q p = = Rot q qpvp p ( pvp 1 1 q ( qp) v( qp) = Rot qp (v) 1 ) 1 Animation(U), Chap, Tech. Background 78

Review - Compose Rotations To rotate a vector v by quaternion q followed by its inverse quaternion q -1 Rot 1 ( Rot ( v )) = Rot 1 q q = = q v 1 q qvq qq ( qvq 1 q 1 ) Animation(U), Chap, Tech. Background 79

Review - Quaternion Interpolation A quaternion is a point on a 4D unit sphere Unit quaternion: q=(s,x,y,z), q = 1 Form a subspace: a 4D sphere Interpolating quaternion means moving between two points on the 4D unit sphere A unit quaternion at each step another point on the 4D unit sphere Move with constant angular velocity along the greatest circle between the two points on the 4D unit sphere Animation(U), Chap, Tech. Background 80

Review - Linear Interpolation Linear interpolation generates unequal spacing of points after projecting to circle Animation(U), Chap, Tech. Background 81

Review Spherical Linear Interpolation (slerp) Want equal increment along arc connecting two quaternion on the spherical surface Spherical linear interpolation (slerp) sin((1 u) θ ) slerp q, q, u) = q1 + sin θ sin( uθ ) sin θ ( 1 q 1 where u goes from 0 to1andθ = cos ( q1 q Normalize to regain unit quaternion ) Animation(U), Chap, Tech. Background 8

Review Spherical Linear Interpolation (slerp) Let q = α q1 + βq We can solve for given : q = 1, q 1 q = θ, q1 q to give = u θ sin((1 u) θ ) sin( uθ ) slerp( q1, q, u) = q1 + q sin θ sin θ Animation(U), Chap, Tech. Background 83

Review Spherical Linear Interpolation (slerp) q 1 q > 0 q 1 q q Animation(U), Chap, Tech. Background 84

Review Spherical Linear Interpolation (slerp) Recall that q and q represent same rotation What is the difference between: Slerp(u, q 1, q ) and Slerp(u, q 1, -q )? One of these will travel less than 90 degrees while the other will travel more than 90 degrees across the sphere This corresponds to rotating the short way or the long way Usually, we want to take the short way, so we negate one of them if their dot product is < 0 Animation(U), Chap, Tech. Background 85

Review Spherical Linear Interpolation (slerp) If we have an intermediate position q, the interpolation from q 1 -->q -->q 3 will not necessarily follow the same path as the interpolation from q 1 to q 3. Animation(U), Chap, Tech. Background 86

Interpolating a Series of Quaternions As linear interpolation in Euclidean space, we can have first order discontinuity problem when interpolating a series of orientations. Need a cubic curve interpolation to maintain first order continuity in Euclidean space Similarly, slerp can have 1st order discontinuity We also need a cubic curve interpolation in 4D spherical space for 1st order continuity 87

Interpolating a Series of Quaternions Interpolated points [, p n-1, p n, p n+1,.]in3d Between each pair of points, two control points will be constructed. e.g., For p n a n : the one intermediate after p n b n : the one immediately before p n p n +(p n -p n-1 ) Take average 88

Interpolating a Series of Quaternions Interpolated points [, p n-1, p n, p n+1,.] in 3D Between each pair of points, two control points will be constructed. e.g., For p n a n : the one intermediate after p n b n : the one immediately before p n b n= p n +(p n -a n ) 89

Interpolating a Series of Quaternions Interpolated points [, p n-1, p n, p n+1,.] in 3D End conditions 90

Interpolating a Series of Quaternions Interpolated points [, p n-1, p n, p n+1,.] in 3D Between any interpolated points p n and p n+1, a cubic Bezier curve segment is defined by p n, a n, b n+1, and p n+1 91

Interpolating a Series of Quaternions How to evaluate a point on Bezier curve? De Casteljau Construction Constructing Bezier curve by multiple linear interpolation u=1/3 p(1/3) 9

Interpolating a Series of Quaternions Animation: See http://en.wikipedia.org/wiki/file:bezier_3_big.gif gif 93

Interpolating a Series of Quaternions Bezier interpolation on 4D sphere? How are control points generated? How are cubic Beziers defined? Control points are automatically ti generated as it is not intuitive to manually adjust them on a 4D sphere Derive Bezier curve points by iteratively subdivision s on p n, a n, b n+1, and p n+1 94

Interpolating a Series of Quaternions Connecting Segments on 4D Sphere Automatically generating interior (spherical) control points b n = double( an, qn) b n q n q n a n. Bisect the span Bi sect( q' n, q n+ 1 ) = q' q' n n + q + q n+ 1 n+ 1 q n+1 q n-1 1. Double the arc q ' n = double q ( qn 1, qn ) = ( qn 1 qn ) qn qn 1 95

Interpolating a Series of Quaternions De Casteljau Construction on 4D Sphere p 1 = slerp(q n,a n, 1 3) p = slerp(a n,b n +1, 1 3) p 3 = slerp(b n +1,q n +1, 1 3) p = slerp(p 1 1 1, p, 3) 3 u=1/3 p 1 a n p P(1/3) b n+1 p 3 p 3 = slerp(p, p 3, 1 3) p = slerp(p 1, p 3, 1 3) q n q n+1 96

Path Following Issues about path following Arc length parameterization and speed control Changing the orientation Smoothing a path Path along a surface 97

Orientation Along a Curve A local coordinate system (u, v, w) is defined for an object to be animated a Position along the path P(s), denoted as POS w-axis: the direction the object tis facing v-axis: up vector u-axis: perpendicular to w and v (u, v, w): a right-handed coordinate system 98

Orientation Along a Curve 99

Orientation Along a Curve Frenet Frame Frenet frame: a moving coordinate system determined by curve tangent and curvature w = P '( s ) u = P"( s) v = u w P'( s) 100

Problems Orientation Along a Curve Frenet Frame No concept of up vector Is undefined in segments that has no curvature; i.e., P (u)=0 Can be dealt with by interpolating a Frenet frame from the Frenet frames at segment s boundary, which differ by only a rotation around w A discontinuity in the curvature vector Frenet frame has a discontinuous jump in orientation Resulting motions are usually too extreme and not natural looking 101

Orientation Along a Curve Frenet Frame 10

Orientation Along a Curve Frenet Frame 103

Orientation Along a Curve Camera Path Following COI: center of interest A fixed point in the scene Center point of an object in the scene Points along the path itself Points on a separate path in the scene Points on the interpolation between points in the scene w = COI POS u = w y_axis w = C ( s ) P ( s ) w = C ( s ) P ( s ) u = w y_axis u = w ( U ( s) P( s)) v = u w v = u w v = u w 104

Smoothing a Path with Linear Interpolation Two points on either sides of a point are averaged, and this point is averaged with the original point. Repeated application P + P + P i 1 i+ 1 i 1 1 1 P' i = = P i 1 + P i + P i+ 1 4 4 105

Smoothing a Path with Linear Interpolation 106

Smoothing a Path with Cubic Interpolation Four points on either sides of a point are fitted by a cubic curve, and the midpoint of the curve is averaged with the original point. 3 P ( u ) = au + bu + cu + d P i = P (0) = i d 1 1 1 Pi 1 = P(1/ 4) = a + b + c + d 64 16 4 7 9 3 P i + 1 = P(3/ 4) = a + b + c + d 64 16 4 P i = P(1 = a + b + c + d + ) 107

Smoothing a Path with Cubic Interpolation 108

Smoothing a Path with Cubic Interpolation 109

Determine a Path on a Surface If one object is to move across the surface of another object, we need to specify a path across the surface. Given start and destination points Find a shortest path between the points expensive Determine a plane that contain two points and dis generally perpendicular to the surface (averaged normal of two points) Intersection of the plane with the surface (mesh) 110

Determine a Path on a Surface 111

Determine a Path on a Parametric Surface Given start and destination points on parametric domain Define the straight line connecting two points in the parametric space The curve on the surface corresponding to this line 11