Splines III – Bézier Curves

Slides:



Advertisements
Similar presentations
Splines IV – B-spline Curves
Advertisements

Splines I – Curves and Properties
Lecture Notes #11 Curves and Surfaces II
Computer Graphics (Spring 2008) COMS 4160, Lecture 6: Curves 1
Lecture 10 Curves and Surfaces I
Cubic Curves CSE167: Computer Graphics Instructor: Steve Rotenberg UCSD, Fall 2006.
CS 445/645 Fall 2001 Hermite and Bézier Splines. Specifying Curves Control Points –A set of points that influence the curve’s shape Knots –Control points.
© University of Wisconsin, CS559 Spring 2004
Jehee Lee Seoul National University
B-Spline Blending Functions
1 Introduction Curve Modelling Jack van Wijk TU Eindhoven.
1 Curves and Surfaces. 2 Representation of Curves & Surfaces Polygon Meshes Parametric Cubic Curves Parametric Bi-Cubic Surfaces Quadric Surfaces Specialized.
Slide 127 October 1999CS Computer Graphics (Top Changwatchai) Review of Spline Concepts Sections 10-6 to in Hearn & Baker Splines can be 2D.
Lecture 29 of 42 Bezier Curves and Splines Wednesday, 02 April 2008
Splines II – Interpolating Curves
09/04/02 Dinesh Manocha, COMP258 Bezier Curves Interpolating curve Polynomial or rational parametrization using Bernstein basis functions Use of control.
Advanced Computer Graphics (Spring 2005) COMS 4162, Lecture 12: Spline Curves (review) Ravi Ramamoorthi Most material.
Modeling of curves Needs a ways of representing curves: Reproducible - the representation should give the same curve every time; Computationally Quick;
1 Lecture 13 Modeling Curved Lines and Surfaces. 2 Types of Surfaces Ruled Surfaces B-Splines and Bezier Curves Surfaces of Revolution.
1 Dr. Scott Schaefer The Bernstein Basis and Bezier Curves.
Cubic Bezier and B-Spline Curves
Modelling: Curves Week 11, Wed Mar 23
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Curves Week 13, Mon 24 Nov 2003.
Bezier and Spline Curves and Surfaces CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
CS Subdivision I: The Univariate Setting Peter Schröder.
Curve Surfaces June 4, Examples of Curve Surfaces Spheres The body of a car Almost everything in nature.
Curve Modeling Bézier Curves
Bresenham’s Algorithm. Line Drawing Reference: Edward Angel’s book: –6 th Ed. Sections 6.8 and 6.9 Assuming: –Clipped (to fall within the window) –2D.
11/19/02 (c) 2002, University of Wisconsin, CS 559 Last Time Many, many modeling techniques –Polygon meshes –Parametric instancing –Hierarchical modeling.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Curve Modeling B-Spline Curves
Interactive Graphics Lecture 9: Slide 1 Interactive Graphics Lecture 9: Introduction to Spline Curves.
(Spline, Bezier, B-Spline)
V. Space Curves Types of curves Explicit Implicit Parametric.
1 Dr. Scott Schaefer Smooth Curves. 2/109 Smooth Curves Interpolation  Interpolation through Linear Algebra  Lagrange interpolation Bezier curves B-spline.
Review of Interpolation. A method of constructing a function that crosses through a discrete set of known data points.
Bézier Algorithms & Properties Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Wednesday, March 3, 2004.
Quadratic Surfaces. SPLINE REPRESENTATIONS a spline is a flexible strip used to produce a smooth curve through a designated set of points. We.
Chapter VI Parametric Curves and Surfaces
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell Parametric Curves.
Splines IV – B-spline Curves based on: Michael Gleicher: Curves, chapter 15 in Fundamentals of Computer Graphics, 3 rd ed. (Shirley & Marschner) Slides.
Parametric Surfaces Define points on the surface in terms of two parameters Simplest case: bilinear interpolation s t s x(s,t)x(s,t) P 0,0 P 1,0 P 1,1.
Keyframing and Splines Jehee Lee Seoul National University.
CS 376 Introduction to Computer Graphics 04 / 25 / 2007 Instructor: Michael Eckmann.
04/18/02(c) 2002 University of Wisconsin Last Time Hermite Curves Bezier Curves.
Curves: ch 4 of McConnell General problem with constructing curves: how to create curves that are “smooth” CAD problem Curves could be composed of segments.
Rendering Curves and Surfaces Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico 1 Angel:
Splines I – Curves and Properties based on: Michael Gleicher Curves, chapter 15 in Fundamentals of Computer Graphics, 3 rd ed. (Shirley & Marschner) Slides.
Computer Graphics (Fall 2003) COMS 4160, Lecture 10: Curves 1 Ravi Ramamoorthi
11/26/02(C) University of Wisconsin Last Time BSplines.
Parametric Curves CS 318 Interactive Computer Graphics John C. Hart.
(c) 2002 University of Wisconsin
CS 450: Computer Graphics PARAMETRIC SPLINES AND SURFACES
Splines Sang Il Park Sejong University. Particle Motion A curve in 3-dimensional space World coordinates.
CS559 – Curves Lecture These are course notes (not used as slides) Written by Mike Gleicher, Oct Updates Oct 2006, 2007 Updates Oct 2008 © 2005 Michael.
Foundations of Computer Graphics (Spring 2012) CS 184, Lecture 12: Curves 1
Rendering Bezier Curves (1) Evaluate the curve at a fixed set of parameter values and join the points with straight lines Advantage: Very simple Disadvantages:
Curves University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2013 Tamara Munzner.
CS552: Computer Graphics Lecture 19: Bezier Curves.
Introduction to Parametric Curve and Surface Modeling.
© University of Wisconsin, CS559 Spring 2004
Computer Graphics Lecture 38
(Spline, Bezier, B-Spline)
CSE 167 [Win 17], Lecture 9: Curves 1 Ravi Ramamoorthi
Parametric Curves.
Rendering Curves and Surfaces
© University of Wisconsin, CS559 Spring 2004
The Bernstein Basis and Bezier Curves
Introduction to Parametric Curve and Surface Modeling
Presentation transcript:

