Implicit Runge-Kutta schemes for optimal control problems with evolution equations
Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s...
Transcript of Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s...
![Page 1: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/1.jpg)
![Page 2: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/2.jpg)
Interpolationand
Splines
Squirrel EiserlohDirector
TrueThought LLC
[email protected]@TrueThought.com
![Page 3: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/3.jpg)
Overview
» Averaging and Blending» Interpolation» Parametric Equations» Parametric Curves and Splines
including:Bezier splines (linear, quadratic, cubic)Cubic Hermite splinesCatmull-Rom splinesCardinal splinesKochanek–Bartels splinesB-splines
![Page 4: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/4.jpg)
Averaging and Blending
![Page 5: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/5.jpg)
Averaging and Blending
» First, we start off with the basics.» I mean, really basic.» Let’s go back to grade school.
» How do you average two numbers together?
(A + B) / 2
![Page 6: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/6.jpg)
Averaging and Blending
» Let’s change that around a bit.
(A + B) / 2
becomes
(.5 * A) + (.5 * B)
i.e. “half of A, half of B”, or “a blend of A and B”
![Page 7: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/7.jpg)
» We can, of course, also blend A and B unevenly (with different weights):
(.35 * A) + (.65 * B)
» In this case, we are blending “35% of A with 65% of B”.
» Can use any blend weights we want, as long as they add up to 1.0 (100%).
Averaging and Blending
![Page 8: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/8.jpg)
» Like making up a bottle of liquid by mixing two different fluids together.
(we always fill the glass 100%)
Averaging and Blending
![Page 9: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/9.jpg)
Averaging and Blending
» So if we try to generalize here, we could say:
(s * A) + (t * B)
» ...where s is “how much of A” we want, and t is “how much of B” we want
» ...and s + t = 1.0 (really, s is just 1-t)
so: ((1-t) * A) + (t * B)
Which means we can control the balance of the entire blend by changing just one number: t
![Page 10: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/10.jpg)
Averaging and Blending
» There are two ways of thinking about this (and a formula for each):
» #1: “Blend some of A with some of B”
(s * A) + (t * B) where s = 1-t
» #2: “Start with A, and then add some amount of the distance from A to B”
A + t*(B – A)
![Page 11: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/11.jpg)
Averaging and Blending
» In both cases, the result of our blend is just plain “A” if t=0;
i.e. if we don’t want any of B.
(1.00 * A) + (0.00 * B) = A
or: A + 0.00*(B – A) = A
![Page 12: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/12.jpg)
Averaging and Blending
» Likewise, the result of our blend is just plain “B” if t=1; i.e. if we don’t want any of A.
(0.00 * A) + (1.00 * B) = B
or: A + 1.00*(B – A) =A + B – A = B
![Page 13: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/13.jpg)
Averaging and Blending
» However we choose to think about it, there’s a single “knob”, called t, that we are tweaking to get the blend of A and B that we want.
![Page 14: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/14.jpg)
Blending Compound Data
![Page 15: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/15.jpg)
Blending Compound Data
» We can blend more than just numbers.
» Blending 2D and 3D vectors, for example, is a cinch:
» Just blend each component (x,y,z) separately, at the same time.
P = (s * A) + (t * B) where s = 1-t
is equivalent to:
Px = (s * Ax) + (t * Bx)Py = (s * Ay) + (t * By)Pz = (s * Az) + (t * Bz)
![Page 16: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/16.jpg)
Blending Compound Data(such as Vectors)
![Page 17: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/17.jpg)
Blending Compound Data(such as Vectors)
![Page 18: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/18.jpg)
Blending Compound Data(such as Vectors)
![Page 19: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/19.jpg)
Blending Compound Data(such as Vectors)
![Page 20: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/20.jpg)
Blending Compound Data
» Need to be careful, though!
» Not all compound data types will blend correctly with this sort of (blend-the-components) approach.
» Examples: Color RGBs, Euler angles (yaw/pitch/roll), Matrices, Quaternions...
...in fact, there are a bunch that won’t.
![Page 21: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/21.jpg)
Blending Compound Data
» Here’s an RGB color example:
» If A is RGB( 255, 0, 0 ) – bright red...and B is RGB( 0, 255, 0 ) – bright
green
» Blending the two (with t = 0.5) gives:RGB( 127, 127, 0 )
...which is a dull, swampy color. Yuck.
![Page 22: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/22.jpg)
Blending Compound Data
» What we wanted was this:
...and what we got instead was this:
![Page 23: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/23.jpg)
Blending Compound Data
» For many compound classes, like RGB, you may need to write your own Interpolate() method that “does the right thing”, whatever that may be.
» Jim will talk later about what happens when you try to interpolate Euler Angles (yaw/pitch/roll), Matrices, and Quaternions using this simple “naive” approach of blending the components.
![Page 24: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/24.jpg)
Interpolation
![Page 25: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/25.jpg)
Interpolation
» Interpolation is just changing blend weights over time. Also called “Lerp”.
» i.e. Turning the knob (t) progressively, not just setting it to some position.
» Often we crank slowly from t=0 to t=1.
![Page 26: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/26.jpg)
Interpolation
» Since games are generally frame-based, we usually have some Update() method that gets called, in which we have to decide what we’re supposed to look like at this instant in time.
» There are two main ways of approaching this when we’re interpolating:
» #1: Blend from A to B over the course of several frames (parametric evaluation);
» #2: Blend one step from wherever-I’m-at now to wherever-I’m-going (numerical integration).
![Page 27: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/27.jpg)
Interpolation
» Games generally need to use both.
» Most physics tends to use method #2 (numerical integration). Erin will talk more about this at the end of the day.
» Many other systems, however, use method #1 (parametric evaluation).
(More on that in a moment)
![Page 28: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/28.jpg)
Interpolation
» We use “lerping”all the time, underdifferent names.
For example:
» an Audio crossfade
![Page 29: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/29.jpg)
Interpolation
» We use “lerping”all the time, underdifferent names.
For example:
» an Audio crossfade» fading up lights
![Page 30: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/30.jpg)
Interpolation
» We use “lerping”all the time, underdifferent names.
For example:
» an Audio crossfade» fading up lights» or this cheesy
PowerPoint effect.
![Page 31: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/31.jpg)
Interpolation
Basically, whenever we do any sort of blend over time, we’re lerping.
![Page 32: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/32.jpg)
Implicit Equations
Sweetness...
I loves me some math!
“That’s my cue to go get a margarita.”-Squirrel’s wife
![Page 33: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/33.jpg)
Implicit Equations
Implicit equations define what is, and isn’t,included in a set of points (a “locus”).
![Page 34: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/34.jpg)
Implicit Equations
If the equation is TRUE for some x and y,then the point (x,y) is included on the line.
![Page 35: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/35.jpg)
Implicit Equations
If the equation is FALSE for some x and y,then the point (x,y) is NOT included on the line.
![Page 36: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/36.jpg)
Implicit Equations
Here, the equation X2 + Y2 = 25 defines a“locus” of all the points within 5 units of the origin.
![Page 37: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/37.jpg)
Implicit Equations
If the equation is TRUE for some x and y,then the point (x,y) is included on the circle.
![Page 38: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/38.jpg)
Implicit Equations
If the equation is FALSE for some x and y,then the point (x,y) is NOT included on the circle.
![Page 39: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/39.jpg)
Parametric Equations
» A parametric equation is one that has been rewritten so that it has one clear “input” parameter (variable) that everything else is based in terms of.
» In other words, a parametric equation is basically anything you can hook up to a single knob. It’s a formula that you can feed in a single number (the “knob” value, “t”, usually from 0 to 1), and the formula gives back the appropriate value for that particular “t”.
Think of it as a function that takes a float and returns... whatever (a position, a color, an orientation, etc.):
someComplexData ParametricEquation( float t );
![Page 40: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/40.jpg)
Parametric Equations
» Essentially:
P(t) = some formula with “t” in it
...as t changes, P changes(P depends upon t)
P(t) can return any kind of value; whatever we want to interpolate, for instance.
Position (2D, 3D, etc.)OrientationScaleAlphaetc.
![Page 41: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/41.jpg)
Parametric Equations
Example: P(t) is a 2D position...Pick some value of t, plug it in, see where P is!
![Page 42: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/42.jpg)
Parametric Equations
Example: P(t) is a 2D position...Pick some value of t, plug it in, see where P is!
![Page 43: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/43.jpg)
Parametric Equations
Example: P(t) is a 2D position...Pick some value of t, plug it in, see where P is!
![Page 44: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/44.jpg)
Parametric Equations
Example: P(t) is a 2D position...Pick some value of t, plug it in, see where P is!
![Page 45: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/45.jpg)
Parametric Equations
Example: P(t) is a 2D position...Pick some value of t, plug it in, see where P is!
![Page 46: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/46.jpg)
Parametric Equations
Example: P(t) is a 2D position...Pick some value of t, plug it in, see where P is!
![Page 47: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/47.jpg)
Parametric Equations
Example: P(t) is a 2D position...Pick some value of t, plug it in, see where P is!
![Page 48: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/48.jpg)
Parametric Equations
Example: P(t) is a 2D position...Pick some value of t, plug it in, see where P is!
![Page 49: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/49.jpg)
Parametric Curves
![Page 50: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/50.jpg)
Parametric Curves
Parametric curves are curves that are definedusing parametric equations.
![Page 51: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/51.jpg)
Parametric Curves
Here’s the basic idea:
We go from t=0 at A (start) to t=1 at B (end)
![Page 52: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/52.jpg)
Parametric Curves
Set the knob to 0, and crank it towards 1
![Page 53: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/53.jpg)
Parametric Curves
As we turn the knob, we keep plugging the latest t into the curve equation to find out where P is now
![Page 54: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/54.jpg)
Parametric Curves
Note: All parametric curves are directional; i.e.they have a start & end, a forward & backward
![Page 55: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/55.jpg)
Parametric Curves
So that’s the basic idea.
Now how do we actually do it?
![Page 56: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/56.jpg)
Bezier Curves
![Page 57: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/57.jpg)
Linear Bezier Curves
Bezier curves are the easiest kind to understand.
The simplest kind of Bezier curves areLinear Bezier curves.
They’re so simple, they’re not even curvy!
![Page 58: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/58.jpg)
Linear Bezier Curves
P = ((1-t) * A) + (t * B) // weighted average
or, as I prefer to write it:
P = (s * A) + (t * B) where s = 1-t
![Page 59: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/59.jpg)
Linear Bezier Curves
P = ((1-t) * A) + (t * B) // weighted average
or, as I prefer to write it:
P = (s * A) + (t * B) where s = 1-t
![Page 60: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/60.jpg)
Linear Bezier Curves
P = ((1-t) * A) + (t * B) // weighted average
or, as I prefer to write it:
P = (s * A) + (t * B) where s = 1-t
![Page 61: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/61.jpg)
Linear Bezier Curves
So, for t = 0.75 (75% of the way from A to B):
P = ((1-t) * A) + (t * B)or
P = (.25 * A) + (.75 * B)
![Page 62: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/62.jpg)
Linear Bezier Curves
So, for t = 0.75 (75% of the way from A to B):
P = ((1-t) * A) + (t * B)or
P = (.25 * A) + (.75 * B)
![Page 63: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/63.jpg)
Linear Bezier Curves
Here it is in motion (thanks, internet!)
A
B
![Page 64: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/64.jpg)
Quadratic Bezier Curves
![Page 65: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/65.jpg)
Quadratic Bezier Curves
A Quadratic Bezier curve is just a blend of two Linear Bezier curves.
The word “quadratic” means that if we sniff around the math long enough,
we’ll see t2. (In our Linear Beziers we saw t and 1-t, but never t2).
![Page 66: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/66.jpg)
Quadratic Bezier Curves
» Three control points: A, B, and C
![Page 67: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/67.jpg)
Quadratic Bezier Curves
» Three control points: A, B, and C» Two different Linear Beziers: AB and BC
![Page 68: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/68.jpg)
Quadratic Bezier Curves
» Three control points: A, B, and C» Two different Linear Beziers: AB and BC» Instead of “P”, using “E” for AB and “F” for BC
![Page 69: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/69.jpg)
Quadratic Bezier Curves
» Interpolate E along AB as we turn the knob» Interpolate F along BC as we turn the knob» Move E and F simultaneously – only one “t”!
![Page 70: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/70.jpg)
Quadratic Bezier Curves
» Interpolate E along AB as we turn the knob» Interpolate F along BC as we turn the knob» Move E and F simultaneously – only one “t”!
![Page 71: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/71.jpg)
Quadratic Bezier Curves
» Interpolate E along AB as we turn the knob» Interpolate F along BC as we turn the knob» Move E and F simultaneously – only one “t”!
![Page 72: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/72.jpg)
Quadratic Bezier Curves
» Interpolate E along AB as we turn the knob» Interpolate F along BC as we turn the knob» Move E and F simultaneously – only one “t”!
![Page 73: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/73.jpg)
Quadratic Bezier Curves
» Now let’s turn the knob again...(from t=0 to t=1)
but draw a line between E and F as they move.
![Page 74: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/74.jpg)
Quadratic Bezier Curves
» Now let’s turn the knob again...(from t=0 to t=1)
but draw a line between E and F as they move.
![Page 75: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/75.jpg)
Quadratic Bezier Curves
» Now let’s turn the knob again...(from t=0 to t=1)
but draw a line between E and F as they move.
![Page 76: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/76.jpg)
Quadratic Bezier Curves
» Now let’s turn the knob again...(from t=0 to t=1)
but draw a line between E and F as they move.
![Page 77: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/77.jpg)
Quadratic Bezier Curves
» Now let’s turn the knob again...(from t=0 to t=1)
but draw a line between E and F as they move.
![Page 78: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/78.jpg)
Quadratic Bezier Curves
» This time, we’ll also interpolate P from E to F...using the same “t” as E and F themselves
» Watch where P goes!
![Page 79: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/79.jpg)
Quadratic Bezier Curves
» This time, we’ll also interpolate P from E to F...using the same “t” as E and F themselves
» Watch where P goes!
![Page 80: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/80.jpg)
Quadratic Bezier Curves
» This time, we’ll also interpolate P from E to F...using the same “t” as E and F themselves
» Watch where P goes!
![Page 81: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/81.jpg)
Quadratic Bezier Curves
» This time, we’ll also interpolate P from E to F...using the same “t” as E and F themselves
» Watch where P goes!
![Page 82: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/82.jpg)
Quadratic Bezier Curves
» This time, we’ll also interpolate P from E to F...using the same “t” as E and F themselves
» Watch where P goes!
![Page 83: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/83.jpg)
Quadratic Bezier Curves
» Note that mathematicians useP0, P1, P2 instead of A, B, C
» I will keep using A, B, C here for simplicity
A
B
C
![Page 84: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/84.jpg)
Quadratic Bezier Curves
» We know P starts at A, and ends at C» It is clearly influenced by B...
...but it never actually touches B
A
B
C
![Page 85: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/85.jpg)
Quadratic Bezier Curves
» B is a guide point of this curve; drag it around to change the curve’s contour.
![Page 86: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/86.jpg)
Quadratic Bezier Curves
» B is a guide point of this curve; drag it around to change the curve’s contour.
![Page 87: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/87.jpg)
Quadratic Bezier Curves
» B is a guide point of this curve; drag it around to change the curve’s contour.
![Page 88: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/88.jpg)
Quadratic Bezier Curves
» B is a guide point of this curve; drag it around to change the curve’s contour.
![Page 89: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/89.jpg)
Quadratic Bezier Curves
» By the way, this is also that thing you were drawing in junior high when you were bored.
(when you weren’t drawing D&D maps, that is)
![Page 90: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/90.jpg)
Quadratic Bezier Curves
» By the way, this is also that thing you were drawing in junior high when you were bored.
(when you weren’t drawing D&D maps, that is)
A
B C
![Page 91: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/91.jpg)
Quadratic Bezier Curves
» BONUS: This is also how they makeTrue Type Fonts look nice and curvy.
![Page 92: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/92.jpg)
Quadratic Bezier Curves
» Remember:
A Quadratic Bezier curve is just a blend of two Linear Bezier curves.
So the math is still pretty simple.
(Just a blend of two Linear Bezier equations.)
![Page 93: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/93.jpg)
Quadratic Bezier Curves
» E(t) = (s * A) + (t * B) where s = 1-t» F(t) = (s * B) + (t * C)» P(t) = (s * E) + (t * F) technically E(t) and F(t) here
![Page 94: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/94.jpg)
Quadratic Bezier Curves
» E(t) = sA + tB where s = 1-t» F(t) = sB + tC» P(t) = sE + tF technically E(t) and F(t) here
![Page 95: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/95.jpg)
Quadratic Bezier Curves
» Hold on! You said “quadratic” meant we’d see a t2 in there somewhere.
» E(t) = sA + tB» F(t) = sB + tC» P(t) = sE(t) + tF(t)
» P(t) is an interpolation from E(t) to F(t)» When you plug the E(t) and F(t) equations
into the P(t) equation, you get...
![Page 96: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/96.jpg)
Quadratic Bezier Curves
» One equation to rule them all:
P(t) = sE(t) + tF(t)or
P(t) = s( sA + tB ) + t( sB + tC )or
P(t) = (s2)A + (st)B + (st)B + (t2)Cor
P(t) = (s2)A + 2(st)B + (t2)C(BTW, there’s our “quadratic” t2)
![Page 97: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/97.jpg)
Quadratic Bezier Curves
» What if t = 0 ? (at the start of the curve)
so then... s = 1
P(t) = (s2)A + 2(st)B + (t2)Cbecomes
P(t) = (12)A + 2(1*0)B + (02)Cbecomes
P(t) = (1)A + 2(0)B + (0)Cbecomes
P(t) = A
![Page 98: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/98.jpg)
Quadratic Bezier Curves
» What if t = 1 ? (at the end of the curve)
so then... s = 0
P(t) = (s2)A + 2(st)B + (t2)Cbecomes
P(t) = (02)A + 2(0*1)B + (12)Cbecomes
P(t) = (0)A + 2(0)B + (1)Cbecomes
P(t) = C
![Page 99: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/99.jpg)
Quadratic Bezier Curves
» What if t = 0.5 ? (halfway through the curve)
so then... s = 0.5 also
P(t) = (s2)A + 2(st)B + (t2)Cbecomes
P(t) = (0.52)A + 2(0.5*0.5)B + (0.52)Cbecomes
P(t) = (0.25)A + 2(0.25)B + (.25)Cbecomes
P(t) = .25A + .50B + .25C
![Page 100: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/100.jpg)
Quadratic Bezier Curves
» If we say M is the midpoint of the line AC...
![Page 101: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/101.jpg)
Quadratic Bezier Curves
» If we say M is the midpoint of the line AC...
![Page 102: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/102.jpg)
Quadratic Bezier Curves
» And H is the halfway point on the curve(where t = 0.5 )
![Page 103: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/103.jpg)
Quadratic Bezier Curves
» Then H is also halfway from M to B
![Page 104: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/104.jpg)
Quadratic Bezier Curves
» So, let’s say that we’d rather drag the halfway point (H) around than B.
(maybe because H is on the curve itself)
![Page 105: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/105.jpg)
Quadratic Bezier Curves
» So now we know H, but not B.(and we also know A and C)
![Page 106: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/106.jpg)
Quadratic Bezier Curves
» Start by computing M (midpoint of AC):M = .5A + .5C
![Page 107: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/107.jpg)
Quadratic Bezier Curves
» Compute MH (H – M)
![Page 108: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/108.jpg)
Quadratic Bezier Curves
» Add MH to H to get BB = H + MH (or 2H – M)
![Page 109: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/109.jpg)
Quadratic Bezier Curves
» This is what programs like Visio do when you drag curve points, BTW.
![Page 110: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/110.jpg)
Non-uniformity» Be careful: most curves are not
uniform; that is, they have variable “density” or “speed” throughout them.
![Page 111: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/111.jpg)
Cubic Bezier Curves
![Page 112: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/112.jpg)
Cubic Bezier Curves
A Cubic Bezier curve is just a blend of two Quadratic Bezier curves.
The word “cubic” means that if we sniff around the math long enough, we’ll see t3. (In our Linear Beziers we saw t; in
our Quadratics we saw t2).
![Page 113: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/113.jpg)
Cubic Bezier Curves
» Four control points: A, B, C, and D» 2 different Quadratic Beziers: ABC and BCD» 3 different Linear Beziers: AB, BC, and CD
![Page 114: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/114.jpg)
Cubic Bezier Curves
» As we turn the knob (one knob, one “t” for everyone):Interpolate E along AB // all three lerp simultaneously
Interpolate F along BC // all three lerp simultaneously
Interpolate G along CD // all three lerp simultaneously
![Page 115: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/115.jpg)
Cubic Bezier Curves
» As we turn the knob (one knob, one “t” for everyone):Interpolate E along AB // all three lerp simultaneously
Interpolate F along BC // all three lerp simultaneously
Interpolate G along CD // all three lerp simultaneously
![Page 116: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/116.jpg)
Cubic Bezier Curves
» As we turn the knob (one knob, one “t” for everyone):Interpolate E along AB // all three lerp simultaneously
Interpolate F along BC // all three lerp simultaneously
Interpolate G along CD // all three lerp simultaneously
![Page 117: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/117.jpg)
Cubic Bezier Curves
» As we turn the knob (one knob, one “t” for everyone):Interpolate E along AB // all three lerp simultaneously
Interpolate F along BC // all three lerp simultaneously
Interpolate G along CD // all three lerp simultaneously
![Page 118: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/118.jpg)
Cubic Bezier Curves
» As we turn the knob (one knob, one “t” for everyone):Interpolate E along AB // all three lerp simultaneously
Interpolate F along BC // all three lerp simultaneously
Interpolate G along CD // all three lerp simultaneously
![Page 119: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/119.jpg)
Cubic Bezier Curves
» Also:Interpolate Q along EF // lerp simultaneously with E,F,G
Interpolate R along FG // lerp simultaneously with E,F,G
![Page 120: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/120.jpg)
Cubic Bezier Curves
» Also:Interpolate Q along EF // lerp simultaneously with E,F,G
Interpolate R along FG // lerp simultaneously with E,F,G
![Page 121: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/121.jpg)
Cubic Bezier Curves
» Also:Interpolate Q along EF // lerp simultaneously with E,F,G
Interpolate R along FG // lerp simultaneously with E,F,G
![Page 122: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/122.jpg)
Cubic Bezier Curves
» Also:Interpolate Q along EF // lerp simultaneously with E,F,G
Interpolate R along FG // lerp simultaneously with E,F,G
![Page 123: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/123.jpg)
Cubic Bezier Curves
» Also:Interpolate Q along EF // lerp simultaneously with E,F,G
Interpolate R along FG // lerp simultaneously with E,F,G
![Page 124: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/124.jpg)
Cubic Bezier Curves
» And finally:Interpolate P along QR
(simultaneously with E,F,G,Q,R)
» Again, watch where P goes!
![Page 125: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/125.jpg)
Cubic Bezier Curves
» And finally:Interpolate P along QR
(simultaneously with E,F,G,Q,R)
» Again, watch where P goes!
![Page 126: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/126.jpg)
Cubic Bezier Curves
» And finally:Interpolate P along QR
(simultaneously with E,F,G,Q,R)
» Again, watch where P goes!
![Page 127: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/127.jpg)
Cubic Bezier Curves
» And finally:Interpolate P along QR
(simultaneously with E,F,G,Q,R)
» Again, watch where P goes!
![Page 128: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/128.jpg)
Cubic Bezier Curves
» And finally:Interpolate P along QR
(simultaneously with E,F,G,Q,R)
» Again, watch where P goes!
![Page 129: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/129.jpg)
Cubic Bezier Curves
A
B C
D
» Now P starts at A, and ends at D» It never touches B or C...
since they are guide points
![Page 130: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/130.jpg)
Cubic Bezier Curves
» Remember:
A Cubic Bezier curve is just a blend of two Quadratic Bezier curves.
Which are just a blend of 3 Linear Bezier curves.
So the math is still not too bad.
(A blend of blends of Linear Bezier equations.)
![Page 131: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/131.jpg)
Cubic Bezier Curves
» E(t) = sA + tB where s = 1-t» F(t) = sB + tC» G(t) = sC + tD
![Page 132: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/132.jpg)
Cubic Bezier Curves
» And then Q and R interpolate those results...» Q(t) = sE + tF» R(t) = sF + tG
![Page 133: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/133.jpg)
Cubic Bezier Curves
» And lastly P interpolates from Q to R
» P(t) = sQ + tR
![Page 134: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/134.jpg)
Cubic Bezier Curves
» E(t) = sA + tB // Linear Bezier (blend of A and B)
» F(t) = sB + tC // Linear Bezier (blend of B and C)
» G(t) = sC + tD // Linear Bezier (blend of C and D)
» Q(t) = sE + tF // Quadratic Bezier (blend of E and F)
» R(t) = sF + tG // Quadratic Bezier (blend of F and G)
» P(t) = sQ + tR // Cubic Bezier (blend of Q and R)
» Okay! So let’s combine these all together...
![Page 135: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/135.jpg)
Cubic Bezier Curves
» Do some hand-waving mathemagic here...
...and we get one equation to rule them all:
P(t) = (s3)A + 3(s2t)B + 3(st2)C + (t3)D
(BTW, there’s our “cubic” t3)
![Page 136: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/136.jpg)
Cubic Bezier Curves
» Let’s compare the three Bezier equations (Linear, Quadratic, Cubic):
P(t) = (s)A + (t)BP(t) = (s2)A + 2(st)B + (t2)CP(t) = (s3)A + 3(s2t)B + 3(st2)C + (t3)D
» There’s some nice symmetry here...
![Page 137: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/137.jpg)
Cubic Bezier Curves
» Write in all of the numeric coefficients...» Express each term as powers of s and t
P(t)= 1(s1t0)A + 1(s0t1)BP(t)= 1(s2t0)A + 2(s1t1)B + 1(s0t2)CP(t)= 1(s3t0)A + 3(s2t1)B + 3(s1t2)C + 1(s0t3)D
![Page 138: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/138.jpg)
Cubic Bezier Curves
» Write in all of the numeric coefficients...» Express each term as powers of s and t
P(t)= 1(s1t0)A + 1(s0t1)BP(t)= 1(s2t0)A + 2(s1t1)B + 1(s0t2)CP(t)= 1(s3t0)A + 3(s2t1)B + 3(s1t2)C + 1(s0t3)D
» Note: “s” exponents count down
![Page 139: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/139.jpg)
Cubic Bezier Curves
» Write in all of the numeric coefficients...» Express each term as powers of s and t
P(t)= 1(s1t0)A + 1(s0t1)BP(t)= 1(s2t0)A + 2(s1t1)B + 1(s0t2)CP(t)= 1(s3t0)A + 3(s2t1)B + 3(s1t2)C + 1(s0t3)D
» Note: “s” exponents count down» Note: “t” exponents count up
![Page 140: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/140.jpg)
Cubic Bezier Curves
» Write in all of the numeric coefficients...» Express each term as powers of s and t
P(t)= 1(s1t0)A + 1(s0t1)BP(t)= 1(s2t0)A + 2(s1t1)B + 1(s0t2)CP(t)= 1(s3t0)A + 3(s2t1)B + 3(s1t2)C + 1(s0t3)D
» Note: numeric coefficients are from Pascal’s Triangle...
![Page 141: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/141.jpg)
Cubic Bezier Curves
» What if t = 0.5 ? (halfway through the curve)so then... s = 0.5 also
P(t) = (s3)A + 3(s2t)B + 3(st2)C + (t3)Dbecomes
P(t) = (.53)A + 3(.52*.5)B + 3(.5*.52)C + (.53)Dbecomes
P(t) = (.125)A + 3(.125)B + 3(.125)C + (.125)Dbecomes
P(t) = .125A + .375B + .375C + .125D
![Page 142: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/142.jpg)
Cubic Bezier Curves
» Cubic Bezier Curves can also be “S-shaped”, if their control points are “twisted” as pictured here.
![Page 143: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/143.jpg)
Cubic Bezier Curves
» Cubic Bezier Curves can also be “S-shaped”, if their control points are “twisted” as pictured here.
![Page 144: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/144.jpg)
Cubic Bezier Curves
» They can also loop back around in extreme cases.
![Page 145: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/145.jpg)
Cubic Bezier Curves
» They can also loop back around in extreme cases.
![Page 146: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/146.jpg)
Seen in lots of places:
» Photoshop» GIMP» PostScript» Flash» AfterEffects» 3DS Max» Metafont
» Understable Disc Golf flight path, from above
Cubic Bezier Curves
![Page 147: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/147.jpg)
Splines
![Page 148: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/148.jpg)
Splines
» Okay, enough of Curves already.
» So... what’s a Spline?
![Page 149: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/149.jpg)
Splines
A spline is a chain of curves joined end-to-end.
![Page 150: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/150.jpg)
Splines
A spline is a chain of curves joined end-to-end.
![Page 151: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/151.jpg)
Splines
A spline is a chain of curves joined end-to-end.
![Page 152: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/152.jpg)
Splines
A spline is a chain of curves joined end-to-end.
![Page 153: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/153.jpg)
Splines
» Curve end/start points (welds) are knots
![Page 154: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/154.jpg)
Splines
» Think of two different ts:
spline’s t: Zero at start of spline, keeps increasing until the end of the spline chain
local curve’s t: Resets to 0 at start of each curve (at each knot).
» Conventionally, the local curve’s t isfmod( spline_t, 1.0 )
![Page 155: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/155.jpg)
Splines
For a spline of 4 curve-pieces:
» Interpolate spline_t from 0.0 to 4.0
» If spline_t is 2.67, then we are:67% through this curve (local_t = .67)In the third curve section (0,1,2,3)
» Plug local_t into third curve equation
![Page 156: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/156.jpg)
Splines
» Interpolating spline_t from 0.0 to 4.0...
![Page 157: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/157.jpg)
Splines
» Interpolating spline_t from 0.0 to 4.0...
![Page 158: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/158.jpg)
Splines
» Interpolating spline_t from 0.0 to 4.0...
![Page 159: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/159.jpg)
Splines
» Interpolating spline_t from 0.0 to 4.0...
![Page 160: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/160.jpg)
Splines
» Interpolating spline_t from 0.0 to 4.0...
![Page 161: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/161.jpg)
Splines
» Interpolating spline_t from 0.0 to 4.0...
![Page 162: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/162.jpg)
Splines
» Interpolating spline_t from 0.0 to 4.0...
![Page 163: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/163.jpg)
Splines
» Interpolating spline_t from 0.0 to 4.0...
![Page 164: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/164.jpg)
Splines
» Interpolating spline_t from 0.0 to 4.0...
![Page 165: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/165.jpg)
Quadratic Bezier Splines
» This spline is a quadratic Bezier spline,since it is made out ofquadratic Bezier curves
![Page 166: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/166.jpg)
Continuity
» Good continuity (C1); connected andaligned
» Poor continuity (C0); connected but not aligned
![Page 167: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/167.jpg)
Continuity
» To ensure good continuity (C1), make BC of first curve colinear (in line with) AB of second curve.
(derivative is continuous across entire spline)
![Page 168: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/168.jpg)
Continuity
» Excellent continuity (C2) is when speed/density matches on either side of each knot.
(second derivative is continuous across entire spline)
![Page 169: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/169.jpg)
Cubic Bezier Splines
» We can build a cubic Bezier spline instead by using cubic Bezier curves.
![Page 170: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/170.jpg)
Cubic Bezier Splines
» We can build a cubic Bezier spline instead by using cubic Bezier curves.
![Page 171: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/171.jpg)
Cubic Bezier Splines
» We can build a cubic Bezier spline instead by using cubic Bezier curves.
![Page 172: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/172.jpg)
Cubic Hermite Splines
![Page 173: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/173.jpg)
Cubic Hermite Splines
» A cubic Hermite spline is very similar to a cubic Bezier spline.
![Page 174: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/174.jpg)
Cubic Hermite Splines» However, we do not specify the B and C guide points.» Instead, we give the velocity at point A (as U), and the
velocity at D (as V) for each cubic Hermite curve.
U
V
![Page 175: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/175.jpg)
Cubic Hermite Splines» To ensure connectedness (C0), D from curve #0 is
again welded on top of A from curve #1 (at a knot).
![Page 176: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/176.jpg)
Cubic Hermite Splines» To ensure smoothness (C1), velocity into D (V) must
match velocity’s direction out of the next curve’s A (U).
![Page 177: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/177.jpg)
Cubic Hermite Splines» For best continuity (C2), velocity into D (V) must match
direction and magnitude for the next curve’s A (U).(Hermite splines usually do match velocity magnitudes)
![Page 178: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/178.jpg)
Cubic Hermite Splines
» Hermite curves, and Hermite splines, are also parametric and work basically the same way as Bezier curves: plug in “t” and go!
» The formula for cubic Hermite curve is:
P(t) = s2(1+2t)A + t2(1+2s)D + s2tU + st2V
![Page 179: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/179.jpg)
Cubic Hermite Splines» Cubic Hermite and Bezier curves can be
converted back and forth.
» To convert from cubic Hermite to Bezier:
B = A + (U/3)C = D – (V/3)
» To convert from cubic Bezier to Hermite:
U = 3(B – A)V = 3(D – C)
![Page 180: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/180.jpg)
Catmull-Rom Splines
![Page 181: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/181.jpg)
Catmull-Rom Splines
» A Catmull-Rom spline is just a cubic Hermite spline with special values chosen for the velocities at the start (U) and end (V) points of each section.
» You can also think of Catmull-Rom not as a type of spline, but as a technique for building cubic Hermite splines.
» Best application: curve-pathing through points
![Page 182: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/182.jpg)
Catmull-Rom Splines
» Start with a series of points (spline start, spline end, and interior knots)
![Page 183: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/183.jpg)
Catmull-Rom Splines
» 1. Assume U and V velocities are zero at start and end of spline (points 0 and 6 here).
![Page 184: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/184.jpg)
Catmull-Rom Splines
» 2. Compute a vector from point 0 to point 2.(Vec0_to_2 = P2 – P0)
![Page 185: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/185.jpg)
Catmull-Rom Splines
» That will be our tangent for point 1.
![Page 186: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/186.jpg)
Catmull-Rom Splines
» 3. Set the velocity for point 1 to be ½ of that.
![Page 187: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/187.jpg)
Catmull-Rom Splines
» Now we have set positions 0 and 1, and velocities at points 0 and 1. Hermite curve!
![Page 188: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/188.jpg)
Catmull-Rom Splines
» 4. Compute a vector from point 1 to point 3.(Vec1_to_3 = P3 – P1)
![Page 189: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/189.jpg)
Catmull-Rom Splines
» That will be our tangent for point 2.
![Page 190: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/190.jpg)
Catmull-Rom Splines
» 5. Set the velocity for point 2 to be ½ of that.
![Page 191: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/191.jpg)
Catmull-Rom Splines
» Now we have set positions and velocities for points 0, 1, and 2. We have a Hermite spline!
![Page 192: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/192.jpg)
Catmull-Rom Splines
» Repeat the process to compute velocity at point 3.
![Page 193: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/193.jpg)
Catmull-Rom Splines
» Repeat the process to compute velocity at point 3.
![Page 194: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/194.jpg)
Catmull-Rom Splines
» And at point 4.
![Page 195: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/195.jpg)
Catmull-Rom Splines
» And at point 4.
![Page 196: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/196.jpg)
Catmull-Rom Splines
» Compute velocity for point 5.
![Page 197: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/197.jpg)
Catmull-Rom Splines
» Compute velocity for point 5.
![Page 198: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/198.jpg)
Catmull-Rom Splines
» We already set the velocity for point 6 to be zero, so we can close out the spline.
![Page 199: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/199.jpg)
Catmull-Rom Splines
» And voila! A Catmull-Rom (Hermite) spline.
![Page 200: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/200.jpg)
Catmull-Rom Splines
Here’s the math for a Catmull-Rom Spline:
» Place knots where you want them (A, D, etc.)» Position at the Nth point is PN
» Velocity at the Nth point is VN
» VN = (PN+1 – PN-1) / 2
» i.e. Velocity at point P is half of [the vector pointing from the previous point to the next point].
![Page 201: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/201.jpg)
Cardinal Splines
![Page 202: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/202.jpg)
Cardinal Splines
» Same as a Catmull-Rom spline, but with an extra parameter: Tension.
» Tension can be set from 0 to 1.
» A tension of 0 is just a Catmull-Rom spline.
» Increasing tension causes the velocities at all points in the spline to be scaled down.
![Page 203: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/203.jpg)
Cardinal Splines
» So here is a Cardinal spline with tension=0(same as a Catmull-Rom spline)
![Page 204: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/204.jpg)
Cardinal Splines
» So here is a Cardinal spline with tension=.5(velocities at points are ½ of the Catmull-Rom)
![Page 205: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/205.jpg)
Cardinal Splines
» And here is a Cardinal spline with tension=1(velocities at all points are zero)
![Page 206: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/206.jpg)
Cardinal SplinesHere’s the math for a Cardinal Spline:
» Place knots where you want them (A, D, etc.)» Position at the Nth point is PN
» Velocity at the Nth point is VN
» VN = (1 – tension)(PN+1 – PN-1) / 2
» i.e. Velocity at point P is some fraction ofhalf of [the vector pointing from the previous point to the next point].
» i.e. Same as Catmull-Rom, but VN gets scaled down because of the (1 – tension) multiply.
![Page 207: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/207.jpg)
Other Spline Types
![Page 208: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/208.jpg)
Kochanek–Bartels Splines» Same as a Cardinal spline (includes Tension),
but with two extra tweaks (usually set on the entire spline):
Bias (from -1 to +1):A zero bias leaves the velocity vector aloneA positive bias rotates the velocity vector to be more aligned with the point BEFORE this pointA negative bias rotates the velocity vector to be more aligned with the point AFTER this point
Continuity (from -1 to +1):A zero continuity leaves the velocity vector aloneA positive continuity “poofs out” the cornersA negative continuity “sucks in / squares off” corners
![Page 209: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/209.jpg)
B-Splines
» Stands for “basis spline”.» Just a generalization of Bezier splines.» The basic idea:
At any given time, P(t) is a weighted-average blend of 2, 3, 4, or more points in its neighborhood.
» Equations are usually given in terms of the blend weights for each of the nearby points based on where t is at.
![Page 210: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/210.jpg)
Curved Surfaces» Way beyond the scope of this talk, but
basically you can criss-cross splines and form 2d curved surfaces.
![Page 211: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/211.jpg)
Thanks!
![Page 212: Interpolation and Splinestwvideo01.ubm-us.net/o1/vault/gdc09/slides/03-GDC... · -Squirrel’s wife. Implicit Equations. Implicit equations define what is, and isn’t, included in](https://reader036.fdocuments.in/reader036/viewer/2022090604/60584729cd11001e3d0a1ee4/html5/thumbnails/212.jpg)
Feel free to contact me:
Squirrel EiserlohDirector
TrueThought LLC
[email protected]@TrueThought.com