Curves Chiew-Lan Tai.

Slides:



Advertisements
Similar presentations
Lecture 14 Curves and Surfaces II
Advertisements

Interpolating curves.
Lecture Notes #11 Curves and Surfaces II
Computer Graphics (Spring 2008) COMS 4160, Lecture 6: Curves 1
2002 by Jim X. Chen: Bezier Curve Bezier Curve.
Lecture 10 Curves and Surfaces I
Cubic Curves CSE167: Computer Graphics Instructor: Steve Rotenberg UCSD, Fall 2006.
ICS 415 Computer Graphics Bézier Splines (Chapter 8)
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
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.
Curves Chiew-Lan Tai. Curves 2 Reading Required Hearn & Baker, 8-8 – 8-10, 8-12 Foley, 11.2.
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.
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.
Curve Modeling B-Spline Curves
A D V A N C E D C O M P U T E R G R A P H I C S CMSC 635 January 15, 2013 Spline curves 1/23 Curves and Surfaces.
CS 376 Introduction to Computer Graphics 04 / 23 / 2007 Instructor: Michael Eckmann.
(Spline, Bezier, B-Spline)
V. Space Curves Types of curves Explicit Implicit Parametric.
CS 445 / 645 Introduction to Computer Graphics Lecture 23 Bézier Curves Lecture 23 Bézier Curves.
1 Dr. Scott Schaefer Smooth Curves. 2/109 Smooth Curves Interpolation  Interpolation through Linear Algebra  Lagrange interpolation Bezier curves B-spline.
Curves.
Quadratic Surfaces. SPLINE REPRESENTATIONS a spline is a flexible strip used to produce a smooth curve through a designated set of points. We.
June D Object Representation Shmuel Wimer Bar Ilan Univ., School of Engineering.
University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell Parametric Curves.
Graphics Graphics Korea University cgvr.korea.ac.kr Parametric Curves 고려대학교 컴퓨터 그래픽스 연구실.
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.
CS 376 Introduction to Computer Graphics 04 / 25 / 2007 Instructor: Michael Eckmann.
Basic Theory (for curve 02). 1.3 Parametric Curves  The main aim of computer graphics is to display an arbitrary surface so that it looks real.  The.
Representation of Curves & Surfaces Prof. Lizhuang Ma Shanghai Jiao Tong University.
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.
Splines I – Curves and Properties based on: Michael Gleicher Curves, chapter 15 in Fundamentals of Computer Graphics, 3 rd ed. (Shirley & Marschner) Slides.
Parametric Curves CS 318 Interactive Computer Graphics John C. Hart.
CSCE 441: Keyframe Animation/Smooth Curves (Cont.) Jinxiang Chai.
CSCE 441: Keyframe Animation/Smooth Curves (Cont.) Jinxiang Chai.
Slide 129 October 1999CS Computer Graphics (Top Changwatchai) Bézier Curves - Results of Derivation Tangents at endpoints are equal to endpoint slopes.
CS 450: Computer Graphics PARAMETRIC SPLINES AND SURFACES
Splines Sang Il Park Sejong University. Particle Motion A curve in 3-dimensional space World coordinates.
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.
Piecewise Polynomial Parametric Curves Sun-Jeong Kim.
Object Modeling: Curves and Surfaces CEng 477 Introduction to Computer Graphics.
Introduction to Parametric Curve and Surface Modeling.
© University of Wisconsin, CS559 Spring 2004
Parametric Curves cgvr.korea.ac.kr.
CSE 167 [Win 17], Lecture 9: Curves 1 Ravi Ramamoorthi
CS 430/536 Computer Graphics I Intro to Curves Week 4, Lecture 7
Parametric Curves.
© 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.
CSCE 441: Keyframe Animation/Smooth Curves (Cont.)
Introduction to Parametric Curve and Surface Modeling
Presentation transcript:

Curves Chiew-Lan Tai

Reading Required Hearn & Baker, 8-8 – 8-10, 8-12 Foley, 11.2