Splines III – Bézier Curves based on: Michael Gleicher: Curves, chapter 15 in Fundamentals of Computer Graphics, 3rd ed. (Shirley & Marschner) Slides by Marc van Kreveld

Interpolation vs. approximation Interpolation means passing through given points, approximation means getting “close” to given points Bézier curves and B-spline curves p2 p2 p1 p1 p0 p3 p0 p3 p1 and p2 are interpolated p1 and p2 are approximated

Bezier curves Polynomial of any degree A degree-d Bezier curve has d+1 control points It passes through the first and last control point, and approximates the d – 1 other control points Cubic (degree-3) Bezier curves are most common; several of these are connected into one curve

Bezier curves Cubic Bezier curves are used for font definitions They are also used in Adobe Illustrator and many other illustration/drawing programs

Bezier curves Parameter u, first control point p0 at u=0 and last control point pd at u=1 Derivative at p0 is the vector p0p1 , scaled by d Derivative at pd is the vector pd-1pd , scaled by d Second, third, …, derivatives at p0 depend on the first three, four, …, control points

Cubic Bezier curve example p0 p1 3 p1 p2 p0 p1 p2 p3 p0 p3 p2 p3 3

Quintic Bezier curve example p0 p1 5 p2 p3 p1 p0 p1 p4 p5 p0 p4 p5 p4 p5 5

Cubic Bezier curves p0 = f(0) = a0 + 0 a1 + 02 a2 + 03 a3 p3 = f(1) = a0 + 1 a1 + 12 a2 + 13 a3 3(p1 – p0) = f’(0) = a1 + 20 a2 + 302 a3 3(p3 – p2) = f’(1) = a1 + 21 a2 + 312 a3 basis matrix

