Alexander Lauser Ferienakademie Sarntal 2004

Slides:



Advertisements
Similar presentations
Lecture Notes #11 Curves and Surfaces II
Advertisements

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
Geometric Modeling Notes on Curve and Surface Continuity Parts of Mortenson, Farin, Angel, Hill and others.
© University of Wisconsin, CS559 Spring 2004
Jehee Lee Seoul National University
B-Spline Blending Functions
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.
Curves Chiew-Lan Tai.
Curves Chiew-Lan Tai. Curves 2 Reading Required Hearn & Baker, 8-8 – 8-10, 8-12 Foley, 11.2.
Rational Bezier Curves
Offset of curves. Alina Shaikhet (CS, Technion)
Advanced Computer Graphics (Spring 2005) COMS 4162, Lecture 12: Spline Curves (review) Ravi Ramamoorthi Most material.
1 Lecture 13 Modeling Curved Lines and Surfaces. 2 Types of Surfaces Ruled Surfaces B-Splines and Bezier Curves Surfaces of Revolution.
Geometric Modeling Surfaces Mortenson Chapter 6 and Angel Chapter 9.
Cubic Bezier and B-Spline Curves
A story about Non Uniform Rational B-Splines E. Shcherbakov.
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
Bezier and Spline Curves and Surfaces CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
1 Representing Curves and Surfaces. 2 Introduction We need smooth curves and surfaces in many applications: –model real world objects –computer-aided.
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.
(Spline, Bezier, B-Spline)
V. Space Curves Types of curves Explicit Implicit Parametric.
Introduction to Computer Graphics with WebGL
CS 445 / 645 Introduction to Computer Graphics Lecture 23 Bézier Curves Lecture 23 Bézier Curves.
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.
Ship Computer Aided Design MR 422. Geometry of Curves 1.Introduction 2.Mathematical Curve Definitions 3.Analytic Properties of Curves 4.Fairness of Curves.
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.
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.
CS 450: Computer Graphics PARAMETRIC SPLINES AND SURFACES
1 CS 430/536 Computer Graphics I B-Splines and NURBS Week 5, Lecture 9 David Breen, William Regli and Maxim Peysakhov Geometric and Intelligent Computing.
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.
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.
Introduction to Parametric Curve and Surface Modeling.
© University of Wisconsin, CS559 Spring 2004
Representation of Curves & Surfaces
CS 445 / 645 Introduction to Computer Graphics
(Spline, Bezier, B-Spline)
CSE 167 [Win 17], Lecture 9: Curves 1 Ravi Ramamoorthi
CS 430/536 Computer Graphics I Intro to Curves Week 4, Lecture 7
© University of Wisconsin, CS559 Fall 2004
© University of Wisconsin, CS559 Spring 2004
Three-Dimensional Object Representation
Introduction to Parametric Curve and Surface Modeling
Presentation transcript:

Alexander Lauser Ferienakademie Sarntal 2004 CAGD: Design of curves Splines & NURBS Alexander Lauser Ferienakademie Sarntal 2004

Agenda Motivation Polynomial Interpolation Bézier curves Splines Smoothness B-Splines Rational Bézier curves NURBS

Why designing curves? Many technological applications Design of fonts Design of products (e.g. CAD) Calculation of the path for a robot Many technological applications Design of fonts Large sized fonts must be smooth Interpolating measuring data Approximating measuring data

Criterias for curves Controllability Locality Smoothness Changes must be predictable in effect Intuitive to use for the designer Locality Local changes should stay local Smoothness No sharp bends

Polynomial interpolation Several conditions (say n+1) For example: n+1 Points Apply to Solve system of linear equations Either effective or if you like to, even efficent Result: Polynomial of degree n Interpolates points by construction (i.e. the curve goes through these points)

Polynomial interpolation Disadvantages Very bad locality Tend to oscillate Small changes may result in catastrophe Bad controllability All you know is, that it interpolates the points High effort to evaluate curve Imagine a curve with several million given points

