Chap 3 Interpolating Values

Slides:



Advertisements
Similar presentations
Arc-length computation and arc-length parameterization
Advertisements

Parametric Curves Ref: 1, 2.
© University of Wisconsin, CS559 Spring 2004
2002 by Jim X. Chen: Bezier Curve Bezier Curve.
COMPUTER GRAPHICS CS 482 – FALL 2014 OCTOBER 8, 2014 SPLINES CUBIC CURVES HERMITE CURVES BÉZIER CURVES B-SPLINES BICUBIC SURFACES SUBDIVISION SURFACES.
Geometric Modeling Notes on Curve and Surface Continuity Parts of Mortenson, Farin, Angel, Hill and others.
Cubic Curves CSE167: Computer Graphics Instructor: Steve Rotenberg UCSD, Fall 2006.
CS 445/645 Fall 2001 Hermite and Bézier Splines. Specifying Curves Control Points –A set of points that influence the curve’s shape Knots –Control points.
© University of Wisconsin, CS559 Spring 2004
Jehee Lee Seoul National University
Trajectory Generation
Computer Animation Algorithms and Techniques
Dr. S.M. Malaek Assistant: M. Younesi
1 Curves and Surfaces. 2 Representation of Curves & Surfaces Polygon Meshes Parametric Cubic Curves Parametric Bi-Cubic Surfaces Quadric Surfaces Specialized.
Slide 127 October 1999CS Computer Graphics (Top Changwatchai) Review of Spline Concepts Sections 10-6 to in Hearn & Baker Splines can be 2D.
Offset of curves. Alina Shaikhet (CS, Technion)
Advanced Computer Graphics (Spring 2005) COMS 4162, Lecture 12: Spline Curves (review) Ravi Ramamoorthi Most material.
Curves Locus of a point moving with one degree of freedom
3D orientation.
CSCE 441: Computer Graphics Rotation Representation and Interpolation
Modelling: Curves Week 11, Wed Mar 23
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Curves Week 13, Mon 24 Nov 2003.
1 Representing Curves and Surfaces. 2 Introduction We need smooth curves and surfaces in many applications: –model real world objects –computer-aided.
Splines III – Bézier Curves
Curve Modeling Bézier Curves
11/19/02 (c) 2002, University of Wisconsin, CS 559 Last Time Many, many modeling techniques –Polygon meshes –Parametric instancing –Hierarchical modeling.
A D V A N C E D C O M P U T E R G R A P H I C S CMSC 635 January 15, 2013 Spline curves 1/23 Curves and Surfaces.
V. Space Curves Types of curves Explicit Implicit Parametric.
CS 445 / 645 Introduction to Computer Graphics Lecture 23 Bézier Curves Lecture 23 Bézier Curves.
Curves.
Computer Animation Rick Parent Computer Animation Algorithms and Techniques Interpolating Values.
Quadratic Surfaces. SPLINE REPRESENTATIONS a spline is a flexible strip used to produce a smooth curve through a designated set of points. We.
University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell Parametric surfaces.
Curves. First of all… You may ask yourselves “What did those papers have to do with computer graphics?” –Valid question Answer: I thought they were cool,
Chapter VI Parametric Curves and Surfaces
110/27/ :47 Graphics II Animation Introduction and Motion Control Session 6.
June D Object Representation Shmuel Wimer Bar Ilan Univ., School of Engineering.
University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell Parametric Curves.
CS 551/651 Advanced Graphics Arc Length. Assignment 1 Due Week from Thursday Building a Cubic Bézier curve OpenGL/Glut Insert up to 100 points Render.
CSCE 441 Computer Graphics: Keyframe Animation/Smooth Curves Jinxiang Chai.
04/18/02(c) 2002 University of Wisconsin Last Time Hermite Curves Bezier Curves.
Greg Humphreys CS445: Intro Graphics University of Virginia, Fall 2003 Parametric Curves & Surfaces Greg Humphreys University of Virginia CS 445, Spring.
Splines I – Curves and Properties based on: Michael Gleicher Curves, chapter 15 in Fundamentals of Computer Graphics, 3 rd ed. (Shirley & Marschner) Slides.
CS 551/651 Advanced Graphics Technical Background.
Rick Parent - CIS681 Interpolation and Basic Techniques Representing and interpolating orientations Interpolation Speed control along curve Path following.
11/26/02(C) University of Wisconsin Last Time BSplines.
Parametric Curves CS 318 Interactive Computer Graphics John C. Hart.
CSCE 441: Keyframe Animation/Smooth Curves (Cont.) Jinxiang Chai.
CSCE 441: Keyframe Animation/Smooth Curves (Cont.) Jinxiang Chai.
(c) 2002 University of Wisconsin
Keyframe Interpolation and Speed Control Jehee Lee Seoul National University.
Splines Sang Il Park Sejong University. Particle Motion A curve in 3-dimensional space World coordinates.
CS559 – Curves Lecture These are course notes (not used as slides) Written by Mike Gleicher, Oct Updates Oct 2006, 2007 Updates Oct 2008 © 2005 Michael.
Ship Computer Aided Design
Rendering Bezier Curves (1) Evaluate the curve at a fixed set of parameter values and join the points with straight lines Advantage: Very simple Disadvantages:
Rick Parent - CIS681 Interpolation of a time-space curve Interpolation (of a curve in space) Speed control along curve Reparameterizing according to arc.
Curves University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2013 Tamara Munzner.
Introduction to Parametric Curve and Surface Modeling.
CSCI480/582 Lecture 9 Chap.2.2 Cubic Splines – Hermit and Bezier Feb, 11, 2009.
COMPUTER GRAPHICS CHAPTERS CS 482 – Fall 2017 SPLINES
© University of Wisconsin, CS559 Spring 2004
Curve & Surface.
CS 445 / 645 Introduction to Computer Graphics
© University of Wisconsin, CS559 Fall 2004
© University of Wisconsin, CS559 Spring 2004
CSCE 441: Keyframe Animation/Smooth Curves (Cont.)
SKTN 2393 Numerical Methods for Nuclear Engineers
Introduction to Parametric Curve and Surface Modeling
Presentation transcript:

Chap 3 Interpolating Values Animation(U), Chap 3, Interpolating Values

Outline Interpolating/approximating curves Controlling the motion of a point along a curve Interpolation of orientation Working with paths Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Interpolation between key frames Parameters to be interpolated Position of an object Normal Joint angle between two joints Transparency attribute of an object Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Interpolation between key frames Interpolation between frames is not trivial Appropriate interpolating function Parameterization of the function Maintain the desired control of the interpolated values over time Example (-5,0,0) at frame 22, (5,0,0) art frame 67 Stop at frame 22 and accelerate to reach a max speed by frame 34 Start to decelerate at frame 50 and come to a stop at frame 67 Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Interpolation between key frames desired result undesired result Need a smooth interpolation with user control Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Interpolation between key frames Solution Generate a space curve Distribute points evenly along curve Speed control: vary points temporally B Time = 10 A Time = 0 C Time = 35 D Time = 60 Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Interpolation functions Interpolation vs. approximation Interpolation Hermite, Catmull-Rom approximation Bezier, B-spline Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

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 Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

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, Catmull-Rom, cubic Bezier provide first order continuity between segments Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Interpolation functions Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Continuity position (0th order) tangent (1st order) curvature (2nd order) none At junction of two circular arcs Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Interpolation functions Global vs. local control Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

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 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 Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Example: Representing Unit Circle Cannot be represented explicitly as a function of x Implicit form: f(x,y)=x2+y2=1 Parametric form: x=cos(u), y=sin(u), 0<u<2π f>0 f=0 f<0 u Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

