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

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

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

Bézier Curves and Splines

CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier

Computergrafik. Matthias Zwicker Universität Bern Herbst 2016

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

Interpolation and polynomial approximation Interpolation

Lecture 20: Bezier Curves & Splines

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

The Essentials of CAGD

MAT300/500 Programming Project Spring 2019

MA 323 Geometric Modelling Course Notes: Day 07 Parabolic Arcs

Bernstein polynomials of degree N are defined by

On-Line Geometric Modeling Notes

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

Lecture 23: Hermite and Bezier Curves

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

Reading. w Foley, Section 11.2 Optional

Curves, Surfaces and Segments, Patches

Approximation of Circular Arcs by Parametric Polynomials

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

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

Cubic Splines; Bézier Curves

Interpolation and polynomial approximation Interpolation

Computer Graphics Keyframing and Interpola8on

Chapter 4: Interpolation and Approximation. October 28, 2005

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.

Computer Aided Design. B-Splines

Math 660-Lecture 15: Finite element spaces (I)

Animation Curves and Splines 1

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

Extrapolation Methods for Approximating Arc Length and Surface Area

Chapter 1 Numerical approximation of data : interpolation, least squares method

Geometric Lagrange Interpolation by Planar Cubic Pythagorean-hodograph Curves

Q(s, t) = S M = S M [ G 1 (t) G 2 (t) G 3 1(t) G 4 (t) ] T

Computational Physics

Planar interpolation with a pair of rational spirals T. N. T. Goodman 1 and D. S. Meek 2

Visualizing Bezier s curves: some applications of Dynamic System Geogebra

Katholieke Universiteit Leuven Department of Computer Science

CS 536 Computer Graphics NURBS Drawing Week 4, Lecture 6

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

An O(h 2n ) Hermite approximation for conic sections

Curve Fitting: Fertilizer, Fonts, and Ferraris

CONTROL POLYGONS FOR CUBIC CURVES

1 Roots of polynomials

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

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

G-code and PH curves in CNC Manufacturing

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

Hermite Interpolation with Euclidean Pythagorean Hodograph Curves

Lecture 10 Polynomial interpolation

Section September 6, If n = 3, 4, 5,..., the polynomial is called a cubic, quartic, quintic, etc.

SPLINE INTERPOLATION

Scientific Computing

Geometric meanings of the parameters on rational conic segments

Curve Fitting. 1 Interpolation. 2 Composite Fitting. 1.1 Fitting f(x) 1.2 Hermite interpolation. 2.1 Parabolic and Cubic Splines

Subdivision Matrices and Iterated Function Systems for Parametric Interval Bezier Curves

Pythagorean-hodograph curves

Geometric Interpolation by Planar Cubic Polynomials

Curve Fitting and Interpolation

polynomial function polynomial function of degree n leading coefficient leading-term test quartic function turning point

There is a unique function s(x) that has the required properties. It turns out to also satisfy

Continuous Curvature Path Generation Based on Bézier Curves for Autonomous Vehicles

G 1 Hermite Interpolation by Minkowski Pythagorean Hodograph Cubics

Isogeometric Analysis with Geometrically Continuous Functions on Two-Patch Geometries

1 Review of Interpolation using Cubic Splines

Interpolation Theory

Spiral spline interpolation to a planar spiral

CHAPTER 4. Interpolation

November 20, Interpolation, Extrapolation & Polynomial Approximation

Threshold Autoregressions and NonLinear Autoregressions

EXPLICIT ERROR BOUND FOR QUADRATIC SPLINE APPROXIMATION OF CUBIC SPLINE

Interpolation and Deformations A short cookbook

A Variational Model for Data Fitting on Manifolds by Minimizing the Acceleration of a Bézier Curve

Cubic Splines MATH 375. J. Robert Buchanan. Fall Department of Mathematics. J. Robert Buchanan Cubic Splines

Polynomial approximation and Splines

Curvature variation minimizing cubic Hermite interpolants

Applied Math 205. Full office hour schedule:

Engineering 7: Introduction to computer programming for scientists and engineers

G 2 Curve Design with Generalised Cornu Spiral

Input: A set (x i -yy i ) data. Output: Function value at arbitrary point x. What for x = 1.2?

Interpolation and Deformations A short cookbook

Lösning: Tenta Numerical Analysis för D, L. FMN011,

INTERPOLATION. and y i = cos x i, i = 0, 1, 2 This gives us the three points. Now find a quadratic polynomial. p(x) = a 0 + a 1 x + a 2 x 2.

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

Scientific Computing: An Introductory Survey

MTH301 Calculus II Glossary For Final Term Exam Preparation

3.1 Interpolation and the Lagrange Polynomial

2 The De Casteljau algorithm revisited

CS 450 Numerical Analysis. Chapter 8: Numerical Integration and Differentiation

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

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

+ 2gx + 2fy + c = 0 if S

COS 424: Interacting with Data

Empirical Models Interpolation Polynomial Models

Lecture Note 3: Interpolation and Polynomial Approximation. Xiaoqun Zhang Shanghai Jiao Tong University

We consider the problem of finding a polynomial that interpolates a given set of values:

Automatic Control Motion planning

Q( t) = T C T =! " t 3,t 2,t,1# Q( t) T = C T T T. Announcements. Bezier Curves and Splines. Review: Third Order Curves. Review: Cubic Examples

Transcription:

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

Parametric curves X & Y coordinates defined by parameter t ( time) Example: Cycloid x t = t sin t y t = 1 cos t Tangent (aka. derivative, gradient) vector: x t, y t Polynomial curve: x t = i a i t i 2

Cubic Hermite curves Cubic polynomial curve interpolating derivative constraints at both ends (Hermite interpolation) x 0 = x 0 x 1 = x 1 x (0) = x 0 x 1 = x 1 x 0 1 t 4 constraints 4 DoF needed 4 coefficients cubic x t = a 0 + a 1 t + a 2 t 2 + a 3 t 3 x t = a 1 + 2a 2 t + 3a 3 t 2 Coeffs determined by substituting constrained values & derivatives x 0 = a 0 = x 0 x 1 = a 0 + a 1 + a 2 + a 3 = x 1 x 0 = a 1 = x 0 x 1 = a 1 + 2 a 2 + 3 a 3 = x 1 a 0 = x 0 a 1 = x 0 a 2 = 3 x 0 + 3 x 1 2 x 0 x 1 a 3 = 2 x 0 2 x 1 + x 0 + x 1 3

Bezier curves Input: 3 control points P 0, P 1, P 2 Coordinates of points in arbitrary domain (2D, 3D,...) Output: Curve P t satisfying P 0 = P 0 P 1 = P 2 while being pulled by P 1 P 0 t=0 P 1 P t =? Eq. of Bezier curve P 2 t=1 P t = 1 t P 0 + t P 2 Eq. of line segment 4

P 1 Bezier curves 1 t t Eq. of line P 12 t P 01 t = 1 t P 0 + t P 1 P 12 t = 1 t P 1 + t P 2 P 01 0 = P 0 P 12 1 = P 2 Eq. of line P 01 t t P 0 t 1 t P 012 t 1 t P 2 Idea: Interpolate the interpolation As t changes 0 1, smoothly transition from P 01 to P 12 P 012 t = 1 t P 01 t + t P 12 t = 1 t 1 t P 0 + t P 1 + t 1 t P 1 + t P 2 = 1 t 2 P 0 + 2t 1 t P 1 + t 2 P 2 Quadratic Bezier curve 5

Bezier curves P 1 P 01 t = 1 t P 0 + t P 1 P 12 t = 1 t P 1 + t P 2 P 01 0 = P 0 P 12 1 = P 2 P 0 P 2 Idea: Interpolate the interpolation As t changes 0 1, smoothly transition from P 01 to P 12 P 012 t = 1 t P 01 t + t P 12 t = 1 t 1 t P 0 + t P 1 + t 1 t P 1 + t P 2 = 1 t 2 P 0 + 2t 1 t P 1 + t 2 P 2 Quadratic Bezier curve 6