Approximation Unlike interpolation the points are not necessarily interpolated Points give a means for controlling of where the curve goes Often used when creating the design of new (i.e. non-existing) things No strict shape is given

Bézier curves

Bézier curve Now we are no longer interested in interpolating all points The curve only approximates a set of points Bézier curves are a simple, yet good method Given: n+1 control points

Bézier – definition Characteristics Nonnegative Sum to union Bernstein polynomials of degree 4 Via Bernstein polynomials of degree n Characteristics Nonnegative Sum to union

Bézier – mathematical Definition of Bézier curve: Bernstein polynomials are like „cross-faders“ to the points They are the weights in a weighted linear combination

Bézier – derivation Derivation of Bernstein polynomial

Bézier – derivation Derivation of Bézier

Bézier – construction Repeated linear interpolation t = 0,5 P1 P2 P0

Bézier – characteristics Last two points determine the tangent vector at the end: Good controllability Interpolates endpoints (s(0) = b0, s(1) = b1) Good locality Local changes only have local impact Anyway changes are global First two points determine the tangent vector at the start:

Bézier – characteristics Lies within the convex closure of the control points Useful for collision detection Invariant under affine transformation You can rotate, translate and scale the control polygon Complex shape of model implies a great amount of control points This means the degree of the curve is high So the evaluation of such a curve is slow

Splines Modelling segmental

Splines Piecewise polynomial segments Name derives from shipbuilding Modelling the curve locally by a segment The segments are joined to get the global curve Name derives from shipbuilding Splines are stripes of metal fixed at several points. They have the same smoothness as cubic B-Splines Global parameter u and for each segment si a local parameter t

Splines – parametrisation Globally parametrised over a sequence of nodes ui Each segment si is locally parametrised over [ui, ui+1]

Splines – parametrisation Uniform splines Uniformly distributed sequence over range of global parameter u Nonuniform splines Sequence is not uniformly distributed Segments si „live“ over [ui, ui+1] with local parameter t = (u – ui) / (ui+1 – ui–1)

Splines – smoothness What does smoothness mean? Graphically clear: No sharp bends Mathematical abstraction: Order of continuous derivability Only nodes and the corresponding knot-points are relevant others points are infinitely often derivable

Splines – smoothness C0-continuity C1-continuity C2-continuity The segments meet at the nodes C1-continuity Curve must be continuously derivable after the global parameter u one time The „speed“ in respect to global parameter must be the same in the joint both segments C2-continuity Curve must be continuously derivable 2 times The „acceleration“ must be equal in the joint

Splines – smoothness C0-continuous Spline C1-continuous Spline

Splines – smoothness Geometric smoothness: G1-continuity In every joint there exists a unique tangent I.e. tangent vectors need not be equal in magnitude, only direction Doesn‘t take global parametrisation into account

Splines – smoothness An example for G1-continuous curve that is not C1-continuous u0 u1 u2 1 2

Splines – smoothness In general Special case: Stationary point Cx-continuity  Gx-continuity But not: Gx-Continuity  Cx-continuity Special case: Stationary point All derivations are zero Then Cx-continuity  Gx-continuity doesn‘t hold

Splines – smoothness

Linear Interpolation Why not interpolate the points linearily? It is very controllable It is very local since it changes only 2 segments Right. BUT It is not very smooth It is only C0-continuous

B-Splines Spline consisting of Bézier curves Depending on the degree n of the Bézier segments various orders of continuity possible In general up to Cn–1-continuouity possible Higher orders possible => one global Bézier => inf derivable

B-Splines – C1-continuity Bézier: Tangents B-Splines – C1-continuity C1-continuity at knot bi Tangent vectors must be equal Bézier: Tangent vectors in bi s0 - points from bi-1 to bi s1 - points from bi to bi+1 This means bi-1, bi and bi+1 must be collinear B-Spline: Collinearity of bi-1, bi and bi+1 bi+1 bi bi-1 s0 s1

