08 - Designing Approximating Curves Acknowledgement: Olga - - PowerPoint PPT Presentation

08 designing approximating curves
SMART_READER_LITE
LIVE PREVIEW

08 - Designing Approximating Curves Acknowledgement: Olga - - PowerPoint PPT Presentation

08 - Designing Approximating Curves Acknowledgement: Olga Sorkine-Hornung, Alexander Sorkine-Hornung, Ilya Baran CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo Last time Interpolating curves Monomials Lagrange Hermite


slide-1
SLIDE 1

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

08 - Designing Approximating Curves

Acknowledgement: Olga Sorkine-Hornung, Alexander Sorkine-Hornung, Ilya Baran

slide-2
SLIDE 2

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Last time

  • Interpolating curves
  • Monomials
  • Lagrange
  • Hermite
  • Different control types
  • Polynomials as a vector space
  • Basis transformation
  • Connecting curves to splines
slide-3
SLIDE 3

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Disadvantages

  • Monomials
  • unintuitive control, inefficient
  • Lagrange
  • non-local control, oscillation for higher order polynomials, continuity for

splines

  • Hermite
  • requires setting tangent
  • Catmull-Rom
  • unintuitive bending
slide-4
SLIDE 4

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Bezier Basis

slide-5
SLIDE 5

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Smooth Curves

  • General parametric form
  • Weighted sum of coefficients and basis functions

Basis functions Coefficients

slide-6
SLIDE 6

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

What might be “good” basis functions?

  • Intuitive editing
  • Control points are coefficients
  • Predictable behavior
  • No oscillation
  • Local control
  • Mathematical guarantees
  • Smoothness, affine invariance, linear precision, ...
  • Efficient processing and rendering
slide-7
SLIDE 7

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

What might be “good” basis functions?

  • Approximation instead of interpolation
  • Bézier- and B-Spline curves
slide-8
SLIDE 8

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Bezier Curves

  • Curve based on Bernstein polynomials

Bernstein polynomials Control points Control polygon

slide-9
SLIDE 9

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Bernstein Polynomials

  • Bernstein polynomials
  • Binomial coefficients
  • linear:
  • quadratic:
  • cubic:
slide-10
SLIDE 10

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Properties

  • Partition of Unity
  • Non-negativity
  • Maximum
  • Symmetry
slide-11
SLIDE 11

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Properties of Bezier Curves

  • Geometric interpretation of control points
slide-12
SLIDE 12

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Properties of Bezier Curves

  • Geometric interpretation of control points
  • Convex hull
  • Polynomials positive
  • No oscillation
slide-13
SLIDE 13

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Properties of Bezier Curves

  • Geometric interpretation of control points
  • Convex hull
  • Affine invariance
  • Barycentric combinations
slide-14
SLIDE 14

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Properties of Bezier Curves

  • Geometric interpretation of control points
  • Convex hull
  • Affine invariance
  • Endpoint interpolation
  • Symmetry
slide-15
SLIDE 15

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Properties of Bezier Curves

  • Geometric interpretation of control points
  • Convex hull
  • Affine invariance
  • Endpoint interpolation
  • Symmetry
  • Linear precision
slide-16
SLIDE 16

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Properties of Bezier Curves

  • Geometric interpretation of control points
  • Convex hull
  • Affine invariance
  • Endpoint interpolation
  • Symmetry
  • Linear precision
  • Quasi-local control
slide-17
SLIDE 17

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Variation Diminishing

  • Curve “wiggles” no more than control polygon
slide-18
SLIDE 18

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Variation Diminishing

  • Curve “wiggles” no more than control polygon
  • For any line, number of intersections with control polygon

>= intersection with curve

slide-19
SLIDE 19

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Variation Diminishing

  • Curve “wiggles” no more than control polygon
  • For any line, number of intersections with control polygon

>= intersection with curve

slide-20
SLIDE 20

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Variation Diminishing

  • Curve “wiggles” no more than control polygon
  • For any line, number of intersections with control polygon

>= intersection with curve

