Computer Graphics Keyframing and Interpola8on

Similar documents
Curves. Hakan Bilen University of Edinburgh. Computer Graphics Fall Some slides are courtesy of Steve Marschner and Taku Komura

Computergrafik. Matthias Zwicker Universität Bern Herbst 2016

CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier

Arsène Pérard-Gayot (Slides by Piotr Danilewski)

CSE 167: Lecture 11: Bézier Curves. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012

CGT 511. Curves. Curves. Curves. What is a curve? 2) A continuous map of a 1D space to an nd space

Introduction to Computer Graphics. Modeling (1) April 13, 2017 Kenshi Takayama

Animation Curves and Splines 1

Keyframing. CS 448D: Character Animation Prof. Vladlen Koltun Stanford University

Reading. w Foley, Section 11.2 Optional

MAT300/500 Programming Project Spring 2019

Approximation of Circular Arcs by Parametric Polynomials

Sample Exam 1 KEY NAME: 1. CS 557 Sample Exam 1 KEY. These are some sample problems taken from exams in previous years. roughly ten questions.

M2R IVR, October 12th Mathematical tools 1 - Session 2

Bernstein polynomials of degree N are defined by

13 Path Planning Cubic Path P 2 P 1. θ 2

The Essentials of CAGD

Bézier Curves and Splines

Interpolation and polynomial approximation Interpolation

Cubic Splines; Bézier Curves

Physics 1A, Lecture 3: One Dimensional Kinema:cs Summer Session 1, 2011

Curves, Surfaces and Segments, Patches

Interpolation and polynomial approximation Interpolation

Vectors Coordinate frames 2D implicit curves 2D parametric curves. Graphics 2008/2009, period 1. Lecture 2: vectors, curves, and surfaces

Lecture 20: Bezier Curves & Splines

Lecture 23: Hermite and Bezier Curves

Intro Vectors 2D implicit curves 2D parametric curves. Graphics 2012/2013, 4th quarter. Lecture 2: vectors, curves, and surfaces

MAT 300 Midterm Exam Summer 2017

Intro Vectors 2D implicit curves 2D parametric curves. Graphics 2011/2012, 4th quarter. Lecture 2: vectors, curves, and surfaces

G-code and PH curves in CNC Manufacturing

Lecture 20: Lagrange Interpolation and Neville s Algorithm. for I will pass through thee, saith the LORD. Amos 5:17

Robotics I. June 6, 2017

Parametric Curves. (Com S 477/577 Notes) Yan-Bin Jia. Oct 3, 2017

Exponen'al func'ons and exponen'al growth. UBC Math 102

CONTROL POLYGONS FOR CUBIC CURVES

Homework 5: Sampling and Geometry

Introduction to Curves. Modelling. 3D Models. Points. Lines. Polygons Defined by a sequence of lines Defined by a list of ordered points

Elementary maths for GMT

Hermite Interpolation with Euclidean Pythagorean Hodograph Curves

Numerical Methods in Physics

MA 323 Geometric Modelling Course Notes: Day 07 Parabolic Arcs

The singular properties of the Hermit curve on Unit Circle

Pseudospectral Methods For Op2mal Control. Jus2n Ruths March 27, 2009

Lecture for Week 6 (Secs ) Derivative Miscellany I

Pythagorean-hodograph curves

Smooth Path Generation Based on Bézier Curves for Autonomous Vehicles

Lecture 8: Kinematics: Path and Trajectory Planning

Reading. Realistic Character Animation. Modeling Realistic Motion. Two Approaches

Lagrange Interpolation and Neville s Algorithm. Ron Goldman Department of Computer Science Rice University

Revolving: Polar Coordinates

Gradient Descent for High Dimensional Systems

MA 323 Geometric Modelling Course Notes: Day 11 Barycentric Coordinates and de Casteljau s algorithm

Curve Fitting: Fertilizer, Fonts, and Ferraris

MA 323 Geometric Modelling Course Notes: Day 12 de Casteljau s Algorithm and Subdivision

1.1. The analytical denition. Denition. The Bernstein polynomials of degree n are dened analytically:

CSE 473: Ar+ficial Intelligence. Probability Recap. Markov Models - II. Condi+onal probability. Product rule. Chain rule.