More on 3-D Parametric Curves Parametric form: P(u) = (Px(u), Py(u), Pz(u)) x = Px(u), y = Py(u), z = Pz(u) u=1/3 u=2/3 u=0.0 u=1.0 Space-curve P = P(u) 0.0 <=u<=1.0 Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

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 x2 + b x + c points to be interpolated (x1, y1), (x2, y2), (x3, y3) solve for coefficients (a, b, c): 3 linear equations, 3 unknowns called Lagrange Interpolation Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

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 polynomials are bad Higher degree, higher the wiggles Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

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 P1(u) P2(u) P3(u) Pn(u) Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

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 Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

A Linear Piecewise Polynomial The simple form for interpolating two points. p1 p2 u Each segment is of the form: (this is a vector equation) 1 u 1 Two basis (blending) functions Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Hermite Interpolation Hermite Curves—cubic polynomial for two points Hermite interpolation requires Endpoint positions derivatives at endpoints To create a composite curve, use the end of one as the beginning of the other and share the tangent vector control points/knots Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Hermite Curve Formation Cubic polynomial and its derivative Given Px(0), Px(1), P’x(0), P’x(1), solve for a, b, c, d 4 equations are given for 4 unknowns Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Hermite Curve Formation (cont.) Problem: solve for a, b, c, d Solution: Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Hermite Curves in Matrix Form ith segment in composite curves Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Blending Functions of Hermite Splines Each cubic Hermite spline is a linear combination of 4 blending functions geometric information Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Composite Hermite Curve Continuity between connected segments is ensured by using ending tangent vector of one segment as the beginning tangent vector of the next. Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

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 P2 and P3 are used to control the shape p1 = P1, p2 = P4, p1' = 3(P2-P1), p2' = 3(P4 - P3) Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Bezier Curves Another representation Blend the control point position using Bernstein polynomials Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Bezier Curves Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Composite Bezier Curves How to control the continuity between adjacent Bezier segment? Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

De Casteljau Construction of Bezier Curves How to derive a point on a Bezier curve? Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

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 Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Catmull-Rom Splines With Hermite splines, the designer must arrange for consecutive tangents to be collinear, to get C1 continuity. Similar for Bezier. This gets tedious. Catmull-Rom: an interpolating cubic spline with built-in C1 continuity. Compared to Hermite/Bezier: fewer control points required, but less freedom. Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Catmull-Rom Splines (cont.) Given n control points in 3-D: p1, p2, …, pn, Tangent at pi given by s(pi+1 – pi-1) for i=2..n-1, for some s. Curve between pi and pi+1 is determined by pi-1, pi, pi+1, pi+2. Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Catmull-Rom Splines (cont.) Given n control points in 3-D: p1, p2, …, pn, Tangent at pi given by s(pi+1 – pi-1) for i=2..n-1, for some s Curve between pi and pi+1 is determined by pi-1, pi, pi+1, pi+2 What about endpoint tangents? (several good answers: extrapolate, or use extra control points p0, pn+1) Now we have positions and tangents at each knot – a Hermite specification. Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Catmull-Rom Spline Matrix Derived similarly to Hermite and Bezier s is the tension parameter; typically s=1/2 Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Catmull-Rom Spline What about endpoint tangents? Provided by users Several good answers: extrapolate, or use extra control points p0, pn+1 Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Catmull-Rom Spline Example Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Catmull-Rom Spline Drawback An internal tangent is not dependent on the position of the internal point relative to its two neighbors Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

