Interpolating Curves Intro to curve interpolation & - - PowerPoint PPT Presentation

interpolating curves
SMART_READER_LITE
LIVE PREVIEW

Interpolating Curves Intro to curve interpolation & - - PowerPoint PPT Presentation

Interpolating Curves Intro to curve interpolation & approximation Polynomial interpolation Bzier curves Showtime: Logistics Assignment 2 is available For assignment questions use the bulletin board or email:


slide-1
SLIDE 1

Interpolating Curves

  • Intro to curve interpolation & approximation
  • Polynomial interpolation
  • Bézier curves
slide-2
SLIDE 2

Showtime:

slide-3
SLIDE 3

Logistics

  • Assignment 2 is available
  • For assignment questions use the bulletin board or email:
  • csc418tas@cs.toronto.edu
  • I’ll be away next week, Prof. Singh will be giving the lecture on

Wednesday

  • Reminder: Midterm held during tutorial time on Monday,
  • Feb. 12
  • Covers material from all lectures up to and including this one
slide-4
SLIDE 4

Interpolating Curves

  • Intro to curve interpolation & approximation
  • Polynomial interpolation
  • Bézier curves
slide-5
SLIDE 5

Applications

slide-6
SLIDE 6

Applications

  • Specify smooth camera path in scene along spline curve
  • Curved smooth bodies and shells (planes, boats, etc)
  • Animation curves
slide-7
SLIDE 7

Applications

slide-8
SLIDE 8

History

Used by engineers in ship building and airplane design before computers were around

  • Used to create smoothly varying

curves

  • Variations in curve achieved by the

use of weights (like control points)

slide-9
SLIDE 9

Interactive Design of Curves

Goal: Expand the capabilities of shapes beyond lines and conics, simple analytic functions and to allow design constraints. Design Issues:

  • Continuity (smoothness)
  • Control (local vs. global)
  • Interpolation vs. approximation of constraints
  • Other geometric properties

(planarity, tangent/curvature control)

  • Efficient analytic representation
slide-10
SLIDE 10

Cn continuity

Definition: a function is called Cn if it’s nth order derivative is continuous everywhere

slide-11
SLIDE 11

Local vs. Global Control

  • Local control changes curve only locally while maintaining

some constraints

  • Modifying point on curve affects local part of curve or

entire curve

slide-12
SLIDE 12

Interpolation vs Approximation

Interpolating splines: pass through all the data points (control points). Example: Hermite splines

slide-13
SLIDE 13

Interpolation vs. Approximation

Curve approximates but does not go through all of the control points. Comes close to them.

slide-14
SLIDE 14

Geometric continuity at a joint of two curves

Geometric Continuity G0: curves are joined G1: first derivatives are proportional at the join point The curve tangents thus have the same direction, but not necessarily the same magnitude. i.e., C1'(1) = (a,b,c) and C2'(0) = (k*a, k*b, k*c). G2: constant curvature at the join

slide-15
SLIDE 15

Example: Linear Interpolation

  • The simplest possible interpolation technique
  • Create a piecewise linear curve that connects the

control points

slide-16
SLIDE 16

Linear Interpolation

  • The simplest possible interpolation technique
  • Create a piecewise linear curve that connects the

control points

slide-17
SLIDE 17

Cn continuity

Definition: a function is called Cn if it’s nth order derivative is continuous everywhere

slide-18
SLIDE 18

General Problem Statement

  • Given N control points, Pi, i = 0…n - 1, t ∈ [0, 1] (by

convention)

  • Define a curve c(t) that interpolates / approximates them
  • Compute its derivatives (and tangents, normals etc)
slide-19
SLIDE 19

Polynomial Interpolation

  • Given N control points, Pi, i = 0…n-1, t ∈ [0, 1] (by

convention)

  • Define (N-1)-order polynomial x(t), y(t) such that