Math 32A Discussion Session Week 5 Notes November 7 and 9, 2017

Exercises for Multivariable Differential Calculus XM521

On-Line Geometric Modeling Notes

Curvature variation minimizing cubic Hermite interpolants

Geometric Lagrange Interpolation by Planar Cubic Pythagorean-hodograph Curves

Scientific Computing: An Introductory Survey

3.3 Increasing & Decreasing Functions and The First Derivative Test

From differen+al equa+ons to trigonometric func+ons. Introducing sine and cosine

There are a number of related results that also go under the name of "chain rules." For example, if y=f(u) u=g(v), and v=h(x), dy = dx

Dynamics and Time Integration. Computer Graphics CMU /15-662, Fall 2016

CSE 473: Ar+ficial Intelligence

Definition of differential equations and their classification. Methods of solution of first-order differential equations

Outline. 1 Interpolation. 2 Polynomial Interpolation. 3 Piecewise Polynomial Interpolation

Interpolation and Deformations A short cookbook

1 Trajectory Generation

Lecture 8: Coordinate Frames. CITS3003 Graphics & Animation

Self-Influencing Interpolation in Groundwater Flow

Math 3c Solutions: Exam 2 Fall 2017

Sta$s$cal sequence recogni$on

Image Processing 1 (IP1) Bildverarbeitung 1

PHYS1121 and MECHANICS

Unit 3: Ra.onal and Radical Expressions. 3.1 Product Rule M1 5.8, M , M , 6.5,8. Objec.ve. Vocabulary o Base. o Scien.fic Nota.

1 Roots of polynomials

2. Interpolation. Closing the Gaps of Discretization...

Interpolation of Rigid Motions in 3D

THE UNIVERSITY OF BRITISH COLUMBIA Midterm Examination 14 March 2001

BROWN UNIVERSITY MATH 0350 MIDTERM 19 OCTOBER 2017 INSTRUCTOR: SAMUEL S. WATSON

A Relationship Between Minimum Bending Energy and Degree Elevation for Bézier Curves

CS Homework 3. October 15, 2009

Let's look at some higher order equations (cubic and quartic) that can also be solved by factoring.

Calculus: Graphical, Numerical, Algebraic 2012

Empirical Models Interpolation Polynomial Models

C 2 Continuous Gait-Pattern Generation for Biped Robots

COMPLETE FEATURE COMPARISON LIST

MEAM 520. More Velocity Kinematics

From average to instantaneous rates of change. (and a diversion on con4nuity and limits)

MA 323 Geometric Modelling Course Notes: Day 20 Curvature and G 2 Bezier splines

MATH 350: Introduction to Computational Mathematics

Calculus Graphical, Numerical, Algebraic 2012

CG Basics 1 of 10. Mathematical Foundations: Vectors, Matrices, & Parametric Equations

Study Resources For Algebra I. Unit 2A Graphs of Quadratic Functions

Lecture V: The game-engine loop & Time Integration

Home Page. Title Page. Contents. Bezier Curves. Milind Sohoni sohoni. Page 1 of 27. Go Back. Full Screen. Close.

Transcription:

Computer Graphics Keyframing and Interpola8on

This Lecture Keyframing and Interpola2on two topics you are already familiar with from your Blender modeling and anima2on of a robot arm Interpola2on linear cubic

Keyframing The simplest form of anima2ng an object θ 3 c 1 c 2 θ 1 c 3 θ 2 A 60 sec anima2on Video: 30 frames / sec = 1800 frames We have 6 key frames Keyframe system must generate 1794 frames t=0 t=50ms What s the in- between mo2on?

Interpola8on Mathema2cal problem: Given a set of points, what are the most reasonable points in between?

Simplest Linear Interpola8on. just use a weighted average between points. We abbreviate linearly interpolate as Lirp

The simplest solu2on given: p 0 and p 1 t is our control variable Linear Interpola8on p 1 Q Q(t) = (1 t)p 0 + tp 1 p 0 0 t 1 Note: we only do this for t between 0 and 1, inclusive