slide-21
SLIDE 21

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Variation Diminishing

  • Curve “wiggles” no more than control polygon
  • For any line, number of intersections with control polygon

>= intersection with curve

slide-22
SLIDE 22

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Variation Diminishing

  • Curve “wiggles” no more than control polygon
  • For any line, number of intersections with control polygon >=

intersection with curve

  • Application: intersection computation
slide-23
SLIDE 23

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

De Casteljau Algorithm

  • Developed independently
  • Successive linear interpolation
  • Example: parabola
  • Recursive scheme behind


Bernstein Polynomials

  • Curves as series of linear interpolations
slide-24
SLIDE 24

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

De Casteljau Algorithm

  • Exploit recursive definition of Bernstein polynomials


Repeated convex combination of control points

slide-25
SLIDE 25

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

De Casteljau Algorithm

  • Exploit recursive definition of Bernstein polynomials


Repeated convex combination of control points

slide-26
SLIDE 26

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

De Casteljau Algorithm

  • Exploit recursive definition of Bernstein polynomials


Repeated convex combination of control points

slide-27
SLIDE 27

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

De Casteljau Algorithm

  • Exploit recursive definition of Bernstein polynomials


Repeated convex combination of control points

slide-28
SLIDE 28

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

De Casteljau Algorithm

i33www.ira.uka.de/applets/mocca/html/noplugin/BezierCurve/AppDeCasteljau/index.html

slide-29
SLIDE 29

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Disadvantages

  • Still global support of basis functions for each curve segment
  • Insertion of new control points?
  • Continuity conditions restrict control polygon
  • No “inherent” smoothness control
slide-30
SLIDE 30

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Basis splines (B-splines)

slide-31
SLIDE 31

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Why?

  • The control points of Bezier curves have global support
  • We can obtain local support if we split the curve into smaller Bezier

segments, but we have to be careful with the borders to guarantee smoothness

  • B-spline curves are a generalization of this construction
  • http://i33www.ira.uka.de/applets/mocca/html/noplugin/inhalt.html
slide-32
SLIDE 32

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Ingredients

Bezier

1

B-spline

1

n + 1

Control Points

m + 1

Knots Points

m = n + p + 1

Basis degree

p

slide-33
SLIDE 33

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Basis functions

  • Piecewise-polynomial
  • Symmetric
  • Shifted
  • Nonnegative
  • Partition of unity
  • Local support

Cp

slide-34
SLIDE 34

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Recursive definition

N0" N1" N2" N3" N4"

Degree Knot Span

The support is always: (1 + degree) knot spans

Ni,0(u) = ⇢ 1 if ui ≤ u < ui+1 1

  • therwise

Ni,p(u) = u − ui ui+p − ui Ni,p−1(u)+ ui+p+1 − u ui+p+1 − ui+1 Ni+1,p−1(u)

Non-uniform knots

slide-35
SLIDE 35

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Basis functions

http://www.cs.technion.ac.il/~cs234325/Applets/applets/bspline/GermanApplet.html

slide-36
SLIDE 36

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Basis functions

http://www.cs.technion.ac.il/~cs234325/Applets/applets/bspline/GermanApplet.html

slide-37
SLIDE 37

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Definition

1

slide-38
SLIDE 38

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Special curves

From%h'p://www.cs.mtu.edu/~shene/COURSES/cs3621/NOTES/spline/BDspline/bsplineDcurveDclosed.html%

Closed curve Overlap the first and last control points, and align the corresponding knots Interpolating curve Increase the multiplicity of the first and last knots

slide-39
SLIDE 39

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Properties

  • 1. B-spline curve is a piecewise curve with each component a curve of degree p
  • 2. Equality m = n + p + 1 must be satisfied
  • 3. Strong Convex Hull Property: A B-spline curve is contained in the convex hull of its

control polyline

  • 4. Local Modification Scheme: changing the position of control point Pi only affects the

curve C(u) on interval [ui, ui+p+1)

  • 5. B-spline curve is Cp-k continuous at a knot of multiplicity k
  • 6. Variation Diminishing Property
  • 7. Bézier Curves Are Special Cases of B-spline Curves
  • 8. Affine Invariance

