CS 445 / 645 Introduction to Computer Graphics Lecture 23 Bézier Curves Lecture 23 Bézier Curves.

Slides:



Advertisements
Similar presentations
Lecture 14 Curves and Surfaces II
Advertisements

Lecture Notes #11 Curves and Surfaces II
CS 445 / 645 Introduction to Computer Graphics Lecture 23 Bézier Curves Lecture 23 Bézier Curves.
2002 by Jim X. Chen: Bezier Curve Bezier Curve.
Lecture 10 Curves and Surfaces I
Overview June 9- B-Spline Curves June 16- NURBS Curves June 30- B-Spline Surfaces.
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
CS 445 / 645 Introduction to Computer Graphics Lecture 22 Hermite Splines Lecture 22 Hermite Splines.
Dr. S.M. Malaek Assistant: M. Younesi
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.
Splines II – Interpolating Curves
Curves Chiew-Lan Tai. Curves 2 Reading Required Hearn & Baker, 8-8 – 8-10, 8-12 Foley, 11.2.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Curves Week 12, Wed Apr.
Rational Bezier Curves
Modelling. Outline  Modelling methods  Editing models – adding detail  Polygonal models  Representing curves  Patched surfaces.
Modeling of curves Needs a ways of representing curves: Reproducible - the representation should give the same curve every time; Computationally Quick;
Geometric Modeling Surfaces Mortenson Chapter 6 and Angel Chapter 9.
Curves Mortenson Chapter 2-5 and Angel Chapter 9
Bezier and Spline Curves and Surfaces Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
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.
COEN Computer Graphics I
Curve Surfaces June 4, Examples of Curve Surfaces Spheres The body of a car Almost everything in nature.
Splines III – Bézier Curves
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.
V. Space Curves Types of curves Explicit Implicit Parametric.
Introduction to Computer Graphics with WebGL
Review of Interpolation. A method of constructing a function that crosses through a discrete set of known data points.
Cornell CS465 Fall 2004 Lecture 15© 2004 Steve Marschner 1 2D Spline Curves CS 465 Lecture 15.
Quadratic Surfaces. SPLINE REPRESENTATIONS a spline is a flexible strip used to produce a smooth curve through a designated set of points. We.
CS 445/645 Fall 2001 Splines/Film/Animation. Final Exam Thursday, December 13 th from 7 – 10 p.m. –Room Olsson 011 You may use one sheet of notes (8.5.
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.
Computer Graphics Representing Curves and Surfaces.
Keyframing and Splines Jehee Lee Seoul National University.
CS 376 Introduction to Computer Graphics 04 / 25 / 2007 Instructor: Michael Eckmann.
CS 445 / 645 Introduction to Computer Graphics Lecture 23 Bézier Curves Lecture 23 Bézier Curves.
Representation of Curves & Surfaces Prof. Lizhuang Ma Shanghai Jiao Tong University.
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.
Greg Humphreys CS445: Intro Graphics University of Virginia, Fall 2003 Parametric Curves & Surfaces Greg Humphreys University of Virginia CS 445, Spring.
11/26/02(C) University of Wisconsin Last Time BSplines.
(c) 2002 University of Wisconsin
Slide 129 October 1999CS Computer Graphics (Top Changwatchai) Bézier Curves - Results of Derivation Tangents at endpoints are equal to endpoint slopes.
1 Graphics CSCI 343, Fall 2015 Lecture 34 Curves and Surfaces III.
Splines Sang Il Park Sejong University. Particle Motion A curve in 3-dimensional space World coordinates.
CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann.
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.
Object Modeling: Curves and Surfaces CEng 477 Introduction to Computer Graphics.
Introduction to Parametric Curve and Surface Modeling.
© University of Wisconsin, CS559 Spring 2004
CS5500 Computer Graphics May 11, 2006
Representation of Curves & Surfaces
CS 445 / 645 Introduction to Computer Graphics
CS 430/536 Computer Graphics I Intro to Curves Week 4, Lecture 7
© University of Wisconsin, CS559 Fall 2004
© University of Wisconsin, CS559 Fall 2004
© University of Wisconsin, CS559 Spring 2004
Implicit Functions Some surfaces can be represented as the vanishing points of functions (defined over 3D space) Places where a function f(x,y,z)=0 Some.
Introduction to Parametric Curve and Surface Modeling
Overview June 9- B-Spline Curves June 16- NURBS Curves
Presentation transcript:

CS 445 / 645 Introduction to Computer Graphics Lecture 23 Bézier Curves Lecture 23 Bézier Curves

Splines - History Draftsman use ‘ducks’ and strips of wood (splines) to draw curves Wood splines have second- order continuity And pass through the control points Draftsman use ‘ducks’ and strips of wood (splines) to draw curves Wood splines have second- order continuity And pass through the control points A Duck (weight) Ducks trace out curve

Bézier Curves Similar to Hermite, but more intuitive definition of endpoint derivatives Four control points, two of which are knots Similar to Hermite, but more intuitive definition of endpoint derivatives Four control points, two of which are knots

Bézier Curves The derivative values of the Bezier Curve at the knots are dependent on the adjacent points The scalar 3 was selected just for this curve The derivative values of the Bezier Curve at the knots are dependent on the adjacent points The scalar 3 was selected just for this curve

Bézier vs. Hermite We can write our Bezier in terms of Hermite Note this is just matrix form of previous equationsNote this is just matrix form of previous equations We can write our Bezier in terms of Hermite Note this is just matrix form of previous equationsNote this is just matrix form of previous equations

Bézier vs. Hermite Now substitute this in for previous Hermite M Bezier

Bézier Basis and Geometry Matrices Matrix Form But why is M Bezier a good basis matrix? Matrix Form But why is M Bezier a good basis matrix?

Bézier Blending Functions Look at the blending functions This family of polynomials is called order-3 Bernstein Polynomials C(3, k) t k (1-t) 3-k ; 0<= k <= 3C(3, k) t k (1-t) 3-k ; 0<= k <= 3 They are all positive in interval [0,1]They are all positive in interval [0,1] Their sum is equal to 1Their sum is equal to 1 Look at the blending functions This family of polynomials is called order-3 Bernstein Polynomials C(3, k) t k (1-t) 3-k ; 0<= k <= 3C(3, k) t k (1-t) 3-k ; 0<= k <= 3 They are all positive in interval [0,1]They are all positive in interval [0,1] Their sum is equal to 1Their sum is equal to 1

Bézier Blending Functions Thus, every point on curve is linear combination of the control points The weights of the combination are all positive The sum of the weights is 1 Therefore, the curve is a convex combination of the control points Thus, every point on curve is linear combination of the control points The weights of the combination are all positive The sum of the weights is 1 Therefore, the curve is a convex combination of the control points

Convex combination of control points Will always remain within bounding region (convex hull) defined by control points

Bézier Curves Bezier

Why more spline slides? Bezier and Hermite splines have global influence One could create a Bezier curve that required 15 points to define the curve…One could create a Bezier curve that required 15 points to define the curve… –Moving any one control point would affect the entire curve Piecewise Bezier or Hermite don’t suffer from this, but they don’t enforce derivative continuity at join pointsPiecewise Bezier or Hermite don’t suffer from this, but they don’t enforce derivative continuity at join points B-splines consist of curve segments whose polynomial coefficients depend on just a few control points Local controlLocal control Examples of Splines Examples of Splines Bezier and Hermite splines have global influence One could create a Bezier curve that required 15 points to define the curve…One could create a Bezier curve that required 15 points to define the curve… –Moving any one control point would affect the entire curve Piecewise Bezier or Hermite don’t suffer from this, but they don’t enforce derivative continuity at join pointsPiecewise Bezier or Hermite don’t suffer from this, but they don’t enforce derivative continuity at join points B-splines consist of curve segments whose polynomial coefficients depend on just a few control points Local controlLocal control Examples of Splines Examples of Splines

B-Spline Curve (cubic periodic) Start with a sequence of control points Select four from middle of sequence (p i-2, p i-1, p i, p i+1 ) d Bezier and Hermite goes between p i-2 and p i+1Bezier and Hermite goes between p i-2 and p i+1 B-Spline doesn’t interpolate (touch) any of them but approximates going through p i-1 and p iB-Spline doesn’t interpolate (touch) any of them but approximates going through p i-1 and p i Start with a sequence of control points Select four from middle of sequence (p i-2, p i-1, p i, p i+1 ) d Bezier and Hermite goes between p i-2 and p i+1Bezier and Hermite goes between p i-2 and p i+1 B-Spline doesn’t interpolate (touch) any of them but approximates going through p i-1 and p iB-Spline doesn’t interpolate (touch) any of them but approximates going through p i-1 and p i p0p0p0p0 p0p0p0p0 p4p4p4p4 p4p4p4p4 p2p2p2p2 p2p2p2p2 p1p1p1p1 p1p1p1p1 p3p3p3p3 p3p3p3p3 p5p5p5p5 p5p5p5p5 p6p6p6p6 p6p6p6p6 Q3Q3Q3Q3 Q3Q3Q3Q3 Q4Q4Q4Q4 Q4Q4Q4Q4 Q5Q5Q5Q5 Q5Q5Q5Q5 Q6Q6Q6Q6 Q6Q6Q6Q6 t3t3t3t3 t3t3t3t3 t4t4t4t4 t4t4t4t4 t5t5t5t5 t5t5t5t5 t6t6t6t6 t6t6t6t6 t7t7t7t7 t7t7t7t7

Uniform B-Splines Approximating Splines Approximates n+1 control points P 0, P 1, …, P n, n ¸ 3 P 0, P 1, …, P n, n ¸ 3 Curve consists of n –2 cubic polynomial segments Q 3, Q 4, … Q nQ 3, Q 4, … Q n t varies along B-spline as Q i : t i <= t < t i+1 t i (i = integer) are knot points that join segment Q i to Q i+1 Curve is uniform because knots are spaced at equal intervals of parameter, t Approximating Splines Approximates n+1 control points P 0, P 1, …, P n, n ¸ 3 P 0, P 1, …, P n, n ¸ 3 Curve consists of n –2 cubic polynomial segments Q 3, Q 4, … Q nQ 3, Q 4, … Q n t varies along B-spline as Q i : t i <= t < t i+1 t i (i = integer) are knot points that join segment Q i to Q i+1 Curve is uniform because knots are spaced at equal intervals of parameter, t

Uniform B-Splines First curve segment, Q 3, is defined by first four control points Last curve segment, Q m, is defined by last four control points, P m-3, P m-2, P m-1, P m Each control point affects four curve segments First curve segment, Q 3, is defined by first four control points Last curve segment, Q m, is defined by last four control points, P m-3, P m-2, P m-1, P m Each control point affects four curve segments

B-spline Basis Matrix Formulate 16 equations to solve the 16 unknowns The 16 equations enforce the C 0, C 1, and C 2 continuity between adjoining segments, Q Formulate 16 equations to solve the 16 unknowns The 16 equations enforce the C 0, C 1, and C 2 continuity between adjoining segments, Q

B-Spline Points along B-Spline are computed just as with Bezier Curves

B-Spline By far the most popular spline used C 0, C 1, and C 2 continuous By far the most popular spline used C 0, C 1, and C 2 continuous

Nonuniform, Rational B-Splines (NURBS) The native geometry element in Maya Models are composed of surfaces defined by NURBS, not polygons NURBS are smooth NURBS require effort to make non-smooth The native geometry element in Maya Models are composed of surfaces defined by NURBS, not polygons NURBS are smooth NURBS require effort to make non-smooth

Converting Between Splines Consider two spline basis formulations for two spline types

Converting Between Splines We can transform the control points from one spline basis to another

Converting Between Splines With this conversion, we can convert a B-Spline into a Bezier Spline Bezier Splines are easy to render With this conversion, we can convert a B-Spline into a Bezier Spline Bezier Splines are easy to render

Rendering Splines Horner’s Method Incremental (Forward Difference) Method Subdivision Methods Horner’s Method Incremental (Forward Difference) Method Subdivision Methods

Horner’s Method Three multiplications Three additions Three multiplications Three additions

Forward Difference But this still is expensive to compute Solve for change at k (  k ) and change at k+1 (  k+1 )Solve for change at k (  k ) and change at k+1 (  k+1 ) Boot strap with initial values for x 0,  0, and  1Boot strap with initial values for x 0,  0, and  1 Compute x 3 by adding x 0 +  0 +  1Compute x 3 by adding x 0 +  0 +  1 But this still is expensive to compute Solve for change at k (  k ) and change at k+1 (  k+1 )Solve for change at k (  k ) and change at k+1 (  k+1 ) Boot strap with initial values for x 0,  0, and  1Boot strap with initial values for x 0,  0, and  1 Compute x 3 by adding x 0 +  0 +  1Compute x 3 by adding x 0 +  0 +  1

Subdivision Methods Bezier

Rendering Bezier Spline public void spline(ControlPoint p0, ControlPoint p1, ControlPoint p2, ControlPoint p3, int pix) { float len = ControlPoint.dist(p0,p1) + ControlPoint.dist(p1,p2) + ControlPoint.dist(p2,p3); float chord = ControlPoint.dist(p0,p3); if (Math.abs(len - chord) < 0.25f) return; fatPixel(pix, p0.x, p0.y); ControlPoint p11 = ControlPoint.midpoint(p0, p1); ControlPoint tmp = ControlPoint.midpoint(p1, p2); ControlPoint p12 = ControlPoint.midpoint(p11, tmp); ControlPoint p22 = ControlPoint.midpoint(p2, p3); ControlPoint p21 = ControlPoint.midpoint(p22, tmp); ControlPoint p20 = ControlPoint.midpoint(p12, p21); spline(p20, p12, p11, p0, pix); spline(p3, p22, p21, p20, pix); }

Do you want a 5 th assignment?

Assignment 5 Spline-generated paths Create a six-sided room with textured walls, floor, ceilingCreate a six-sided room with textured walls, floor, ceiling Import from a file the description of a 2-D splineImport from a file the description of a 2-D spline –Could be Hermite or Bezier Create a texture mapped character that follows the spline in the roomCreate a texture mapped character that follows the spline in the room Create a simple user interface so the camera can either be under user control or follow the character automaticallyCreate a simple user interface so the camera can either be under user control or follow the character automatically Spline-generated paths Create a six-sided room with textured walls, floor, ceilingCreate a six-sided room with textured walls, floor, ceiling Import from a file the description of a 2-D splineImport from a file the description of a 2-D spline –Could be Hermite or Bezier Create a texture mapped character that follows the spline in the roomCreate a texture mapped character that follows the spline in the room Create a simple user interface so the camera can either be under user control or follow the character automaticallyCreate a simple user interface so the camera can either be under user control or follow the character automatically

Virtual Trackball Can we use the mouse to control the 2-D rotation of a viewing volume? Imagine a track ball User moves point on ball from (x, y, z) to (a, b, c)User moves point on ball from (x, y, z) to (a, b, c) Imagine the points projected onto the ground User moves point on ground from (x, 0, z) to (a, 0, c)User moves point on ground from (x, 0, z) to (a, 0, c) Can we use the mouse to control the 2-D rotation of a viewing volume? Imagine a track ball User moves point on ball from (x, y, z) to (a, b, c)User moves point on ball from (x, y, z) to (a, b, c) Imagine the points projected onto the ground User moves point on ground from (x, 0, z) to (a, 0, c)User moves point on ground from (x, 0, z) to (a, 0, c)

Trackball Movement of points on track ball can be inferred from mouse drags on screen Inverse problem Where on trackball does (a, 0, c) hit?Where on trackball does (a, 0, c) hit? Ball is unit sphere, so ||x, y, z|| = 1.0Ball is unit sphere, so ||x, y, z|| = 1.0 x = a, z = c, y = solve for itx = a, z = c, y = solve for it Movement of points on track ball can be inferred from mouse drags on screen Inverse problem Where on trackball does (a, 0, c) hit?Where on trackball does (a, 0, c) hit? Ball is unit sphere, so ||x, y, z|| = 1.0Ball is unit sphere, so ||x, y, z|| = 1.0 x = a, z = c, y = solve for itx = a, z = c, y = solve for it

Trackball User defines two points Place where first clicked X = (x, y, z)Place where first clicked X = (x, y, z) Place where released A = (a, b, c)Place where released A = (a, b, c) Ball rotates along axis perp to line defined by these two points compute cross produce of lines to origin: (X – O) x (A – O)compute cross produce of lines to origin: (X – O) x (A – O) Ball rotates by amount proportional to distance between lines magnitude of cross product tells us angle between lines (dot product too)magnitude of cross product tells us angle between lines (dot product too) |sin  | = ||cross product|||sin  | = ||cross product|| Compute rotation matrix and use it to rotate world User defines two points Place where first clicked X = (x, y, z)Place where first clicked X = (x, y, z) Place where released A = (a, b, c)Place where released A = (a, b, c) Ball rotates along axis perp to line defined by these two points compute cross produce of lines to origin: (X – O) x (A – O)compute cross produce of lines to origin: (X – O) x (A – O) Ball rotates by amount proportional to distance between lines magnitude of cross product tells us angle between lines (dot product too)magnitude of cross product tells us angle between lines (dot product too) |sin  | = ||cross product|||sin  | = ||cross product|| Compute rotation matrix and use it to rotate world