B-Splines – C1-continuity But this alone isn‘t sufficient Furthermore bi-1, bi and bi+1 must satisfy a specific ratio u0 u1 u2 Why this?

B-Splines – C1-continuity Because we are interested in derivability for the global parameter Collinearity says that the „speed“ has the same direction, but not necessarily magnitude Mathematical derivation

B-Splines – C1-continuity Given: Two Bézier curves How to test C1-continuity Consider the joint points of the spline and its direct neighbours When no joint it isn‘t even C0-continuous Are they collinear? No, then the spline is not C1-continuous Ok, they are collinear Then check the ratio of the distance from the knot point neighbours to the knot point. It must be same ratio as of the corresponding nodes

B-Splines – C2-continuity C2-continuity at knot bi Precondition: C1-continuity Nodes bn-2, bn-1, bn and bn, bn+1, bn+2 must describe a unique global quadratic Bézier curve So there must exist a (unique) point d, so that bn-2, d, bn+2 describe this curve

B-Splines – C2-continuity The point d must fulfill two conditions u0 u1 u2 Erklären: * bn-1 und bn+1 müssen aus linearer Interpolation von d und bn-2/bn+2 gewonnen werden * Berücksichtigung der Parametrisierung

B-Splines How to test for C2-continuity First of all test for C1-continuity If it is not, it cannot be C2-continuous u0 u1 u2 Check for uniqueness of point d Extrapolate d- from bn-2 and bn-1 Extrapolate d+ from bn+2 and bn+1 d- and d+ must be equal In Practice specify a tolerance Erklären: Konstruktion von d- Erklären: Konstruktion von d+ Stimmen nicht überein => nicht C2-stetig

Quadratic B-Splines Construction of a C1-continuous quadratic B-Spline Different approach Per definition we want a C1-continuous curve We do not want to test two segments for C1-continuity anymore Given are n+1 control points d0 ,..., dn spanning the control polygon of the B-Spline Constructing Bézier control points for a C1-continuous quadratic B-Spline

Quadratic B-Splines Construction of Bézier polygon: For uniform B-Splines b2 0,5 b3 = d2 d3 d4 b6 = An Flipboard zeigen Quadratic Bézier segments b4 d1 Control polygon b1 = b5 = d0 Construction of a uniform quadratic C1-continuous B-Spline with n=5 b0 =

Cubic B-Splines Construction of a C2-continuous cubic B-Spline As for quadratic B-Splines we construct the Bézier control points bi from the B-Spline polygon spanned by di Given are n+1 control points d0 ,..., dn again spanning the control polygon of the B-Spline Constructing Bézier control points for a C2-continuous cubic B-Spline

b0 = b1 = b9 = = b8 d3 d5 d2 d4 Cubic B-Splines b7 b2 Cubic Bézier segments b3 b6 Formulas for uniform case (nonuniform version is too ugly ;) b4 b5 An Flipboard zeigen d0 B-Spline polygon d1 Construction of a uniform C2-continuous cubic B-Spline

Cubic B-Splines – storage A little off-topic aspect: How to store a B-Spline For example it could be approximated linearly and these linear segments could be saved Obviously inefficient All Bézier control points could be saved It‘s more efficient but not perfect So what to save? Answer: Only the di need to be saved Curve can be reconstructed as shown before

Cubic B-Splines – storage The advantages are obvious No loss of data. The curve can be exactly reconstructed No problems with rounding errors Little storage space needed The storage is distinct when low-level storage information is known Theoretical interchangability of file format saving B-Splines Practice is evidently different

B-Splines – basis What does the „B“ in the name stand for? It does not stand for „Bézier“ as you may guess, but for „Basis“ Since there exists a basis representation for the spline in contrary to natural splines The basis functions are called the minimum support splines