Cubic Bezier curves f(u) = (1 – 3u + 3u2 – u3) p0 + ( 3u – 6u2 + 3u3) p1 + ( 3u2 – 3u3) p2 + ( u3) p3 Bezier blending functions b0,3 = (1 – u)3 b1,3 = 3 u (1 – u)2 b2,3 = 3 u2 (1 – u) b3,3 = u3

Bezier curves In general (degree d): bk,d(u) = C(d,k) uk (1 – u)d-k where , for 0  k  d (binomial coefficients) The bk,d(u) are called Bernstein basis polynomials

Bezier curves degrees 2 (left) up to 6 (right)

Properties of Bezier curves The Bezier curve is bounded by the convex hull of the control points  intersection tests with a Bezier curve can be avoided if there is no intersection with the convex hull of the control points

Properties of Bezier curves Any line intersects the Bezier curve at most as often as that line intersects the polygonal lie through the control points (variation diminishing property)

Properties of Bezier curves A Bezier curve is symmetric: reversing the control points yields the same curve, parameterized in reverse p2 p3 p1 p4 p3 p2 p5 p0 p4 p1 p0 p5

Properties of Bezier curves A Bezier curve is affine invariant: the Bezier curve of the control points after an affine transformation is the same as the affine transformation applied to the Bezier curve itself (affine transformations: translation, rotation, scaling, skewing/shearing) p2 p2 p3 p3 p1 p1 p4 p4 p5 p5 p0 p0

Properties of Bezier curves There are simple algorithms for Bezier curves evaluating subdividing a Bezier curve into two Bezier curves  allows computing (approximating) intersections of Bezier curves the point at parameter value u on the Bezier curve

Bezier curves in PowerPoint The curve you draw in PowerPoint is a Bezier curve; however you don’t specify the intermediate two control points explicitly Select draw curve Draw a line segment (p0 and p3) Right-click; edit points Click on first endpoint and move the appearing marker (p1) Click on last endpoint and move the appearing marker (p2)

Splines from Bezier curves To ensure continuity C0 : last control point of first piece must be same as first control point of second piece G1 : last two control points of first piece must align with the first two control points of the second piece C1 : distances must be the same as well For the last condition C1, we must then assume that the two adjacent pieces use the same parameter interval length in their definition. q2 p2 p1 p3 q3 q0 q1 p0

Intuition for Bezier curves Keep on cutting corners to make a “smoother” curve In the limit, the curve becomes smooth p1 p0 p2

Intuition for Bezier curves Suppose we have three control points p0 , p1 , p2; a linear connection gives two edges Take the middle p3 of p0p1, and the middle p4 of p1p2 and place p’1 in the middle of p3 and p4 Recurse on p0, p3, p’1 and also on p’1 , p4, p2 p0 p1 p2 This gives a quadratic Bezier curve p0 p2 p’1 p3 p4 p0 p2 p’1 gives a quadratic Bezier curve

De Casteljau algorithm Generalization of the subdivision scheme just presented; it works for any degree Given points p0, p1, …, pd Choose the value of u where you want to evaluate Determine the u-interpolation for p0 p1 , for p1 p2 , … , and for pd-1 pd , giving d – 1 points If one point remains, we found f(u), otherwise repeat the previous step with these d – 1 points

De Casteljau algorithm p2 p1 p3 p0

De Casteljau algorithm p2 p1 p3 p0

De Casteljau algorithm p2 p1 p3 p0

De Casteljau algorithm p2 p1 one point remains, the point on the curve at u = 1/3 p3 p0

Splitting a Bezier curve The De Casteljau algorithm can be used to split a Bezier curve into two Bezier curves that together are the original Bezier curve p2 p1 r0 r1 r3 r2 q0 q1 q3 q2 p3 p0

