Docsity

Curve Drawing Algorithms - Computer Graphics - Lecture Slides | CS 430, Lab Reports of Computer Graphics

Partial preview of the text

Download Curve Drawing Algorithms - Computer Graphics - Lecture Slides | CS 430 and more Lab Reports Computer Graphics in PDF only on Docsity!

1

CS 430/

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

2

Outline

  • Drawing of 2D Curves
    • De Casteljau algorithm
    • Subdivision algorithm
    • Drawing parametric curves

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. Farin @ 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. Farin @ 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 Mount @ UMD-CP

10

The de Casteljau Algorithm

  • Generalizing to three points
    • Interpolate and
    • Interpolate along the resulting points Pics/Math courtesy of Dave Mount @ UMD-CP

12

The de Casteljau Algorithm

  • The solution after four iterations: Pics/Math courtesy of Dave Mount @ 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

p

0

,p

1

,p

2

...p

n

∈ R

3

, t ∈ R

p

ir

( t ) = ( 1 − t )p

i ( r −1)

( t ) + t p

( i +1)( r − 1 )

( t )

r = 1 ,..., n

i = 0 ,..., n − r

p

i 0

( t ) = p

i

p

0 n

( t )

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. Farin @ ASU

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

19 De Casteljau: Loop Curve Animation Animated by Max Peysakhov @ 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 Mount @ UMD-CP

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/

  • This creates a new

control point for

subdividing the curve

  • Use the two new

edges to form control

polygon for two new

Bezier curves