Curves Before Computers The loftsman’s or carpenter’s spline: long, narrow strip of wood or metal shaped by lead weights called “ducks” Usually gives curves with second-order continuity Used for designing cars, ships, airplanes etc. But curves based on physical artefacts cannot be replicated well, since there is no exact definition of what the curve is. Around 1960, a lot of industrial designers were working on this problem. Today, curves are easy to manipulate on a computer and are used for CAD, art, animation, …

Motivation for curves In graphics, what do we use curves for? creating models Paths of movement, animation

Curve Representations Explicit y = f(x) what if the curve is not a function, e.g. a circle? Implicit f(x,y,z) = 0 x2 + y2 - R = 0 Parametric (x(u), y(u)) easier to work with E.g. circle x(u) = cos 2u y(u) = sin 2u 0 u1

Parametric Polynomial Curves We’ll use polynomial parametric curves, where the functions are all polynomials in the parameter. Advantages easy (and efficient) to compute infinitely differentiable We’ll also assume that u varies from 0 to 1

Bezier Curves

Bezier curves The set of control points defines the so-called control polygon

deCasteljau’s algorithm

deCasteljau Algorithm

Finding Q(u), cont In general where “n choose i” is What is the relationship between the number of control points and the degree of the polynomials?

Bernstein polynomials The coefficients of the control points are a set of functions called the Bernstein polynomials. For degree 3, we have:

Useful properties Bernstein polynomials has some useful properties in [0,1]: each Bernstein coefficient is positive sum of all four coefficients is always exactly 1 (a.k.a. , a “partition of unity”) These properties together imply that the curve lies within the convex hull of its control points. (convex hull is the smallest convex polygon that contains the control points)

Properties of Bezier curves Variation diminishing property: The number of intersections of a line/plane with the curve is less or equal to the number of intersections with its control polygon. Design property: control polygon gives a rough sketch of the curve

Displaying Bezier Curves Recall that most graphics hardware can only display lines and polygons. How can we display Bezier curves? It would be nice to have an adaptive algorithm that takes flatness into account. DisplayBezier (vo,v1,v2,v3) if (FlatEnough(v0,v1,v2,v3)) Line(v0,v3) else do something smart

Subdivide and Conquer

Testing for Flatness Compare the total length of control polygon to the length connecting the endpoints:

More Complex Curves Suppose we want to draw a more complex curve. We connect together individual curve segments that are cubic Bezier to form a longer curve, called splines. Why cubic? Smallest degree curves that can represent curves in 3D space There are three properties that we’d like to have in our constructed splines … Local control Interpolation continuity

Local Control One problem with Bezier curves is that every control point affects every point on the curve (except the endpoints) Moving a single control point affects the whole curve! We’d like our spline to have local control, that is, each control point affects a certain well-defined neighborhood around that point.

Interpolation Bezier curves are approximating. The curve does not (necessarily) pass through all the control points. Each point pulls the curve toward it, but other points are pulling as well. We’d like to have a spline that is interpolating, that is, it always passes through every control point.

Continuity We want our curve to have continuity. There shouldn’t be an abrupt change when we move from one segment to the next.

Ensuring Continuity Let’s look at continuity first. Since the functions defining a Bezier curve are polynomials, all their derivatives exist and are continuous on the interior of the curve. Therefore, we only need to worry about the continuity at the endpoints of each curve segment (i.e., the joints).

Ensuring C0 continuity First cubic Bezier segment: control points (V0,V1,V2,V3) Second cubic Bezier segment: control points (W0,W1,W2,W3) Joint is C0 continuous. What constraint does this place on W0,W1,W2,W3 ?

Ensuring C1 continuity First cubic Bezier segment: control points (V0,V1,V2,V3) Second cubic Bezier segment: control points (W0,W1,W2,W3) Joint is C1 continuous. What constraint(s) does this place on (W0,W1,W2,W3)? (refer next page)

1st derivatives at the endpoints

2nd derivatives at the endpoints Finally, we will want to develop C2 splines. To do that, we will need second derivatives of Bezier curves

Ensuring C2 continuity First cubic Bezier segment: control points (V0,V1,V2,V3) Second cubic Bezier segment: control points (W0,W1,W2,W3) Joint is C2 continuous. What constraint(s) does this place on (W0,W1,W2,W3)? (next page)

Ensuring C2 Continuity Suppose we want to join two cubic Bezier curves (V0,V1,V2,V3) and (W0,W1,W2,W3) so that there is C2 continuity at the joint.