B-Splines – basis Definition of B-Splines via basis splines Definition of the basis splines Global over the whole domain of u So that Cn-1-smoothness is assured The support is minimal That is the range in which it doesn‘t vanish

B-Spline Basis Ok but how does this look like? The basis splines over the full domain of u

B-Splines – characteristics Invariant under affine transformations You can scale, rotate and translate the curve I.e. the control points and get the same result as doing so with all the points on the curve Interpolation of end points Excellent locality Change of one control points affects at most n+1 segments

B-Splines – characteristics Lies within convex closure of the control points Stricter than for Bézier curve: Lies within the the union of the convex closures of all segments A C1-continuous quadratic B-Spline d0 d1 d2 d6 d7 Convex closure

B-Splines – characteristics Modelling of straight lines possible Even if all local segments are planar, modelling of true 3D curves is possible E.g. quadratic B-Splines are planar in each segment but the global curve may be true 3D The degree of the global curve doesn‘t depend on the number of points Efficient for modelling curves with many points

Rational Bézier curves An even more powerful approach

Rational Bézier curves One major disadvantage of Bézier curves are that they are not invariant under projection This means when perspectively projecting a 3D Bézier curve on the screen the result is no longer a Bézier curve For CAGD applications 3D curves are often projected to be displayed on 2D screens When projected, the original nonrational curve results in a rational curve This leads us to rational Bézier curves They are invariant under projective transformation

Rational Bézier curves Definition of a rational Bézier curve As before the bi are the control points Additionaly every point bi has a weight wi

Rational Bézier curves You can think of a rational Bézier curve of the projection of a nonrational one from 4D space to the hyper-plane w=1 The control polyhedron of this is spanned by the 4D points (bi . wi , wi) The bi are the projection of the bi .wi to the hyperplane w=1

Rational Bézier curves Let‘s visualize this for a 2D rational Bézier curve as a projected Bézier curve in 3D to plane z=1 z=1 plane 3D Bézier curve 2D rational Bézier curve

Rational Bézier curves The weights give a further degree of liberty to the designer Changing the weight differs from moving the control point Moving a control point (left) differs heavily from changing its weight (right)

Rational Bézier curves Because they are invariant under projection the projected curve can be modeled further E.g. a car designer may change the projected car body Bézier curves are a subset of the rational Bézier curves Special case: Equal weights

Puzzeling with rational curves NURBS Puzzeling with rational curves

NURBS Non Uniform Rational B-Splines B-Splines with rational Bézier curves Since 3D rational Bézier curves can be thought of as nonrational in 4D, all results of normal B-Splines apply Especially the continuity conditions are exactly identical, but with 4D control points This implies that their construction is mathematical identical to that of B-Splines (but as well in 4D)

NURBS Note: NURBS can be defined as well as B-Splines with Basis Splines

NURBS – characteristics All conic sections (a circle for example) can be modelled exactly Constructing a 2D-circle with NURBS

NURBS – characteristics It inherits all advantages of B-Splines (excellent locality, ...) while extending the liberty of modelling Therefore today NURBS are standard for modelling The next logical step is to model not only curves but surfaces This will be discussed in the next lecture

The End Questions? Thank you for paying attention Sources Programming is a race between the programmer and the universe: The programmer trying to make the programm more and more foolproof and the universe trying to make greater idiots – so far the universe won. -- Unkown source The End Questions? Thank you for paying attention Sources Farin, G.: Kurven und Flächen im Computer Aided Geometric Design H.-J. Bungartz, M. Griebel, C. Zenger: Einführung in die Computergraphik Foley, van Dam, Feiner, Hughes: Computer Graphics: Principles and Practice - Second Edition in C http://olli.informatik.uni-oldenburg.de/Grafiti3/grafiti/flow10/page1.html http://www.cs.berkeley.edu/~sequin/CS284/IMGS/ http://escience.anu.edu.au/lecture/cg/Spline/bSplineFunction.en.html