Linear Interpola8on: General Case What if we are not given values at t=0 and t=1? Say the value is p 0 at t 0 and p 1 at t 1 p 1 Q p 0 t ' = t t 0 t 1 t 0 t 0 t t 1 Q(t) = (1 t ')p 0 + t ' p 1 From this point on, we will assume that t varies 0 to 1

Linear Interpola8on: Example 1 An object lies at posi2on y 0 = 2 at 2me t = 0 and posi2on y 1 = 3.1 at 2me t = 1. Using linear interpola2on, approximate the posi2on of the object at 2me t = 0.6. y = (1 t)y 0 + ty 1 Answer: y 0 =2, y 1 =3.1, t=0.6 y = (1 0.6) 2 + 0.6 3.1 y = 2.66

Linear Interpola8on: Example 2 The brightness of a moving light source is b 0 = 1.0 when it lies at posi2on x 0 = 1.1 and b 1 = 0.5 when it lies at posi2on x 1 = 1.5. Using linear interpola2on, approximate the brightness of the light source when it lies at posi2on x = 1.4. We start at p 0 = 1.1, end at p 1 = 1.5, approximate at x = 1.4 Approximate at x =0.75: x' = (x x 0 ) / (x 1 x 0 ) x' = (1.4 1.1) / (1.5 1.1) = 0.75 b = (1 x')b 0 + x'b 1 b = (1 0.75) 1.0 + 0.75 0.5 = 0.625

Linear Interpola8on: Example 3 The (x,y) posi2on of an object is (0, 1) at 2me t = 0 and (2, 10) at t = 1. Using linear interpola2on, approximate the posi2on of the object at 2me t = 0.1. Linearly interpolate the two coordinates separately x = (1 t)x 1 + tx 2 x = (1 0.1) 0 + 0.1 2 = 0.2 y = (1 t)y 1 + ty 2 y = (1 0.1) 1+ 0.1 10 =1.9 The object posi2on at 2me 0.1 is (0.2, 1.9)

Hands- On Session Download robotinterp.cpp, keyframe.cpp, keyframe.h and keyframe.txt from the class website Copy keyframe.txt to the resources folder of the project 05_asset_instance, then add it to the resources group of this project. Depending on the configura2on on your compiler, you might need to save it in the Debug directory of your project. Copy robotinterp.cpp, keyframe.cpp, keyframe.h to the sources directory of 05_asset_instance, and add them to your project. The file robotinterp.cpp will replace the current main file of your project. The keyframe files include code for linear interpola2on Add the appropriate header files to robotinterp.cpp, then compile the project and run. Higng the key 'a' will start the robot anima2on based on linear interpola2on

Hands- On Ac8vity 1 The format of the keyframe.txt file is as follows: keyframe time param1 param2 Here time is the actual 2me of the keyframe, param1 is the lei upper arm angle, and param2 is the lei lower arm angle The file keyframe.cpp includes code for reading this file and interpola2ng all parameters given in the file Study the code for keyframe.cpp and the connec2on with robotinterp.cpp (in Update, by means of the params array) Add code to robotinterp.cpp and configure keyframe.txt to have the robot wave both arms Show the anima2on to your instructor when finished

Hands- On Ac8vity 2 You can interpolate not only the joint angles of the robot, but also the posi2on or other akributes (color, texture, lights, camera) Let s experiment with the robot posi2on in the world: Add another parameter to keyframe.txt to represent the robot posi2on in each keyframe (in addi2on to joint angles) Add code to robotinterp.cpp to make the robot change posi2on (for example, it may vanish along the nega2ve z- axis) while waving Show the anima2on to your instructor when finished

Hands- On Ac8vity 3 In your latest assignment you got a taste of Vizard and its power for quick graphics development. Extend your Vizard script to make the camera fly over the piazza using keyframe interpola2on: You may hardcode the keyframes, so that you can focus on interpola2on rather than file handling. For example, if you alter only the (x,y,z) posi2on of the camera, your keyframes look like keyframes = [[0,0,0,0],[1.2,0,3,2],[2.2,5,3,4], etc.] Define a func2on linearinterpolation(time) similar to the one given in the OpenGL robot code Define a func2on navigate that uses linear interpola2on to set the posi2on (and orienta2on) of your camera, and schedule its execu2on using a 2mer

Hands- On Ac8vity 3 (contd.) To make sure that your linearinterpolation func2on works properly, place an object of your choice at each interpolated posi2on to trace the path that the camera takes. Here s an example: Show the anima2on to your instructor when finished

Hands- On Ac8vity 4 In your latest assignment you have also imported your own Blender object into your graphics scene Extend your Vizard script to make your Blender object move around the piazza using keyframe interpola2on Show the anima2on to your instructor when finished

Linear Interpola8on: Limita8ons Requires a large number of keyframes when the mo2on is highly nonlinear Solu2on: cubic interpola2on

Cubic Interpola8on

Parametric Curves We want con2nuous smooth curve f passing through the data points Explicit form y = f (x) Implicit form f (x, y) = 0 (x, y) Parametric form x = f (t), y = g(t)

Parametric Curve Example What curve does this represent? x = cos(t) y = sin(t)

Cubic Curves We can use a cubic func2on to represent a smooth curve in 3D Q x (t) = a x t 3 + b x t 2 + c x t + d x 0 t 1 Vector form: Q y (t) = a y t 3 + b y t 2 + c y t + d y Q z (t) = a z t 3 + b z t 2 + c z t + d z a = a x a y a z % Q(t) = at 3 + bt 2 + ct + d

Smooth Curves Controlling the shape of the curve Q x 2 3 ( t) = 1 t + t t Q x 2 3 ( t) = 1 t + 3t t

Constraints on the Cubics How many constraints do we need to determine a cubic curve? 4 control points Q(t) = at 3 + bt 2 + ct + d Q(t 1 ) Q(t 2 ) Q(t 3 ) Q(t 1 ) Q(t 2 ) Q(t 3 ) Q(t 4 ) = % 3 t 1 3 t 2 3 t 3 3 t 4 2 t 1 2 t 2 2 t 3 2 t 4 t 1 1 t 2 1 t 3 1 t 4 1 % a b c d % a b c d = % 3 t 1 3 t 2 3 t 3 3 t 4 2 t 1 2 t 2 2 t 3 2 t 4 t 1 1 t 2 1 t 3 1 t 4 1 % 1 Q(t 4 ) Q(t 1 ) Q(t 2 ) Q(t 3 ) Q(t 4 ) %

Natural Cubic Curve Q(t) = at 3 + bt 2 + ct + d Q(t 1 ) Q(t 2 ) Q(t 3 ) Q(t 4 ) Q(t) = t 3 t 2 t 1 % 3 t 1 3 t 2 3 t 3 3 t 4 2 t 1 2 t 2 2 t 3 2 t 4 t 1 1 t 2 1 t 3 1 t 4 1 % 1 Q(t 1 ) Q(t 2 ) Q(t 3 ) Q(t 4 ) % Control Points Q = (Q x, Q y, Q z )

Natural Cubic Spline A spline is a curve that is piecewise- defined and is smooth at the places where the pieces connect p 0 p 4 Disadvantage: p 1 p 2 p 3 p 6 No local control Solu2on: p 5 Hermite spline

Hermite Curves

Hermite Curves A Hermite curve is a cubic curve determined by endpoints p 0 and p 1 tangent vectors (veloci2es) v 0 and v 1 at endpoints v 0 v 1 p 1 p 0 Demo hkp://processingjs.nihongoresources.com/bezierinfo/

Examples of Hermite Curves

Review Tangents (Deriva8ves) Finding the deriva2ve of a curve is easy: Q = at 3 + bt 2 + ct + d dq dt = 3at 2 + 2bt + c Q = t 3 t 2 t 1 % a b c d % dq dt = 3t 2 2t 1 0 % a b c d % v 0 v 1 p 1 p 0

Hermite Curves v 0 p 0 v 1 p 1 Q(t) = at 3 + bt 2 + ct + d Q'(t) = 3at 2 + 2bt + c The curve value is Q(0)=p 1 at t=0 and Q(1)=p 1 at t=1 The deriva2ve of the curve is v 0 at t=0 and v 1 at t=1

Hermite Curves v 0 p 0 v 1 p 1 Q(t) = at 3 + bt 2 + ct + d Q'(t) = 3at 2 + 2bt + c Q 0 ( ) Q 1 ( ) Q' 0 ( ) Q' 1 ( ) = p 0 = p 1 = v 0 = v 1 = a 0 3 + b 0 2 + c 0 + d = a 1 3 + b 1 2 + c 1+ d = 3a 0 2 + 2b 0 + c = 3a 1 2 + 2b 1+ c = d = a + b + c + d = c = 3a + 2b + c

Hermite Curves v 1 p 1 p 0 v 0 c b a v c v d c b a p d p + + = = + + + = = 2 3 1 0 1 0 p 0 p 1 v 0 v 1 % = 0 0 0 1 1 1 1 1 0 0 1 0 3 2 1 0 % a b c d %

Matrix Form of Hermite Curve a b c d % = 0 0 0 1 1 1 1 1 0 0 1 0 3 2 1 0 % 1 p 0 p 1 v 0 v 1 % v 1 p 1 p 0 v 0 a b c d % = 2 2 1 1 3 3 2 1 0 0 1 0 1 0 0 0 % p 0 p 1 v 0 v 1 %

Hermite Interpola8on v 0 Q = t 3 t 2 t 1 p 0 v 1 p 1 % 2 2 1 1 3 3 2 1 0 0 1 0 1 0 0 0 Hermite Basis Matrix % p 0 p 1 v 0 v 1 % p 0 x p 0 y p 0z p 1x p 1y p 1z v 0 x v 0 y v 0z v 1x v 1y v 1z %

Hands- On Ac8vity 5 Extend your Vizard script to trace a curve over the piazza using Hermite keyframe interpola2on. Each keyframe needs 7 parameters: 2me, posi2on (x, y, z) and velocity (x, y, z). Example: keyframes = [[0,-2,0,5,0,10,0],[1,2,0,5,0,-10,0]] What shape is this curve? Define a func2on HermiteInterpolation(time)that implements Hermite interpola2on Q = t 3 t 2 t 1 Define a func2on drawcurve that uses Hermite interpola2on to set the posi2on of an object of your choice along the curve Schedule the execu2on of drawcurve using a 2mer Show the graphics output to your instructor when finished % 2 2 1 1 3 3 2 1 0 0 1 0 1 0 0 0 % p 0 p 1 v 0 v 1 %

Hands- On Ac8vity 5 Output Example

Splines: Chaining Curve Segments Spline = piecewise polynomial curve Spline that is not C1- con2nuous Spline that is C1- con2nuous hkp://wiki.blender.org/

Problems with Splines? Must explicitly define deriva2ves at each point How can we solve this? Catmull- Rom Splines

Catmull- Rom spline Tangent at P i is half the vector connec2ng P i- 1 to P i+1 p i p' i = p i+1 p i 1 2

Demo hkps://www.youtube.com/watch?v=0bdjhxloy8 Compared with Hermite/Bezier: Fewer control points needed, but less freedom

Catmull Rom Spline Hermite curve Q = t 3 t 2 t 1 % 2 2 1 1 3 3 2 1 0 0 1 0 1 0 0 0 % p 0 p 1 v 0 v 1 % For two control points p i and p i+1 Q = t 3 t 2 t 1 % 2 2 1 1 3 3 2 1 0 0 1 0 1 0 0 0 % p i p i+1 p i+1 p i 1 2 p i+2 p i 2 %

Catmull- Rom Spline Q = t 3 t 2 t 1 % 2 2 1 1 3 3 2 1 0 0 1 0 1 0 0 0 % p i p i+1 p i+1 p i 1 2 p i+2 p i 2 % Q = t 3 t 2 t 1 % 2 2 1 1 3 3 2 1 0 0 1 0 1 0 0 0 % 0 1 0 0 0 0 1 0 1 1 0 2 2 0 0 1 1 0 2 2 % p i 1 p i p i+1 p i+2 %

Catmull- Rom Spline End result Q = 1 2 t 3 t 2 t 1 % 1 3 3 1 2 5 4 1 1 0 1 0 0 2 0 0 % p i 1 p i p i+1 p i+2 % Curve piece between control points p i and p i+1 First and last curve segments are special cases

Hands- On Ac8vity 6 Extend your Vizard script to trace a Catmull- Rom spline over the piazza

Contact pose - Both legs are at their extreme point. Opposite arm is forward. Recoil - Weight falls on the recoil pose. Front foot fully touches. Body at lowest posi2on, arms at extreme. Passing - Back leg passes the contact leg. Arms at sides. High point - Body at highest pose. Back leg is pushing body forward. Back toe peels off the ground. Contact DOWN to Recoil UP to high- point AND Contact - -..

OpenGL Assignment Animate the robot to walk: Set the key walking poses interac2vely Save the walking poses Interpolate between them OR animate your hierarchical object The one from Assignment 6 is a good choice Set a small number of key frames Interpolate between them Assignment details on the class website

Use the your own character or the one provided by your instructor. 1. Use the Auto Key technique. 2. Set your total anima2on 2me to 25 frames (8 sec) 3. Hint: The 2me between strides is 1 second for full cycle (30 frames), ½ second per leg (15 frames) 4. Note the body translates at a constant rate in space

Demos Addi2onal Online Material hkp://algorithmist.wordpress.com/online- demos/ OpenGL curves hkp://www.glprogramming.com/red/chapter12.html

Bezier Curves

Bezier Curves Specifying tangent vectors may some2mes be inconvenient Bezier curves indirectly specify tangent vectors at p 0 and p 3 by specifying two intermediate points, p 1 and p 2 p 1 p 0 Q(t) p 2 How to define Bezier Curves? p 3

Bezier Curve Formula8on There are lots of ways to formulate Bezier curves: De Castlejau (recursive linear interpola2ons) Bernstein polynomials Cubic equa2ons Matrix form In prac2ce, matrix form is the most useful in computer anima2on, but the others are important for understanding

Bezier Curves Find the curve Q(t) as a func2on of parameter t endpoints p 0 and p 3 tangents aligned with p 0 p 1 and p 3 p 2 v0=α(p1- p0) v1=α(p3- p2) p 1 p 0 Q(t) p 2 p 3

De Casteljau Algorithm Recursive series of linear interpola2ons Given p 0,p 1,p 2,p 3, find Q(t), 0 t 1 We use t=0.25 p 1 p 0 p 2 p 3

De Casteljau Algorithm Lirp t, a, b ( ) = 1 t ( )a + tb p 1 q 0 = Lirp( t, p 0, p ) 1 q 1 = Lirp( t, p 1, p ) 2 q 2 = Lirp( t, p 2, p ) 3 p 0 q 0 q 1 q 2 p 2 p 3

De Casteljau Algorithm p 1 r 0 = Lirp( t, q 0, q ) 1 p 0 q 0 r 0 q 1 r 1 r 1 = Lirp( t, q 1, q ) 2 p 2 q 2 p 3

De Casteljau Algorithm p 1 p 0 q 0 r 0 Q q 1 r 1 Q = Lirp( t, r 0, r ) 1 p 2 q 2 p 3

De Casteljau Algorithm Recursive Linear Interpola2on: p 1 p 0 Q p 2 Q = Lirp( t, r 0, r 1 ) ( ) ( ) r 0 = Lirp t, q 0, q 1 r 1 = Lirp t, q 1, q 2 ( ) ( ) ( ) q 0 = Lirp t, p 0, p 1 q 1 = Lirp t, p 1, p 2 q 2 = Lirp t, p 2, p 3 p p p p 0 1 2 3 p 3

Demo hkp://en.wikipedia.org/wiki/b%c3%a9zier_curve

Expanding the Lirps q 0 = Lirp( t, p 0, p ) 1 = ( 1 t)p 0 + tp 1 q 1 = Lirp( t, p 1, p ) 2 = ( 1 t)p 1 + tp 2 q 2 = Lirp( t, p 2, p ) 3 = ( 1 t)p 2 + tp 3 r 0 = Lirp( t, q 0, q ) 1 = ( 1 t) 1 t r 1 = Lirp( t, q 1, q ) 2 = ( 1 t) 1 t Q = Lirp( t, r 0, r ) 1 = ( 1 t) ( 1 t) 1 t + t 1 t (( )p 0 + tp ) 1 + t ( 1 t)p 1 + tp 2 ( ) (( )p 1 + tp ) 2 + t ( 1 t)p 2 + tp 3 ( ) ( (( )p 0 + tp ) 1 + t (( 1 t)p 1 + tp )) 2 (( )(( 1 t)p 1 + tp ) 2 + t (( 1 t)p 2 + tp )) 3

Bernstein Form of a Bezier Curve Q = 1 t ( (( )p 0 + tp ) 1 + t (( 1 t)p 1 + tp )) 2 ( ) ( 1 t) 1 t (( )(( 1 t)p 1 + tp ) 2 + t (( 1 t)p 2 + tp )) 3 + t 1 t Q = 1 t ( ) 3 p 0 + 3 1 t ( ) 2 tp 1 + 3 1 t ( )t 2 p 2 + t 3 p 3 B 3 0 (t) = (1 t)3 B 3 1 (t) = 3t(1 t)2 B 3 2(t) = 3t 2 (1 t) Cubic B 3 3 (t) = t3 Q = B 0 3 ( t)p 0 + B 3 ( 1 t)p 1 + B 3 ( 2 t)p 2 + B 3 ( 3 t)p 3 Bernstein Polynomials Expansion of (1- t+t) 3

Bezier Cubic Equa8on Form Q = 1 t ( ) 3 p 0 + 3 1 t ( ) 2 tp 1 + 3 1 t ( )t 2 p 2 + t 3 p 3 Regroup the equa2on by terms of exponents of t, to get it in the standard cubic form: Q = ( t 3 + 3t 2 3t +1)p 0 + ( 3t 3 6t 2 + 3t)p 1 + ( 3t 3 + 3t 2 )p 2 + ( t 3 )p 3 Q = ( p 0 + 3p 1 3p 2 + p 3 )t 3 + ( 3p 0 6p 1 + 3p 2 )t 2 + ( 3p 0 + 3p 1 )t + ( p 0 )1

Bezier Cubic Equa8on Form Q = ( p 0 + 3p 1 3p 2 + p 3 )t 3 + ( 3p 0 6p 1 + 3p 2 )t 2 + ( 3p 0 + 3p 1 )t + ( p 0 )1 Q = at 3 + bt 2 + ct + d a = ( p 0 + 3p 1 3p 2 + p ) 3 b = ( 3p 0 6p 1 + 3p ) 2 c = ( 3p 0 + 3p ) 1 d = ( p ) 0 This form is very good for fast evalua2on, as all constant terms (a,b,c,d) can be precomputed.

Bezier Matrix Form From cubic form a = ( p 0 + 3p 1 3p 2 + p ) 3 Q = at 3 + bt 2 + ct + d b = ( 3p 0 6p 1 + 3p ) 2 c = ( 3p 0 + 3p ) 1 d = ( p ) 0 to matrix form Q = t 3 t 2 t 1 % a b c d % a b c d = % 1 3 3 1 3 6 3 0 3 3 0 0 1 0 0 0 % p 0 p 1 p 2 p 3 %

Bezier Matrix Form Q = t 3 t 2 t 1 % 1 3 3 1 3 6 3 0 3 3 0 0 1 0 0 0 % p 0 p 1 p 2 p 3 % Q = t 3 t 2 t 1 % 1 3 3 1 3 6 3 0 3 3 0 0 1 0 0 0 % p 0 x p 0 y p 0z p 1x p 1y p 1z p 2 x p 2 y p 2z p 3x p 3y p 3z %

Hermite vs. Bezier Curves Hermite curves: Q = t 3 t 2 t 1 % 2 2 1 1 3 3 2 1 0 0 1 0 1 0 0 0 % p 0 p 1 v 0 v 1 % Bezier curves: Q = t 3 t 2 t 1 % 1 3 3 1 3 6 3 0 3 3 0 0 1 0 0 0 % p 0 p 1 p 2 p 3 %

Hermite vs. Bezier Curves It turns out that Bezier and Hermite curves can be related as follows: p 0 p 1 v 0 v 1 = % v 0 = 3(p 1 p 0 ) v 1 = 3(p 3 p 2 ) p 0 = p 0 p 1 = p 3 1 0 0 0 0 0 0 1 3 3 1 0 0 0 3 3 (lei as an exercise for those who want to figure out why) % p 0 p 1 p 2 p 3 %

Bezier Splines Bezier Spline