370 likes | 530 Views
Simulation and Animation. Key frame Interpolation. Keyframe Animation. Draw one keyframe after another Results in “rough” animation instead of a smooth transition from frame to frame. Keyframe Interpolation. Keyframe Interpolation. Keyframe Interpolation. Simple Translations.
E N D
Simulation and Animation Key frame Interpolation
Keyframe Animation Draw one keyframe after another Results in “rough” animation instead of a smooth transition from frame to frame
Simple Translations Linear Interpolation is fine here But what about rotations?
Linear Interpolation of Rotations K = (1-a) A + a B (linear interpolation: lerp) Introduces non linear behavior on the arc
SLERP • Approach bymeansofslerp = sphericallinear interpolation • with • itfollows P A B
Quaternion Power Operator [ cos(q/2), sin(q /2) * A] a = [cos(aq/2), sin(aq /2) * A] q a rotates to q orientation as a goes from 0 to 1 Quaternions: q = (qbqa-1) aqa (slerp) q = slerp(qa,qb, a)
Curves • So far: smooth linear interpolation along a line (or along an arc on the circle) • Now extend the idea so that interpolation follows a given path, a curve • In the following: description of curves
Consider the following: Data is sampled at discrete data points Want to know data values at an arbitrary position within the domain
The simple way • From n+1 known data samples construct a n-dimensional polynomial • n+1 Samples → n+1 knows • n-dimensional polynomial has n+1unknowns leads to system of n+1 linear equations
The simple way (cont.) • system of equations can be rewritten as matrix Vandermonde Matrix
How to handle multiple x values? • do not use a single approximation function but use n (=dimension of the domain) functions and a new parameter t from 0 to 1 • x(t)=x, y(t)=y, z(t)=z … y y(t) x(t) x
multiple x-values (cont.) leads to multiple polynomials can be rewritten in matrix form
Matrix notation C can be split up into M (basis matrix)G (geometry matrix) M is fixed for a given approach G depends on the specific curve to fit
Building M • derive a Matrix M for the Hermite approach • Hermite uses polynomials of degree 3 to a fit 2 points • it is an interpolation → 2 conditions • derivatives at the endpoints are given→ 2 conditions
Hermite interpolation • Cubic Hermite-Polynoms: Charles Hermite (1822-1901)
Hermite interpolation • Example:
Hermiteinterpolation • Properties: • Neither affine invariant with respect to control points nor with respect to vectors • No local control • Difficult to find tangent vectors • Curve segments can be attached continuously • Interpolation between points with tangents, e.g. for Keyframe-Animation with given position and velocity
Monom interpolation • Approach: Monom-Basis: {ti | i=0…n} • From p(ti) = aithesystemofequationsisderived: Vandermond Matrix Basis Control points 3 components per entry
Bézier-Curves • Idea: tangentvectorsdefinedbyfirstand last twopoints: • b0andbn will beinterpolated • bi will beapproximated • Relation toHermite-Interpolation: b1 b2 Example: cubic Bezier-Curve b3 b0 cubic Bézier-Curve
Bézier-Curves • … andHermite-Interpolation • Andforthecurve: Geometry vectorfor Bézier Matrix forBézier to Hermite with
Bézier-Curves • The cubic Bézier-Curve: • Bernstein-Polynoms ofdegreen: withdomain[0,1] Bézier-Control-Points Bernstein-Polynoms with
Bézier-Curves • Cubic Bernstein-Polynoms:
Bézier-Curves • Of degree n= 1: linear interpolation • Ofdegreen = 2: iterated linear interpolation
Bézier-Curves • Iterated linear interpolation for degree 2: Example fort = 0,4 http://www.vis.uni-stuttgart.de/~kraus/LiveGraphics3D/
Bezier Interpolation of Quaternions De Casteljau
Repeated mid-point interpolation For u = 1/4
Spline-Curves • Problem so far: polynomdegreedepends on numberofcontrolpoints • Idea: • Multiple segmentswithlowdegreeinsteadofonesegmentofhighdegree • Segments canbeofarbitrary type: • Hermite-Curves • Quadrics • Bézier-Curves • Importantis smooth transitionbetweensegments
Spline-Curves • Spline: • A thin flexible rodusedfortheconstructionofships • Deutsch: Straklatte, Strakfunktionen • A splineof n-thdegreeconsistsofpolynomialsegmentsofmaxdegree n • A cubicSplinedescribestheshapeof a thinrodthatisfixedatstartand end point
bi,2 bi,1 bi,3 = bi+1,0 bi,0 ui+1 ui bi+1,1 Bézier-Splines • Spline-Segments i: • Spline s(u) ist sum of segments