Roadmap for tonight. What are Bezier curves (mathematically)? Programming Bezier curves (very high level view).

Similar documents
Curves. Computer Graphics CSE 167 Lecture 11

2D Spline Curves. CS 4620 Lecture 18

08 - Designing Approximating Curves

3D Modeling Parametric Curves & Surfaces. Shandong University Spring 2013

Lecture IV Bézier Curves

Rational Bezier Curves

Design considerations

3D Modeling Parametric Curves & Surfaces

CSE 167: Introduction to Computer Graphics Lecture #13: Curves. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2017

CSE 167: Introduction to Computer Graphics Lecture #11: Bezier Curves. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2016

(Spline, Bezier, B-Spline)

2D Spline Curves. CS 4620 Lecture 13

Bézier Splines. B-Splines. B-Splines. CS 475 / CS 675 Computer Graphics. Lecture 14 : Modelling Curves 3 B-Splines. n i t i 1 t n i. J n,i.

Need for Parametric Equations

CSE 167: Introduction to Computer Graphics Lecture 12: Bézier Curves. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2013

CS 475 / CS Computer Graphics. Modelling Curves 3 - B-Splines

CS130 : Computer Graphics Curves (cont.) Tamar Shinar Computer Science & Engineering UC Riverside

Computer Graphics Curves and Surfaces. Matthias Teschner

Properties of Blending Functions

Computer Graphics Splines and Curves

Bezier Curves, B-Splines, NURBS

Bezier Curves. An Introduction. Detlef Reimers

LECTURE #6. Geometric Modelling for Engineering Applications. Geometric modeling for engineering applications

8 Project # 2: Bézier curves

Computergrafik. Matthias Zwicker. Herbst 2010

Intro to Curves Week 4, Lecture 7

Computergrafik. Matthias Zwicker Universität Bern Herbst 2016

Further Graphics. Bezier Curves and Surfaces. Alex Benton, University of Cambridge Supported in part by Google UK, Ltd

Fall CSCI 420: Computer Graphics. 4.2 Splines. Hao Li.

MA 323 Geometric Modelling Course Notes: Day 14 Properties of Bezier Curves

Intro to Curves Week 1, Lecture 2

03 Vector Graphics. Multimedia Systems. 2D and 3D Graphics, Transformations

CS 536 Computer Graphics Intro to Curves Week 1, Lecture 2

Keyword: Quadratic Bézier Curve, Bisection Algorithm, Biarc, Biarc Method, Hausdorff Distances, Tolerance Band.

Representing Curves Part II. Foley & Van Dam, Chapter 11

Parametric Curves. University of Texas at Austin CS384G - Computer Graphics

Splines. Parameterization of a Curve. Curve Representations. Roller coaster. What Do We Need From Curves in Computer Graphics? Modeling Complex Shapes

Parametric Curves. University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell

Curve and Surface Basics

Spline Morphing. CG software practical course in the IWR. Carl Friedrich Bolz. Carl Friedrich Bolz

MA 323 Geometric Modelling Course Notes: Day 21 Three Dimensional Bezier Curves, Projections and Rational Bezier Curves

Computer Graphics Spline and Surfaces

Know it. Control points. B Spline surfaces. Implicit surfaces

A Curve Tutorial for Introductory Computer Graphics

Information Coding / Computer Graphics, ISY, LiTH. Splines

Parametric curves. Brian Curless CSE 457 Spring 2016

Dgp _ lecture 2. Curves

CS337 INTRODUCTION TO COMPUTER GRAPHICS. Describing Shapes. Constructing Objects in Computer Graphics. Bin Sheng Representing Shape 9/20/16 1/15

Advanced Graphics. Beziers, B-splines, and NURBS. Alex Benton, University of Cambridge Supported in part by Google UK, Ltd

CS123 INTRODUCTION TO COMPUTER GRAPHICS. Describing Shapes. Constructing Objects in Computer Graphics 1/15

Lecture 9: Introduction to Spline Curves

B-spline Curves. Smoother than other curve forms

A story about Non Uniform Rational B-Splines. E. Shcherbakov

OUTLINE. Quadratic Bezier Curves Cubic Bezier Curves

Curves and Curved Surfaces. Adapted by FFL from CSE167: Computer Graphics Instructor: Ronen Barzel UCSD, Winter 2006

