1 CS 430/536 Computer Graphics I Curve Drawing Algorithms Week 4, Lecture 8 David Breen, William Regli and Maxim Peysakhov Geometric and Intelligent Computing.

Slides:



Advertisements
Similar presentations
Linear Interpolation Applying “weighted averages” to some graphics problems: animations and curve-drawing.
Advertisements

Lecture Notes #11 Curves and Surfaces II
Computer Graphics (Spring 2008) COMS 4160, Lecture 6: Curves 1
Parametric Curves Ref: 1, 2.
Cubic Curves CSE167: Computer Graphics Instructor: Steve Rotenberg UCSD, Fall 2006.
David Breen, William Regli and Maxim Peysakhov
© University of Wisconsin, CS559 Spring 2004
Jehee Lee Seoul National University
B-Spline Blending Functions
Dr. S.M. Malaek Assistant: M. Younesi
Lecture 29 of 42 Bezier Curves and Splines Wednesday, 02 April 2008
1Notes  Assignment 0 is being marked  Textbook reference for arc-length parameterization:  Section 3.2.
CS CS 175 – Week 9 B-Splines Definition, Algorithms.
Cornell CS465 Fall 2004 Lecture 16© 2004 Steve Marschner 1 Curved surfaces CS 465 Lecture 16.
Offset of curves. Alina Shaikhet (CS, Technion)
09/04/02 Dinesh Manocha, COMP258 Bezier Curves Interpolating curve Polynomial or rational parametrization using Bernstein basis functions Use of control.
09/09/02 Dinesh Manocha, COMP258 Properties of Bezier Curves Invariance under affine parameter transformation P i B i,n (u) = P i B i,n ((u –a)/(b-a))
Cubic Bezier and B-Spline Curves
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.
Splines III – Bézier Curves
Computer Graphics Lecture 13 Curves and Surfaces I.
Curve Modeling Bézier Curves
11/19/02 (c) 2002, University of Wisconsin, CS 559 Last Time Many, many modeling techniques –Polygon meshes –Parametric instancing –Hierarchical modeling.
1 CS 430/536 Computer Graphics I Circle Drawing and Clipping Week 3, Lecture 6 David Breen, William Regli and Maxim Peysakhov Geometric and Intelligent.
19/13/ :20 UML Graphics II Parametric Curves and Surfaces Session 3.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
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.
Interactive Graphics Lecture 9: Slide 1 Interactive Graphics Lecture 9: Introduction to Spline Curves.
Introduction to virtual engineering Óbuda University John von Neumann Faculty of Informatics Institute of Intelligent Engineering Systems Lecture 3. Description.
1 CS 430/536 Computer Graphics I Line Drawing Week 1, Lecture 2 David Breen, William Regli and Maxim Peysakhov Geometric and Intelligent Computing Laboratory.
Numerical Computation
1 Dr. Scott Schaefer Smooth Curves. 2/109 Smooth Curves Interpolation  Interpolation through Linear Algebra  Lagrange interpolation Bezier curves B-spline.
1 CS 430/536 Computer Graphics I 3D Transformations World Window to Viewport Transformation Week 2, Lecture 4 David Breen, William Regli and Maxim Peysakhov.
Quadratic Surfaces. SPLINE REPRESENTATIONS a spline is a flexible strip used to produce a smooth curve through a designated set of points. We.
Chapter VI Parametric Curves and Surfaces
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell Parametric Curves.
David Breen, William Regli and Maxim Peysakhov
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.
COLLEGE OF ENGINEERING UNIVERSITY OF PORTO COMPUTER GRAPHICS AND INTERFACES / GRAPHICS SYSTEMS JGB / AAS Representation of Curves and Surfaces Graphics.
04/18/02(c) 2002 University of Wisconsin Last Time Hermite Curves Bezier Curves.
1 CS 430/585 Computer Graphics I 3D Modeling: Subdivision Surfaces & Solid Modeling Week 9, Lecture 17 David Breen, William Regli and Maxim Peysakhov Geometric.
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.
Rendering Curves and Surfaces Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico 1 Angel:
Greg Humphreys CS445: Intro Graphics University of Virginia, Fall 2003 Parametric Curves & Surfaces Greg Humphreys University of Virginia CS 445, Spring.
Computer Graphics (Fall 2003) COMS 4160, Lecture 10: Curves 1 Ravi Ramamoorthi
11/26/02(C) University of Wisconsin Last Time BSplines.
Parametric Curves CS 318 Interactive Computer Graphics John C. Hart.
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.
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:
David Breen, William Regli and Maxim Peysakhov
CS559: Computer Graphics Lecture 33: Shape Modeling Li Zhang Spring 2008.
Curves University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2013 Tamara Munzner.
Computer Graphics CC416 Lecture 04: Bresenham Line Algorithm & Mid-point circle algorithm Dr. Manal Helal – Fall 2014.
Introduction to Parametric Curve and Surface Modeling.
© University of Wisconsin, CS559 Spring 2004
Curve & Surface.
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 Fall 2004
Rendering Curves and Surfaces
© University of Wisconsin, CS559 Spring 2004
Lecture 21: B Spline Curve
Computer Aided Geometric Design
Introduction to Parametric Curve and Surface Modeling
Presentation transcript:

1 CS 430/536 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

2 Outline Drawing of 2D Curves –De Casteljau algorithm –Subdivision algorithm –Drawing parametric curves

3 The de Casteljau Algorithm How to compute a sequence of points that approximates a smooth curve given a set of control points? Developed by Paul de Casteljau at Citroën in the late 1950s Idea: recursively subdivide the curve and add points to refine the number of control points Pics/Math courtesy of G. ASU

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 Compiled from:

5 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 Pics/Math courtesy of G. ASU

6 Properties of Piecewise Linear Interpolations Given –continuous curve, C –piecewise linear interpolant (PLI) of C –and an arbitrary plane, P Then: The number of crossings of P by PLI is no greater than those of C Pics/Math courtesy of G. ASU

7 Linear Interpolation: Example 1 Constructing a parabola using three control points From analytic geometry Pics/Math courtesy of G. ASU

8 Linear Interpolation: Example 2 Constructing a curve with four control points Point is obtained by repeated linear interpolation Shown: cubic case, n=3 and t=1/3 Pics/Math courtesy of G. ASU

9 The de Casteljau Algorithm 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 Pics/Math courtesy of Dave UMD-CP

10 The de Casteljau Algorithm Generalizing to three points –Interpolate and –Interpolate along the resulting points Pics/Math courtesy of Dave UMD-CP

11 The de Casteljau Algorithm The complete solution from the algorithm for three iterations: Final Value Pics/Math courtesy of Dave UMD-CP

12 The de Casteljau Algorithm The solution after four iterations: Pics/Math courtesy of Dave UMD-CP

13 The de Casteljau Algorithm Input: Iteratively set: and Then is the point with parameter value t on the Bézier curve defined by the p i ’s

14 The de Casteljau Algorithm: Example Results Quartic curve (degree 4) 50 points computed on the curve –black points All intermediate control points shown –gray points Pics/Math courtesy of G. ASU

15 The de Casteljau Algorithm: Example Results A degree 6 curve 60 points computed on the curve –the black points Intermediate control points –the gray points Pics/Math courtesy of G. ASU

16 De Casteljau: Arc Segment Animation Animated by Max Drexel University

17 De Casteljau: Cubic Curve Animation Animated by Max Drexel University

18 De Casteljau: Wave Curve Animation Animated by Max Drexel University

19 De Casteljau: Loop Curve Animation Animated by Max Drexel University

20 The de Casteljau Algorithm: Some Observations Interpolation along the curve is based only on u Drawing the curve’s pixels requires iterating over u at sufficient refinement What is the right increment? It’s not constant! Pics/Math courtesy of Dave UMD-CP

21 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 Subdivide to pixel resolution Pics/Math courtesy of G. ASU

22 Bézier Curve Subdivision Subdivision allows display of curves at different/adaptive 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

23 Bézier Curve Subdivision, with de Casteljau Calculate the value of x(u) at u = 1/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

24 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 Pics/Math courtesy of Dave UMD-CP

25 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

26 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 d 2 and d 3 are both less than some , then the curve is declared flat d2d2 d3d3

27 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

28 Drawing Parametric Curves via Recursive Subdivision The Algorithm: DrawCurveRecSub(curve,e) –If straight(curve,e) then DrawLine(curve) –Else SubdivideCurve(curve,LeftCurve,RightCurve) DrawCurveRecSub(LeftCurve,e) DrawCurveRecSub(RightCurve,e)

29 Subdivision: Arc Segment Animated by Max Drexel University

30 Subdivision: Cubic Curve Animated by Max Drexel University

31 Subdivision: Wave Curve Animated by Max Drexel University

32 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 Pics/Math courtesy of G. ASU

Bezier Curve Drawing Given control points you can either … –Iterate through t and evaluate formula –Iterate through t and use de Casteljau Algorithm Successive interpolation of control polygon edges –Recursively subdivide de Casteljau polygons until they are approximately flat –Generate more control points with degree elevation until control polygon approximates curve 33

34 Subdivision: Loop Curve Animated by Max Drexel University

35 Programming assignment 3 Output B/W XPM, input PostScript like file. Implement viewports. Use Weiler-Atherton intersection for polygon clipping. Implement scanline polygon filling. (You can not use flood filling algorithms)