Cubic Bezier curve Quad. Bezier P 123 t P 2 Exact same idea applied to 4 points P 0, P 1, P 2 P 3 : As t changes 0 1, transition from P 012 to P 123 P 012 t P 1 Quad. Bezier t 1 t P 0123 t P 3 P 0123 t = 1 t P 012 t + t P 123 t P 0 = 1 t 1 t 2 P 0 + 2t 1 t P 1 + t 2 P 2 + t 1 t 2 P 1 + 2t 1 t P 2 + t 2 P 3 = 1 t 3 P 0 + 3t 1 t 2 P 1 + 3t 2 1 t P 2 + t 3 P 3 Cubic Bezier curve 7

Cubic Bezier curve Exact same idea applied to 4 points P 0, P 1, P 2 P 3 : P 1 P 2 As t changes 0 1, transition from P 012 to P 123 P 0123 t P 3 P 0123 t = 1 t P 012 t + t P 123 t P 0 = 1 t 1 t 2 P 0 + 2t 1 t P 1 + t 2 P 2 + t 1 t 2 P 1 + 2t 1 t P 2 + t 2 P 3 = 1 t 3 P 0 + 3t 1 t 2 P 1 + 3t 2 1 t P 2 + t 3 P 3 Cubic Bezier curve Can easily control tangent at endpoints ubiquitously used in CG 8

n-th order Bezier curve Input: n+1 control points P 0,, P n P t = n i=0 nc i t i 1 t n i P i b i n (t) Bernstein basis function 1 t 4 P 0 + Quartic (4 th ) Quintic (5 th ) 4t 1 t 3 P 1 + 6t 2 1 t 2 P 2 + 4t 3 1 t P 3 + t 4 P 4 1 t 5 P 0 + 5t 1 t 4 P 1 + 10t 2 1 t 3 P 2 + 10t 3 1 t 2 P 3 + 5t 4 1 t P 4 + t 5 P 5 9

Cubic Bezier curves & cubic Hermite curves Cubic Bezier curve & its derivative: P t = 1 t 3 P 0 + 3t 1 t 2 P 1 + 3t 2 1 t P 2 + t 3 P 3 P (t) = 3 1 t 2 P 0 + 3 1 t 2 2t(1 t) P 1 + 3 2t 1 t t 2 P 2 + 3t 2 P 3 Derivatives at endpoints: P 0 = 3P 0 + 3P 1 P 1 = P 0 + 1 3 P 0 P 1 = 3P 2 + 3P 3 P 2 = P 3 1 3 P 1 P (0) P 2 P 1 P 3 Different ways of looking at cubic curves, essentially the same P 0 P (1) 10

Evaluating Bezier curves Method 1: Direct evaluation of polynomials Simple & fast, could be numerically unstable Method 2: de Casteljau s algorithm Directly after the recursive definition of Bezier curves More computation steps, numerically stable Also useful for splitting Bezier curves 11

Drawing Bezier curves In the end, everything is drawn as polyline Main question: How to sample paramter t? Method 1: Uniform sampling Simple Potentially insufficient sampling density Method 2: Adaptive sampling If control points deviate too much from straight line, split by de Casteljau s algorithm 12

Further control: Rational Bezier curve Another view on Bezier curve: Weighted average of control points w 0 = w 2 = 1 P 012 t = 1 t 2 P 0 + 2t 1 t P 1 + t 2 P 2 = λ 0 t P 0 + λ 1 t P 1 + λ 2 t P 2 Important property: partition of unity λ 0 t + λ 1 t + λ 2 t = 1 t Multiply each λ i t by arbitrary coeff w i : ξ i t = w i λ i (t) Normalize to obtain new weights: λ i t = ξ i t j ξ j t Non-polynomial curve can represent arcs etc. 13

