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

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

Lecture IV Bézier Curves

Intro to Curves Week 4, Lecture 7

Intro to Curves Week 1, Lecture 2

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

Curves. Computer Graphics CSE 167 Lecture 11

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

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

Lecture 25: Bezier Subdivision. And he took unto him all these, and divided them in the midst, and laid each piece one against another: Genesis 15:10

ECE 600, Dr. Farag, Summer 09

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

CS-184: Computer Graphics

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

Curves and Surfaces Computer Graphics I Lecture 9

Direct Rendering of Trimmed NURBS Surfaces

Computer Graphics Curves and Surfaces. Matthias Teschner

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

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

From curves to surfaces. Parametric surfaces and solid modeling. Extrusions. Surfaces of revolution. So far have discussed spline curves in 2D

Sung-Eui Yoon ( 윤성의 )

3D Transformations World Window to Viewport Transformation Week 2, Lecture 4

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

Central issues in modelling

Parametric curves. Brian Curless CSE 457 Spring 2016

3D Modeling: Surfaces

XPM 2D Transformations Week 2, Lecture 3

COMPUTER AIDED ENGINEERING DESIGN (BFF2612)

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

Curves and Surfaces Computer Graphics I Lecture 10

2D Spline Curves. CS 4620 Lecture 18

Dgp _ lecture 2. Curves

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

Information Coding / Computer Graphics, ISY, LiTH. Splines

2D Spline Curves. CS 4620 Lecture 13

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

Design considerations

B-spline Curves. Smoother than other curve forms

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

XPM 2D Transformations Week 2, Lecture 3

3D Modeling Parametric Curves & Surfaces

Computer Graphics 1. Chapter 2 (May 19th, 2011, 2-4pm): 3D Modeling. LMU München Medieninformatik Andreas Butz Computergraphik 1 SS2011

B-Splines and NURBS Week 5, Lecture 9

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

Curves and Surfaces 1

Line Drawing Week 6, Lecture 9

EF432. Introduction to spagetti and meatballs

CHAPTER 1 Graphics Systems and Models 3

COMPUTER AIDED GEOMETRIC DESIGN. Thomas W. Sederberg

OUTLINE. Quadratic Bezier Curves Cubic Bezier Curves

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

08 - Designing Approximating Curves

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

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

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

CS452/552; EE465/505. Clipping & Scan Conversion

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

CS-184: Computer Graphics. Today

Bezier Curves, B-Splines, NURBS

CS3621 Midterm Solution (Fall 2005) 150 points

OpenGL Graphics System. 2D Graphics Primitives. Drawing 2D Graphics Primitives. 2D Graphics Primitives. Mathematical 2D Primitives.

CS559 Computer Graphics Fall 2015

Bezier Curves. An Introduction. Detlef Reimers

EF432. Introduction to spagetti and meatballs

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

Computergrafik. Matthias Zwicker Universität Bern Herbst 2016

3D Modeling: Solid Models

Topic 0. Introduction: What Is Computer Graphics? CSC 418/2504: Computer Graphics EF432. Today s Topics. What is Computer Graphics?

Transformations Week 9, Lecture 18

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

and the crooked shall be made straight, and the rough ways shall be made smooth; Luke 3:5

Computergrafik. Matthias Zwicker. Herbst 2010

Computer Graphics I Lecture 11

Homework #2. Hidden Surfaces, Projections, Shading and Texture, Ray Tracing, and Parametric Curves

Chapter 4-3D Modeling

CHETTINAD COLLEGE OF ENGINEERING & TECHNOLOGY CS2401 COMPUTER GRAPHICS QUESTION BANK

2D rendering takes a photo of the 2D scene with a virtual camera that selects an axis aligned rectangle from the scene. The photograph is placed into

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

INF3320 Computer Graphics and Discrete Geometry

Topics and things to know about them:

Homework #2. Shading, Projections, Texture Mapping, Ray Tracing, and Bezier Curves

The Essentials of CAGD

For each question, indicate whether the statement is true or false by circling T or F, respectively.