p(0) = P2, p’(0) = s(P3-P1), p(1) = P3, p’(1) = s(P4-P2) Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Splines and Other Interpolation Forms See Computer Graphics textbooks Review Appendix B.4 in Parent Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

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 Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Speed Control The speed of tracing a curve needs to be under the direct control of the animator Varying u at a constant rate will not necessarily generate P(u) at a constant speed. Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Non-uniformity in Parametrization Generally, equally spaced samples in parameter space are not equally spaced along the curve B Time = 10 A Time = 0 C Time = 35 D Time = 60 Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Arc Length Reparameterization To ensure a constant speed for the interpolated value, the curve has to be parameterized 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 Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

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 Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

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 u1 and u2, find arclength(u1,u2) Given an arc length s, and parameter value u1, find u2 such that arclength(u1,u2) = s Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Arc Length Reparameterization Converting a space curve P(u) to a curve with arc-length parameterization Find s=S(u), and u=S-1(s)=U(s) P*(s)=P(U(s)) 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 Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

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.2 0.19 0.3 0.32 0.4 0.45 … Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

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.2 0.19 0.3 0.32 0.4 0.45 … Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Arc Length Reparameterization Using Forward Differencing Given an arc length s and a parameter u1, find the parametric value u2 such that arclength(u1, u2)=s Find the entry in the table closest to this u using binary search Or take the u before and after it and interpolate linearly u Arc Length 0.0 0.00 0.1 0.08 0.2 0.19 0.3 0.32 0.4 0.45 … Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

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 Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Arc Length Reparameterization Using Adaptive forward differencing Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Arc Length Reparameterization Using Numerical Integral Arc length integral Simpson’s and trapezoidal integration using evenly spaced intervals Gaussian quadrature using unevenly spaced intervals Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Speed Control Given a arc-length parameterized space curve, how to control 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 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 Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

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. Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Constant Velocity Speed Curve Moving at 1 m/s if meters and seconds are the units Too simple to be what we want Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Distance Time Function and Speed Control We have a space curve p=P(u) and a speed control 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))) Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Speed Control u* s* t* … u Arc Length 0.0 0.00 0.1 0.08 0.2 0.19 0.3 Arc Length Table u Arc Length 0.0 0.00 0.1 0.08 0.2 0.19 0.3 0.32 0.4 0.45 … Speed Control Curve u* s* t* Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

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 Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Ease-in/Ease-out Most useful and most common ways to control motion along a curve (distance) Time Arc length Equally spaced samples in time specify arc length required for that frame Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Ease-in/Ease-out Sine Interpolation -1 1 -p/2 p/2 Arc Length Time Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

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 or decelerating. Zero derivatives at t=0 and t=1 indicating smooth accelerating and deceleration at end points. Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Ease-in/Ease-out Piecing Curves Together for Ease In/Out Arc Length Linear segment Time Sinusoidal segments Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Ease-in/Ease-out Piecing Curves Together for Ease In/Out Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Ease-in/Ease-out Integrating to avoid the sine function acceleration time t1 t2 A D velocity time t1 t2 v Find v such that area = 1 arc length V1 = V2  A*t1 = - D*(1-t2) time Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

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 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 Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

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 V1 = V2 inplies A*t1 = - D*(1-t2) Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Ease-in/Ease-out Integrating to avoid the sine function Total distance = 1 implies 1 = ½ V0 t + V0 (t2-t1)+1/2 V0 (1-t2) Users specifies any two of three variables t1, t2, and V0, and the system can solve for the third Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

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 Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Videos Bunny (Blue Sky Studios, 1998) Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Review - Quaternions Similar to axis-angle 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): a=(ax, ay, az) Y q X If a is unit length, then q will be also Z Animation(U), Chap 2, Tech. Background CS, NCTU, J. H. Chuang

Review - Quaternions If a is unit length, then q will be also Animation(U), Chap 2, Tech. Background CS, NCTU, J. H. Chuang

Review - Quaternions Rotating some angle around an axis is the same as rotating the negative angle around the negated axis Animation(U), Chap 2, Tech. Background CS, NCTU, J. H. Chuang

Review - Quaternion Math Addition Multiplication Multiplication is associative but not commutative Animation(U), Chap 2, Tech. Background CS, NCTU, J. H. Chuang

Review - Quaternion Math (cont.) Multiplicative identity: [1, 0,0,0] Inverse Normalization for unit quaternion Animation(U), Chap 2, Tech. Background CS, NCTU, J. H. Chuang

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 The proof isn’t that hard Note that the result v’ always has zero scalar value Animation(U), Chap 2, Tech. Background CS, NCTU, J. H. Chuang

Review - Compose Rotations Rotating a vector v by first quaternion p followed by a quaternion q is like rotation using qp Animation(U), Chap 2, Tech. Background CS, NCTU, J. H. Chuang

Review - Compose Rotations To rotate a vector v by quaternion q followed by its inverse quaternion q-1 Animation(U), Chap 2, Tech. Background CS, NCTU, J. H. Chuang

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 2, Tech. Background CS, NCTU, J. H. Chuang