COMPUTER AIDED GEOMETRIC DESIGN. Thomas W. Sederberg

CS 465 Program 4: Modeller

The Free-form Surface Modelling System

Central issues in modelling

Computer Graphics CS 543 Lecture 13a Curves, Tesselation/Geometry Shaders & Level of Detail

A New Class of Quasi-Cubic Trigonometric Bezier Curve and Surfaces

Drawing hypergraphs using NURBS curves

Splines. Connecting the Dots

Curves and Surfaces 2

Surfaces for CAGD. FSP Tutorial. FSP-Seminar, Graz, November

ECE 600, Dr. Farag, Summer 09

Curves D.A. Forsyth, with slides from John Hart

Curves and Surfaces for Computer-Aided Geometric Design

Review of Tuesday. ECS 175 Chapter 3: Object Representation

CS-184: Computer Graphics

Interactive Graphics. Lecture 9: Introduction to Spline Curves. Interactive Graphics Lecture 9: Slide 1

Curves and Surfaces 1

COMP3421. Global Lighting Part 2: Radiosity

Objects 2: Curves & Splines Christian Miller CS Fall 2011

Spline Methods Draft. Tom Lyche and Knut Mørken. Department of Informatics Centre of Mathematics for Applications University of Oslo

Geometric Modeling of Curves

CSC 305 More Modelling

Outline. The de Casteljau Algorithm. Properties of Piecewise Linear Interpolations. Recall: Linear Interpolation

Curves and Surfaces. Shireen Elhabian and Aly A. Farag University of Louisville

Outline. Properties of Piecewise Linear Interpolations. The de Casteljau Algorithm. Recall: Linear Interpolation

Spline Methods Draft. Tom Lyche and Knut Mørken

Intro to Modeling Modeling in 3D

Spline Methods Draft. Tom Lyche and Knut Mørken

PS Geometric Modeling Homework Assignment Sheet I (Due 20-Oct-2017)

Introduction to Computer Graphics

Curves and Surfaces. Computer Graphics COMP 770 (236) Spring Instructor: Brandon Lloyd

Parametric curves. Reading. Curves before computers. Mathematical curve representation. CSE 457 Winter Required:

Circular Arc Approximation by Quartic H-Bézier Curve

PostScript Internals Graphics II Spring 1999

Shape Representation Basic problem We make pictures of things How do we describe those things? Many of those things are shapes Other things include

An Introduction to B-Spline Curves

Interactive Graphics Using Parametric Equations (Day 2)

Figure 5.1: Spline and ducks.

09 - Designing Surfaces. CSCI-GA Computer Graphics - Fall 16 - Daniele Panozzo

Curve Construction via Local Fitting

Computer Graphics. Unit VI: Curves And Fractals. By Vaishali Kolhe

Introduction to Geometry. Computer Graphics CMU /15-662

Chapter 4-3D Modeling

Isoparametric Curve of Quadratic F-Bézier Curve

Shape Control of Cubic H-Bézier Curve by Moving Control Point

Transcription:

Roadmap for tonight Some background. What are Bezier curves (mathematically)? Characteristics of Bezier curves. Demo. Programming Bezier curves (very high level view).

Why Bezier curves? Bezier curves are a type of parametric curve. Used for drawing and interactively editing smooth curves in computer graphics. They are a special case of NURBS (Non-Uniform Rational B-Splines). The 3D and CAD/CAM worlds have moved on to NURBS, but Bezier curves still rule 2D graphics. These types of curves are often referred to as splines. (see next slide).

Smooth curves, B.C. (Before Computers)

Originally developed in France in the late 1950 s - early 1960 s for automotive CAD/CAM by: Pierre Bezier (Renault) Paul de Casteljau (Citroen) (M. de Casteljau seems to have been somewhat camera-shy.)

Parametric Curves (2D) Instead of y = f(x) we have x = f(t) y = f(t) Vector Notation for a 2D point: P = Pxˆx + P y ŷ

If we average two points: P =0.5( P0 + P 1 ) y P 1 P P 0 x

Next consider a weighted average of two points: P = α P0 + β P 1 α + β =1 y P 1 P 0 P x

Finally let the weights be functions of a parameter, call it t. P (t) =α(t) P0 + β(t) P 1 α + β =1 As t goes from 0 to 1, P(t) traces out the straight line between P0 and P1. y P 1 P 0 x