x(i/(N-1)) = xi, y(i/(N-1) = yi for i = 0, …, N-1

  • Compute its derivatives (and tangents, normals etc)
slide-20
SLIDE 20

Basic Equations

Equations for one control point: Equations in matrix form:

slide-21
SLIDE 21

Computing Coeffs

Equations in matrix form:

slide-22
SLIDE 22

What if < 4 Control Points?

slide-23
SLIDE 23

What if > 4 Control Points?

Equations in matrix form:

slide-24
SLIDE 24

Degree-N Poly Interpolation

  • To interpolate N points perfectly with a single

polynomial, we need a polynomial of degree N-1

Major drawback: it is a global interpolation scheme i.e. moving one control point changes the interpolation of all points, often in unexpected, unintuitive and undesirable ways

slide-25
SLIDE 25

Degree-N Poly Interpolation

  • To interpolate N points perfectly with a single

polynomial, we need a polynomial of degree N-1

Major drawback: it is a global interpolation scheme i.e. moving one control point changes the interpolation of all points, often in unexpected, unintuitive and undesirable ways

slide-26
SLIDE 26

Runge’s Phenomenon

The higher-order the polynomial, the more oscillation you get at the boundaries when using equidistant control points

slide-27
SLIDE 27

Instead we use “Splines”

Curve is defined by piecewise polynomials

slide-28
SLIDE 28

Example: Linear Interpolation

  • The simplest possible interpolation technique
  • Create a piecewise linear curve that connects the

control points

slide-29
SLIDE 29

Instead we use “Splines”

Curve is defined by piecewise polynomials

slide-30
SLIDE 30

Hermite Splines

  • Cubic polynomials specified by end point positons and end

point tangents (4 pieces of information)

slide-31
SLIDE 31

Evaluating Derivatives

slide-32
SLIDE 32

Designing Polynomial Curves from constraints

p(t) = TA , where T is powers of t. for a cubic T=[t3 t2 t1 1]. Written with geometric constraints p(t) = TMG, where M is the Basis matrix of a design curve and G the specific design constraints. An example of constraints for a cubic Hermite for eg. are end points and end tangents. i.e. P1,R1 at t=0 and P4,R4 at t=1. Plugging these constraints into p(t) = TA we get. B p(0) = P1 = [ 0 0 0 1 ] Ah p(1) = P4 = [ 1 1 1 1 ] Ah p'(0)= R1 = [ 0 0 1 0 ] Ah => G=BA, A=MG => M=B-1 p'(1)= R4 = [ 3 2 1 0 ] Ah

slide-33
SLIDE 33

Bézier Curves

Properties:

  • Polynomial curves defined via endpoints and derivative

constraints

  • Derivative constraints defined implicitly through extra

control points (that are not interpolated)

  • They are approximating curves, not interpolating curves
slide-34
SLIDE 34

Bézier Curves: Main Idea

Polynomial and its derivatives expressed as a cascade of linear interpolations

slide-35
SLIDE 35

Bézier Curves: Control Polygon

A Bézier curve is completely determined by its control polygon We manipulate the curve by manipulating its polygon

slide-36
SLIDE 36

Bézier Curve as a Polynomial

slide-37
SLIDE 37

Derivatives of the Bézier Curve

slide-38
SLIDE 38

Endpoints and Tangent Constraints

General Behaviour

  • 1st and 3rd control points

define the endpoints.

  • 2nd control point defines the

tangent vector at the endpoints.

slide-39
SLIDE 39

Generalization to N+1 points

Example for 4 control points and 3 cascades Expression in compact form: Curve defined by N linear interpolation cascades (De Casteljau's algorithm):

slide-40
SLIDE 40

Bézier and Control Points

Expression in compact form:

slide-41
SLIDE 41

Bézier Curves: Useful Properties

Expression in compact form: 1.Affine Invariance

  • Transforming a Bézier curve by an affine

transform T is equivalent to transforming its control points by T 2.Diminishing Variation

  • No line will intersect the curve at more

points than the control polygon

  • curve cannot exhibit “excessive

fluctuations” 3.Linear Precision

  • If control poly approximates a line, so will

the curve

slide-42
SLIDE 42

Bézier Curves: Useful Properties

Expression in compact form:

  • 4. Tangents at endpoints are along the 1st

and last edges of control polygon:

slide-43
SLIDE 43

Bézier Curves: Pros and Cons

Advantages:

  • Intuitive control for N ≤ 3
  • Derivatives easy to compute
  • Nice properties (affine invariance, diminishing variation)

Disadvantages:

  • Scheme is still global (curve is function of all control points)
slide-44
SLIDE 44

Reminders

slide-45
SLIDE 45

Bezier Basis Matrix

A cubic Bezier can be defined with four points where: P1,R1 at t=0 and P4,R4 at t=1 for a Hermite. R1 = 3(P2-P1) and R4 = 3(P4-P3). We can thus compute the Bezier Basis Matrix by finding the matrix that transforms [P1 P2 P3 P4 ]T into [P1 P4 R1 R4 ] T i.e. B_H =[ 1 0 0 0 ] [ 0 0 0 1] [-3 3 0 0] [ 0 0 -3 3] Mbezier=Mhermite * B_H

slide-46
SLIDE 46

Bezier Basis Functions

[ -1 3 -3 1 ] [ 3 -6 3 0 ] [ -3 3 0 0 ] [ 1 0 0 0 ] The columns of the Basis Matrix form Basis Functions such that: p(t)= f1(t)P1 + f2(t)P2 + f3(t)P3 + f4(t)P4. From the matrix: fi(t) = (

n) *(1-t)(n-i) *ti i

These are also called Bernstein polynomials.

slide-47
SLIDE 47

Basis Functions

Basis functions can be thought of as interpolating functions. Note: actual interpolation of any point only happens if its Basis function is 1 and all others are zero at some t. Often Basis functions for design curves sum to 1 for all t. This gives the curve some nice properties like affine invariance and the convex hull property when the function are additionally non-negative.