Splitting a Bezier curve q0 q1 q3 q2 p3 p0 Question: Recalling that Bezier splines are C1 only if (in this case) the vector q2q3 is the same as r0r1 , does this mean that the spline is no longer C1 after splitting?!?

Splitting a Bezier curve q0 q1 q3 q2 p3 p0 Of course the curve stays C1, because the two pieces together precisely form the curve before splitting. Answer: q0q1q2q3 parameterizes the part u  [0, 1/3] and r0r1r2r3 parameterizes the part u  [1/3, 1] The condition for C1 continuity, q2q3 = r0r1 , applies only for equal parameter-length parameterizations

Splitting a Bezier curve Splitting a Bezier curve is useful to find line-Bezier or Bezier-Bezier intersections p2 p1 u = ½ p3 p0

Intersecting a Bezier curve To test if some line L intersects a Bezier curve with control points p0, p1, …, pd , test whether L intersects the poly-line p0, p1, …, pd If not, L does not intersect the Bezier curve either Otherwise, split the Bezier curve (with u = ½ ) and repeat on the two pieces p2 p1 In the figure, we do not know anything about intersection using the original four control points, but after splitting, the line does not intersect the polyline of the first four points, nor of the last four points, so the line does not intersect the Bezier curve. p3 p0

Intersecting a Bezier curve If the line L separates the two endpoints of a Bezier curve, then they intersect Repeating the split happens often only if the line L is nearly tangent to the Bezier curve p2 p1 In the figure, we cannot conclude anything with the original four control points, but after one split, we know for sure that the line intersects the Bezier curve (twice even). p3 p0

Intersecting a Bezier curve If the line L separates the two endpoints of a Bezier curve, then they intersect Repeating the split happens often only if the line L is nearly tangent to the Bezier curve p2 p1 p3 p0

Intersecting a Bezier curve When determining intersection of a line segment and a Bezier curve we must make some small changes p2 p1 Examine what changes to make. When can we conclude that the line segment does not intersect the Bezier curve, and when can we conclude that they do intersect? p3 p0

Splitting a Bezier curve for rendering Splitting a Bezier curve several times makes the new Bezier curve pieces be closer and closer to their control polygons At some moment we can draw the sequence of control polygons of the pieces and these will approximate the Bezier curve well (technically this approximation is only C0)

Splitting a Bezier curve for rendering

Splitting a Bezier curve for rendering

Splitting a Bezier curve for rendering

Splitting a Bezier curve for rendering

Splitting a Bezier curve for rendering

Splitting a Bezier curve for rendering

Splitting a Bezier curve for rendering

Splitting a Bezier curve for rendering

Splitting a Bezier curve for rendering

Splitting a Bezier curve for rendering

De Casteljau on quadratic, cubic and quartic Bezier curves

3D Bezier surfaces The 16 blending functions for cubic Bezier surfaces

Summary Bezier curves are elegant curves that pass through the start and end points and approximate the points in between They exist of any order (degree) but cubic is most common and useful Continuity between consecutive curves can be ensured The De Casteljau algorithm is a simple way to evaluate or split a Bezier curve

Questions Consider figure 15.11, bottom left (also on slide 11). It looks like a circular arc, but it is not. Determine whether the quadratic Bezier curve shown here goes around (left and above) the midpoint of the circular arc with the same two endpoints or not Can we ensure higher degrees of continuity than C1 with cubic Bezier splines? Discuss your answer Suppose we want to define a closed Bezier curve of degree d. What properties must the control points have to make a C1 continuous curve? What is the minimum degree of the Bezier curve that is needed for this? What if we want a closed Bezier curve with an inflection point (boundary of a non-convex region)?

Questions Apply the De Casteljau algorithm on the points (0,0), (4,0), (6,2), and (4,6) with u = ½ by drawing the construction (note that this is a cubic Bezier curve) Apply the De Casteljau algorithm on the points (0,0), (4,0), (6,2), (6,8), and (10,4) with u = ½ by drawing the construction (note that this is a quartic Bezier curve)