Review - Linear Interpolation Linear interpolation generates unequal spacing of points after projecting to circle Animation(U), Chap 2, Tech. Background CS, NCTU, J. H. Chuang

Review – Spherical Linear Interpolation (slerp) Want equal increment along arc connecting two quaternion on the spherical surface Spherical linear interpolation (slerp) Normalize to regain unit quaternion Animation(U), Chap 2, Tech. Background CS, NCTU, J. H. Chuang

Review – Spherical Linear Interpolation (slerp) Animation(U), Chap 2, Tech. Background CS, NCTU, J. H. Chuang

Review – Spherical Linear Interpolation (slerp) Animation(U), Chap 2, Tech. Background CS, NCTU, J. H. Chuang

Review – Spherical Linear Interpolation (slerp) Recall that q and –q represent same rotation What is the difference between: Slerp(u, q1, q2) and Slerp(u, q1, -q2) ? 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 2, Tech. Background CS, NCTU, J. H. Chuang

Review – Spherical Linear Interpolation (slerp) If we have an intermediate position q2, the interpolation from q1-->q2-->q3 will not necessarily follow the same path as the interpolation from q1 to q3. Animation(U), Chap 2, Tech. Background CS, NCTU, J. H. Chuang

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 Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Interpolating a Series of Quaternions Interpolated points […, pn-1, pn, pn+1, ….] in 3D Between each pair of points, two control points will be constructed. e.g., For pn an : the one intermediate after pn bn : the one immediately before pn pn+(pn-pn-1) Take average Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Interpolating a Series of Quaternions Interpolated points […, pn-1, pn, pn+1, ….] in 3D Between each pair of points, two control points will be constructed. e.g., For pn an : the one intermediate after pn bn : the one immediately before pn bn =pn+(pn-an) Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Interpolating a Series of Quaternions Interpolated points […, pn-1, pn, pn+1, ….] in 3D End conditions Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Interpolating a Series of Quaternions Interpolated points […, pn-1, pn, pn+1, ….] in 3D Between any 2 interpolated points pn and pn+1, a cubic Bezier curve segment is defined by pn, an, bn+1, and pn+1 Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

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) Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Interpolating a Series of Quaternions Animation: See http://en.wikipedia.org/wiki/File:Bezier_3_big.gif Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Interpolating a Series of Quaternions Bezier interpolation on 4D sphere? How are control points generated? How are cubic Beziers defined? Control points are automatically generated as it is not intuitive to manually adjust them on a 4D sphere Derive Bezier curve points by iteratively subdivision s on pn, an, bn+1, and pn+1 Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Interpolating a Series of Quaternions Connecting Segments on 4D Sphere Automatically generating interior (spherical) control points qn’ 2. Bisect the span an bn qn qn+1 qn-1 1. Double the arc Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Interpolating a Series of Quaternions De Casteljau Construction on 4D Sphere Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Path Following Issues about path following Arc length parameterization and speed control Changing the orientation Smoothing a path Path along a surface Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Orientation Along a Curve A local coordinate system (u, v, w) is defined for an object to be animated Position along the path P(s), denoted as POS w-axis: the direction the object is facing v-axis: up vector u-axis: perpendicular to w and v (u, v, w): a right-handed coordinate system Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Orientation Along a Curve Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Orientation Along a Curve Frenet Frame Frenet frame: a moving coordinate system determined by curve tangent and curvature Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Orientation Along a Curve Frenet Frame Problems 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 Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Orientation Along a Curve Frenet Frame Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Orientation Along a Curve Frenet Frame Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

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 Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

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 Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Smoothing a Path with Linear Interpolation Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

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. Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Smoothing a Path with Cubic Interpolation Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Smoothing a Path with Cubic Interpolation Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

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 is generally perpendicular to the surface (averaged normal of two points) Intersection of the plane with the surface (mesh) Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

Determine a Path on a Surface Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang

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 Animation(U), Chap 3, Interpolating Values CS, NCTU, J. H. Chuang