Rendering Curves and Surfaces. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico

Introduction to Computer Graphics

Midterm Exam! CS 184: Foundations of Computer Graphics! page 1 of 13!

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

Freeform Curves on Spheres of Arbitrary Dimension

Computer Graphics. - Rasterization - Philipp Slusallek

Until now we have worked with flat entities such as lines and flat polygons. Fit well with graphics hardware Mathematically simple

Tópicos de Computação Gráfica Topics in Computer Graphics 10509: Doutoramento em Engenharia Informática. Chap. 2 Rasterization.

CS 4620 Final Exam. (a) Is a circle C 0 continuous?

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

Advanced Texture-Mapping Curves and Curved Surfaces. Pre-Lecture Business. Texture Modes. Texture Modes. Review quiz

(Spline, Bezier, B-Spline)

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

An introduction to interpolation and splines

Mathematical Tools in Computer Graphics with C# Implementations Table of Contents

Curve and Surface Basics

CS770/870 Spring 2017 Ray Tracing Implementation

Intro to Modeling Modeling in 3D

Transcription:

CS 430/585 Computer Graphics I Curve Drawing Algorithms Week 4, Lecture 8 David Breen, William Regli and Maxim Peysakhov Geometric and Intelligent Computing Laboratory Department of Computer Science Drexel University http://gicl.cs.drexel.edu Outline Drawing of 2D Curves De Casteljau algorithm Subdivision algorithm Drawing parametric curves Clipping Introduction and discussion of homework #3 2 How do define a smooth curve that approximates a sequence of control points? Developed by Paul de Casteljau at Citroën in the late 950s Idea: recursively subdivide the curve and add points to refine the number of control points 3 Properties of Piecewise Linear Interpolations Given continuous curve, C piecewise linear interpolant of C, PLC and an arbitrary plane, P Then: The number of crossings of P by PLC is no greater than those of C 4 Historic Analogy: The Universe of Aristotle and Ptolemy Earth is in the center Planetary motion described as Epicycles For some planets Epicycles had to be placed on Epicycles In the similar manner we will have linear interpolation of the linear interpolating points Recall: Linear Interpolation Simple example interpolating along the line between two points (really an affine combination of points a and b) x(t) = a + (b-a)t Compiled from: http://csep0.phys.utk.edu/astr6/lect/retrograde/aristotle.html 5 6

Linear Interpolation: Example Linear Interpolation: Example 2 Constructing a parabola using three control points From analytic geometry ratio( u, v, w) = (v u)/(w u) ratio( b 0,b 0,b ) = ratio(b,b,b 2 ) = ratio(b 0,b 2 0,b ) = t 7 Constructing a Bézier curve with four control points Point b 3 0( t) is obtained by repeated linear interpolation Shown: cubic case, n=3 and t=/3 8 Basic case, with two points: Plotting a curve via repeated linear interpolation Given a sequence of control points Simple case: Mapping a parameter u to the line Generalizing to three points Interpolate and Interpolate along the resulting points 9 0 The complete solution from the algorithm for three iterations: The solution after four iterations: Final Value 2

Input:,p,p 2...p n R 3, t R Iteratively set: r =,...,n p ir (t) = ( t)p i(r ) (t) + t p (i+)(r ) (t) i = 0,...,n r and p i0 (t) = p i Then n (t) is the point with parameter value t on the Bézier curve defined by the p i s 3 : Example Results A degree 6 curve 60 points computed on the curve the black points Intermediate control points 260 the gray points 4 : Example Results Quartic curve (degree 4) 50 points computed on the curve black points All intermediate control points shown gray points De Casteljau: Arc Segment Animation 5 6 De Casteljau: Cubic Curve Animation De Casteljau: Wave Curve Animation 7 8