Notation: m + 1 knots, n+1 control points, p degree

slide-40
SLIDE 40

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Knot Insertion

  • We want to insert a new knot without changing the shape of the

curve

  • Since m = n + p + 1, adding a knot must be compensated:
  • by changing the degree of the curve (global)
  • by adding a new control point (local)
slide-41
SLIDE 41

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Inserting a knot

  • Suppose the new knot t lies in knot span [uk, uk+1)
  • Only the basis that corresponds to Pk, Pk-1, ... , Pk-p are non-zero
  • Thus, the operation is local!
  • To add the knot, we substitute the control points Pk-p+1 to Pk-1 with Qk-p+1 to Qk using

special corner cutting rules:

  • Remember to also add t to the knot vector!

Pk−p Pk−p+1 Pk−4 Pk−3 Pk−2 Pk−1 Pk Qk−p+1 Qk−3 Qk−2 Qk−1 Qk

slide-42
SLIDE 42

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Example

  • p = 3 (cubic)
  • P2 P3 P4 P5 are affected

u0 u1 u2 u3 u4 u5 u6 u7 u8 u9 u10 u11

0.2 0.4 0.6 0.8 1 1 1 1

0.5

u0 u1 u2 u3 u4 u5 u6 u7 u8 u9 u10 u11 u12

0.2 0.4 0.5 0.6 0.8 1 1 1 1

slide-43
SLIDE 43

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Incremental rendering

slide-44
SLIDE 44

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

De Boor’s Algorithm

  • It is a generalization of de Casteljau’s algorithm
  • It provides a numerically stable way to find a point on the B-spline
  • The implementation requires to iteratively add new knots using the

knot insertion algorithm

  • The algorithm works because:
  • If a knot u is inserted repeatedly so that its multiplicity is p, the

last generated new control point is the point on the curve that corresponds to u

slide-45
SLIDE 45

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

De Boor’s Algorithm

slide-46
SLIDE 46

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Algorithm

  • Find the knot interval that corresponds to the point you want to

evaluate

  • Find the affected control points
  • Start the corner cutting, until you have a single control point left
slide-47
SLIDE 47

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Example

u0 u1 u2 u3 u4 u5 u6 u7 u8 u9 u10

0.25 0.5 0.75 1 1 1 1

  • p = 3 (cubic)
  • P1 P2 P3 P4 are affected

0.4

slide-48
SLIDE 48

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Relation with De Casteljau’s

  • The algorithm is similar to de Casteljau’s, but with two important

differences:

  • The weights used in the corner cutting change at every

subdivision step

  • The effect of the corner cutting is local
slide-49
SLIDE 49

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Subdividing a B-spline

  • We want to split a B-spline into two different curves:
  • let u be the splitting point
  • we want to define two B-splines defined on [0,u] and [u,1]

1 1 u

slide-50
SLIDE 50

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Subdivision algorithm

  • Apply de Boor’s at u
  • Traverse the control points vector always turning right
  • The knot vector for the first curve, contains all the knots in [0,u)

followed by p+1 copies of u

slide-51
SLIDE 51

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Example

slide-52
SLIDE 52

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

Subdividing a B-spline into Bézier segments

  • If you subdivide a B-spline curve at every knot, then each curve

segment becomes a Bézier curve of degree p

  • This results follows from this lemma, that links the B-spline basis

functions with the Bézier basis functions:

  • If the first [last] n+1 knots are 0 [1], then the i-th B-spline basis

function of degree n is identical to the i-th Bézier basis function for all i in the range of 0 and n

  • This means that the Bézier basis functions are special cases of B-spline

basis, and that Bézier curves are special cases of B-spline curves

slide-53
SLIDE 53

CSCI-GA.2270-001 - Computer Graphics - Daniele Panozzo

References

Fundamentals of Computer Graphics, Fourth Edition 4th Edition by Steve Marschner, Peter Shirley Chapter 15 Course notes: http://www.cs.mtu.edu/~shene/COURSES/cs3621/NOTES/