Download presentation
Presentation is loading. Please wait.
1
1cs426-winter-2008 Notes Ian Mitchell is running a MATLAB tutorial, Tuesday January 15, 5pm-7pm, DMP 110 We won’t be directly using MATLAB in this course, but it can be extremely useful for plotting curves, testing formulas, debugging mathematical expressions, etc.
2
2cs426-winter-2008 Example: piecewise linear spline Restrict all polynomials to be linear f(t)=a i (t-t i )+b i in [t i, t i+1 ] Enforce continuity: make each line segment interpolate the control point on either side a i (t i -t i )+b i =y i and a i (t i+1 -t i )+b i =y i+1 Solve to get a i =(y i+1 -y i )/(t i+1 -t i ) b i =y i End result: straight line segments connecting the control points C 0 but not C 1
3
3cs426-winter-2008 Choices in Animation Piecewise linear usually not smooth enough: need higher degree polynomials For motion curves, cubic splines basically always used Three main choices: Hermite splines: interpolating, up to C 1 Catmull-Rom: interpolating C 1 B-splines: approximating C 2
4
4cs426-winter-2008 Cubic Hermite Splines Our generic cubic in an interval [t i,t i+1 ] is q i (t) = a i (t-t i ) 3 +b i (t-t i ) 2 +c i (t-t i )+d i Make it interpolate endpoints: q i (t i )=y i and q i (t i+1 )=y i+1 And make it match given slopes: q i ’(t i )=s i and q i ’(t i+1 )=s i+1 Work it out to get
5
5cs426-winter-2008 Hermite Basis Rearrange the solution to get That is, we’re taking a linear combination of four basis functions Note the functions and their slopes are either 0 or 1 at the start and end of the interval
6
6cs426-winter-2008 Breaking Hermite Splines Usually specify one slope at each knot But a useful capability: use a different slope on each side of a knot We break C 1 smoothness, but gain control Can create motions that abruptly change, like collisions Aside: artists like to break things! Animation systems should have as much flexibility as possible
7
7cs426-winter-2008 Catmull-Rom Splines This is really just a C 1 Hermite spline with an automatic choice of slopes Use a 2nd order finite difference formula to estimate slope from values For equally spaced knots, simplifies to
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.