De Casteljau: Loop Curve Animation : Some Observations Interpolation along the curve is based only on u Drawing the curve s pixels requires iterating over u at sufficient refinement 9 20 Subdivision Bézier Curve Subdivision Common in many areas of graphics, CAD, CAGD, vision Basic idea primitives def d by control polygons set of control points is not unique more than one way to compute a curve subdivision refines representation of an object by introducing more control points Allows for local modification 2 Subdivision allows display of curves at different levels of resolution Rendering systems (OpenGL, ActiveX, etc) only display polygons or lines Subdivision generates the lines/facets that approximate the curve/surface output of subdivision sent to renderer 22 Bézier Curve Subdivision, avec de Casteljau Calculate the value of x(u) at u = /2 This creates a new control point for subdividing the curve Use the two new edges to form control polygon for two new Bezier curves 23 Bézier Curve Subdivision Observe subdivision: does not affect the shape of the curve partitions one curve into several curved pieces with (collectively) the same shape 24

Subdivision: Arc Segment Subdivision: Cubic Curve 25 26 Subdivision: Wave Curve Subdivision: Loop Curve 27 28 Bézier Curve: Degree Elevation Given a control polygon Generate additional control points Keep the curve the same In the limit, this converges to the curve defined by the original control polygon 29 Drawing Parametric Curves Two basic ways: Iterative evaluation of x(t), y(t), z(t) for incrementally spaced values of t can t easily control segment lengths and error Recursive Subdivision via de Casteljau, that stops when control points get sufficiently close to the curve i.e. when the curve is nearly a straight line Use Bresenham to draw each line segment 30

Drawing Parametric Curves via Recursive Subdivision Idea: stop subdivision when segment is flat enough to be drawn w/ straight line Curve Flatness Test: based on the convex hull if and are both less than some ε, then the curve is declared flat 3 FYI: Computing the Distance from a Point to a Line Line is defined with two points Basic idea: Project point P onto the line Find the location of the projection ( y0 y) x + ( x x0) y + ( d( P, L) = 2 ( x x ) + ( y 0 x y x y ) 0 2 0) y 0 32 Drawing Parametric Curves via Recursive Subdivision The Algorithm: DrawCurveRecSub(curve,e) If staight(curve,e) then DrawLine(curve) Else SubdivideCurve(curve,LeftCurve,RightCurve) DrawCurveRecSub(LeftCurve,e) DrawCurveRecSub(RightCurve,e) 33 Ray Curve Intersection Parametric Bezier curve p(t) = S B i (t) p i Use implicit ray (line) equation l(x,y) = ax + by + c normalized: a 2 + b 2 = Solve for intersection: l(p(t)) = 0 l(p(t)) = ax(t) + by(t) + c = a S B i (t) x i + b S B i (t) y i + c = S B i (t) a x i + S B i (t) b y i + c = S B i (t) (a x i + b y i + c) Solve: d(t) = S B i (t) d i = 0 Distance to ray: d i = a x i + b y i + c p d 0 d p 3 p 2 34 Explicitize the Curve Solve: d(t) = S B i (t) d i = 0 Define new (explicit) Bezier curve d(t) = S B i (t) d i d 0 = (0, d 0 ), d = (/3, d ), = (2/3, ), = (, ) Bezier curve d(t) intersects t-axis at same parameter t d that Bezier curve p(t) intersects ray! d 0 d 0 p d p 2 p 3 d t 35 Bezier Clipping Curve d(t) bounded by convex hull of its control points d i Find intersection of convex hull with t axis: t 0,t If curve p(t) intersects ray then intersection occurs at t in [t 0,t ] Apply de Casteljau twice to subdivide p(t) into p (t) such that = p(t 0 ) and p 3 = p(t ) Do it all over again until the curve segment shrinks to nothing If curve doesn t shrink by more than 20%, subdivide in half and redo both halves (multiple intersection) d d t d 0 t 0 t p 3 p p 3 p 2 36

Programming Assignment 4 Output B/W XPM, input PostScript like file. Create data structure to hold circles. Implement translation, rotation and scaling. Implement drawing and clipping. (you can only clip circles to /8 or the arch) Outline Clipping of 2D Curves Newtonian Method Bezier Clipping Introduction and discussion of homework #3 37 38