07 - Designing Interpolating Curves

Preview:

Citation preview

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

07 - Designing Interpolating Curves

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

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

How do we model shapes?

Delcam Plc. [CC BY-SA 3.0 (http://creativecommons.org/licenses/by-sa/3.0) or GFDL (http://www.gnu.org/copyleft/fdl.html)], via Wikimedia Commons

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

Building blocks: curves and surfaces

By Wojciech mula at Polish Wikipedia, CC BY-SA 3.0, https://commons.wikimedia.org/w/index.php?curid=9853555

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

A modeling session

• Demo with Keynote for 2D

• Demo with Blender for 3D

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

Modeling curves

• We need mathematical concepts to characterize the desired curve properties

• Notions from curve geometry help with designing user interfaces for curve creation and editing

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

2D parametric curve• must be continuous

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

A curve can be parameterized in many different ways

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

Tangent vector

Parametrizat

ion-indepen

dent!

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

Arc length• How long is the curve between and ? How far does the particle

travel?

• Speed is , so:

• Speed is nonnegative, so is non-decreasing

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

Arc length parameterization• Every curve has a natural parameterization:

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

Arc length parameterization• Every curve has a natural parameterization:

• Isometry between parameter domain and curve

• Tangent vector is unit-length:

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

Curvature• How much does the curve turn per unit ?

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

Curvature• How much does the curve turn per unit ?

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

Curvature profile

• Given , we can get up to a constant by integration. Integrating

reconstructs the curve up to rigid motion.

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

Curvature of a circle• Curvature of a circle:

Osculating circle

= Unit Normal

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

Frenet Frame

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

Curvature normal• Points inward

• useful for evaluating curve quality

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

SmoothnessTwo kinds, parametric and geometric:

Parametrization-Independent

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

Smoothness example

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

Recap on parametric curves

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

Turning• Angle from start tangent to end tangent:

• If curve is closed, the tangent at the beginning is the same as the tangent at the end

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

Turning numbers

• measures how many full turns the tangent makes.

1 –1 2 0

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

Space curves (3D)• In 3D, many vectors are orthogonal to T

• are the “Frenet frame”

• is torsion: non-planarity

N

T

B

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

Designing Curves:Polynomials and Interpolation

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

Basic idea for curve design• User gives us points. We need to connect the dots in a smooth way.

• The dots stay as “handles” on the curve. User can move the dots and the curve follows.

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

Basic idea for curve design• User gives us points. We need to connect the dots in a smooth way.

• The dots stay as “handles” on the curve. User can move the dots and the curve follows.

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

Keynote Demo

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

Blender Demo

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

Polynomial curves• Polynomials

• For degree we need points (“coefficients”)

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

Polynomials• Parametric form with polynomials

• Control shape?

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

Polynomials• Parametric form with polynomials

• Control shape?

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

Polynomials• Parametric form with polynomials

• Control shape?

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

Polynomials• Parametric form with polynomials

• Control shape?

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

Polynomials• Parametric form with polynomials

• Control shape?

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

Polynomials• Parametric form with polynomials

• Control shape?

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

Polynomials• Parametric form with polynomials

• Control shape?

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

Polynomials• Parametric form with polynomials

• Control shape?

• Monomial coefficients are not intuitive

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

Interpolation (1D)• Interpolate control points • Find polynomial

with

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

Interpolation (1D)• Interpolate control points • Find polynomial

with

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

Interpolation (1D)• Interpolate control points • Find polynomial

with • Solve

Vandermonde matrix

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

Interpolation (1D)• Interpolate control points • Find polynomial

with • Solve

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

Interpolation (1D)• Interpolate control points • Find polynomial

with • Solve

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

Interpolation (1D)• Polynomial fitting can be done explicitly:

• Check that

• Products are called Lagrange polynomials

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

Example of 1D Interpolation

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

Recap

• Monomial coefficients unintuitive

• Lagrange interpolation is better, but there is a global effect

• The possible curves are the same: just cubics

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

Polynomials form a vector space• You can add and subtract them

• You can multiply them by real numbers

• These operations follow the usual rules • Associativity, commutativity, inverses for addition • Distributivity for scalar multiplication • Etc.

• Anything you can do with vectors in general, you can do with polynomials.

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

Monomial basis for cubics:

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

Interpolation basis for :

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

Remark

• Basis change is just a matrix multiplication

• We need to find a good basis for intuitively designing curves

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

Interpolation in 2D• We now have pairs we want to interpolate:

• How to choose ’s at which to specify ?

• Parameter space matters!

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

Runge’s phenomenon

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

Splines• Paste together low-degree polynomials

CubicCub

ic

Cubic

Cubic Cub

ic

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

How do we get smoothness?• With Lagrange polynomials, it’s hard to get tangents to match up

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

Hermite Basis• Instead of four points, specify two points and two derivatives:

Cubic polynomials of the form

p(t0) = p0

p(t1) = p1

p0(t0) = m0

p0(t1) = m1

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

Hermite Basis• Instead of four points, specify two points and two derivatives:

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

Catmull-Rom splines• If no tangents are explicitly specified – get them from the input

points!

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

Next time

• Approximating Curves • Bezier splines • B-splines

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

References

Fundamentals of Computer Graphics, Fourth Edition 4th Edition by Steve Marschner, Peter Shirley

Chapter 15

Recommended