Cubic splines x x 0 (t) x 1 (t) x 2 (t) x 3 (t) x 4 (t) Series of connected cubic curves Piecewise-polynomial Share value & derivative at every transition of intervals (C 1 continuity) t 0 t 1 t 2 t 3 t 4 t 5 t Parameter range can be other than [0, 1] Assumption: t k < t k+1 Given values as only input, we want to automatically set derivatives Curve tool in PowerPoint 14

Cubic Catmull-Rom spline Cubic function x k (t) for range t k t t k+1 is defined by adjacent constrained values x k 1, x k, x k+1, x k+2 x x k+1 x k 1 x k (t) x k+2 x k t k 1 t k t k+1 t k+2 t 15

Cubic Catmull-Rom spline: Step 1 As t k t k+1, interpolate such that x k x k+1 Line l k (t) = 1 t t k t k+1 t k x k + t t k t k+1 t k x k+1 x l k 1 (t) l k (t) l k+1 (t) t k 1 t k t k+1 t k+2 t 16

Cubic Catmull-Rom spline: Step 2 As t k 1 t k+1, interpolate such that l k 1 l k Quadratic curve q k (t) = 1 t t k 1 t k+1 t k 1 l k 1 (t) + t t k 1 t k+1 t k 1 l k (t) Passes through 3 points t k 1, x k 1, t k, x k, t k+1, x k+1 x q k (t) q k+1 (t) t k 1 t k t k+1 t k+2 t 17

Cubic Catmull-Rom spline: Step 3 As t k t k+1, interpolate such that q k q k+1 Cubic curve x k t = 1 t t k t k+1 t k q k t + t t k t k+1 t k q k+1 (t) x x k (t) Summary: Derivative at each CP is defined by a quadratic curve passing through its adjacent CPs Each interval is a cubic curve satisfying derivative constraints at both ends t k 1 t k t k+1 t k+2 t 18

Evaluating cubic Catmull-Rom spline P t 3 = P 3 P t 1 = P 1 P t t 1 t t 2 P t 2 = P 2 P t 0 = P 0 A recursive evaluation algorithm for a class of Catmull-Rom splines [Barry,Colgman,SIGGRAPH88] 19

Ways of setting parameter values t k (aka. knot sequence) Assume: t 0 = 0 Uniform t k = t k 1 + 1 Chordal t k = t k 1 + P k 1 P k Centripetal t k = t k 1 + P k 1 P k Parameterization of Catmull-Rom Curves [Yuksel,Schaefer,Keyser,CAD11] 20

Application of cubic Catmull-Rom spline: Hair modeling Parameterization of Catmull-Rom Curves [Yuksel,Schaefer,Keyser,CAD11] 21

B-spline Another way of defining polynomial spline Represent curve as sum of basis functions Cubic basis is the most commonly used Deeply related to subdivision surfaces Next lecture Non-Uniform Rational B-Spline Non-Uniform = varying spacing of knots (t k ) Rational = arbitrary weights for CPs (Complex stuff, not covered) Cool Flash demo: http://geometrie.foretnik.net/files/nurbs-en.swf 22

Parametric surfaces One parameter Curve P(t) Two parameters Surface P s, t Cubic Bezier surface: Input: 4 4=16 control points P ij P s, t = 3 i=0 3 j=0 b i 3 s b j 3 t P ij Bernstein basis functions b 3 0 t = 1 t 3 b 3 1 t = 3t 1 t 2 b 3 2 t = 3t 2 (1 t) b 3 3 t = t 3 23

3D modeling using parametric surface patches Pros Can compactly represent smooth surfaces Can accurately represent spheres, cones, etc Cons Hard to design nice layout of patches Hard to maintain continuity across patches Often used for designing man-made objects consisting of simple parts 24

Pointers http://en.wikipedia.org/wiki/bezier_curve http://antigrain.com/research/adaptive_bezier/ https://groups.google.com/forum/#!topic/comp.graphics.algorithms/2 FypAv29dG4 http://en.wikipedia.org/wiki/cubic_hermite_spline http://en.wikipedia.org/wiki/centripetal_catmull%e2%80%93rom_splin e 25