A-frames and Continuity Let’s try to get some geometric intuition about what this last continuity equation means. W V V V W V W W

Building a complex spline Instead of specifying the Bezier control points themselves, let’s specify the corners of the A-frame in order to build a C2 continuous spline. These are called B-splines. The Bi points are called de Boor points. V0 V1 V2 V3

Constructing B-splines Here is the completed B-spline: What are the Bezier control (V) points, in terms of the de Boor points (B)? V0 V1 V2 V3 2/3 1/3 1/3 2/3 1/2 1/3 2/3 1/2 2/3 1/3 1/6 4/6 1/6 1/6 4/6 1/6

Constructing B-splines The construction of Bezier points from de Boor points can be expressed as

B-spline Properties C2 continuity Approximating Locality Convex hull Does not interpolate de Boor points Locality For cubics, each segment are determined by 4 de Boor points. Each de Boor point determines 4 segments. Convex hull The curve lies inside the convex hull of de Boor points

Endpoints of B-splines We can see that B-splines don’t interpolate the de Boor points. It would be nice if we could at least interpolate the endpoints There is a trick to make the spline begin and end at control points, by repeating them (multiplicity = 3 for cubics)

Closing the loop What if we want a closed curve, i.e., a loop? With B-spline curves, this is easy: wrap around the points B6= B7= B5=

Displaying B-splines Drawing B-splines is very simple: endfor DisplayBSpline (B0,B1,…,Bn) for i = 0 to n-3 Convert Bi,…,Bi+3 into Bezier control points V0, …, V3 DisplayBezier(V0,V1,V2,V3) endfor

Conversion between different representations Bezier, Bspline are different representations of the same parametric polynomial curves They have different design control properties For example, all cubic curves can be written as

Compact Representation Place all coefficients into a matrix:

Matrix representation C can be written as a product of a basis matrix M and a geometry vector G.

Bezier cubic curves MBezier G

B-splines Recall: the Bspline to Bezier transformation can be expressed as: Bezier representation is Substituting (1) into (2), we obtain Bspline representation: (1) (2) B0 B1 B2 B3

Summary What to take home from the lectures on curves: The meaning of all the bold face terms Definition and properties of Bezier curves How to display Bézier curves with line segments. Meanings of Ck continuities. Conditions for continuity of cubic splines. Construction of Bezier splines Definition, construction and properties of B-splines Matrix representation of curves Conversion between different representations

C2 Interpolating Splines Interpolation is a really handy property to have. How can we keep the C2 continuity we get with B-splines but get the interpolation property too? Idea behind C2 interpolating splines: Suppose we want cubic Beziers connecting our data points C0, C1, C2, …Cm, we can set up C2 continuity constraints and solve for the first derivative (tangent vector) Di at each Ci. Once we find Di, we can compute the Bezier control points from Di (next slide). Points Ci’s are known Vectors Di’s are unknown

Bezier curves from derivatives D’s If we know the first derivatives Di, we can compute the Bezier control points: We know: Therefore:

Finding the Derivatives D’s Set the C2 continuity condition and solve for the unknown derivatives D’s. We know: Equality of 2nd derivative => unknowns knowns

Finding the Derivatives D’s Here’s what we’ve got so far: How many equations are there? How many unknowns are we solving for? m - 1 m + 1

Not quite done yet! We have two additional degrees of freedom, which we can nail down by imposing 2 more conditions on the curve. There are various ways to do this. We’ll use a variant called natural C2 interpolating splines, which requires that the second derivative to be zero at the two endpoints. This condition gives us the two additional equations we need. At the endpoint C0, it is:

Solving for the Derivatives Let’s collect our m+1 equations into a single linear system: It’s easier to solve than it looks. We can use forward elimination to zero out everything below the diagonal, then back substitution to compute each D value.

Forward Elimination First, we eliminate the elements below the diagonal.

Back Substitution The resulting matrix is upper triangular: We can now solve for the unknowns by back substitution:

C2 Interpolating Spline Once we’ve solved for the real D’s, we can compute Bezier control points and draw the final spline: Have we lost anything? The user cannot control the tangent directions.