P(t) is an example of a parametric curve. if we choose α =(1 t) β = t the straight line is a degree 1 Bezier curve. α and β are the degree 1 Bernstein polynomials: α is B 0,1 (t) β is B 1,1 (t)

The general form of the Bernstein polynomials (also called Bernstein basis functions) is: n B n i (t) = i t i (1 t) n i, i =0,...,n Bernstein polynomials are always > 0 and form a partition of unity - at any given t, the sum of all N functions of degree N is equal to 1. (Handy for a set of weight functions)

A degree N Bezier curve is a weighted average of N+1 control points, using the N+1 degree N Bernstein polynomials as weight functions: P (t) = N i=0 B i,n Pi (t) Commonest are degree 1 (straight line) and degree 3 (cubic Bezier curve). Some degree 2 (quadratic Bezier curve) in older fonts. Higher degrees seldom used - they are hard to calculate and wiggle too much. You use a chain of cubic curves instead.

Cubic Bezier Curves (the most important kind): B 0,3 (t) =(1 t) 3 B 1,3 (t) =3t(1 t) 2 B 2,3 (t) =3t 2 (1 t) B 3,3 (t) =t 3 B n,3 (t) B 0 t B 1 B 2 B 3

The result looks like this: I ve replaced P by C (for Control point). You ll see both used in the literature.

Characteristics of Bezier curves The curve goes through the endpoints C0, C3 The ends are tangent to the line segments C0-C1, C3-C2 The longer the segment, the longer the curve sticks to the segment.

The control polygon gives a rough indication of the curve shape. Quasi-local control (moving a control point affects the part of the curve near it more than other parts of the curve.) The curve lies entirely in the convex hull of the control points.

Variation diminishing - no line will have more intersections with the curve than the line has with the polyline formed by connecting the control points. Degree elevation - you can exactly represent the shape of a Bezier curve with a higher degree Bezier curve. Affine invariance. The Bezier curve created from transformed control points is the same as the transformed curve. (Otherwise computer graphics would be a nightmare.)

Subdivision - the de Casteljau algortihm Cutting a Bezier curve results in two Bezier curves.

Less desirable characteristics The parameter is in general not distance along the curve. There is no closed form expression for arc length. The offset of a Bezier curve is not a Bezier curve. Bezier curves can t represent circular arcs (or other conics) exactly. (But you can get a good enough approximation.) They are not invariant under projective transforms. (such as a 3D perspective transform.)

Drawing a Bezier Curves are drawn by flattening (tessellating) the curve into a polyline approximation such that the maximum deviation (or actually a conservative approximation to the maximum deviation) of the curve from the polyline is less than a pixel. The resulting polyline is then drawn with the usual line drawing algorithms. The polyline approximation is also used for calculating arc length and for stepping along a curve.

Chains of Beziers ( Bezier paths in Adobe/ Quartz speech) If the end points match exactly,the curve is continuous across the join. If C2,C3,C4 (in the picture) are collinear, the tangent to curve is continuous across the join. If C2,C3,C4 are collinear and C2-C3 and C3-C4 are the same length, curvature is continuous across the join.

Demo!

Programming Bezier s The PostScript Imaging model Used by PostScript, pdf, SVG and Quartz (and therefore by CoreGraphics, Cocoa and Cocoa Touch). Has a graphics context that hold settable state for things like Fill Color, Stroke Color, Stroke Width, Line Dash, Line Join, Line Cap, etc. Has a way of adding a Bezier path to the context. Has a way to tell the context to draw (stroke, fill or both) the path according to the current state held in the context.

Building a Bezier Path (conceptual) Has a notion of a current point - the active end of the path being constructed. Has four operators or functions: moveto - begins a new subpath. lineto - adds a straight line section. curveto - adds a Bezier curve. closepath - adds a line from the current point to the beginning.

Building a Bezier Path (conceptual) There may be more than one type of curveto (quadratic or cubic Bezier). There may be convenience functions that add a rectangle or ellipse to the path. A path may have more than one (disconnected) subpaths. Has a way to tell the context to draw (stroke, fill or both) the path according to the current state held in the context.

If there is time, take a quick look at the docs for: CGPathRef NSBezierPath UIBezierPath

A quick note For fitting a chain of Bezier curves to a set of points, see: An Algorithm for Automatically Fitting Digitized Curves by Philip J. Schneider in "Graphics Gems", Academic Press, 1990