22
CS-C3100 Computer Graphics Bézier Curves and Splines 3.1 Introduction to Splines Majority of slides from Frédo Durand vectorportal.com

CS-C3100 Computer Graphics Bézier Curves and Splines 3.1 ...lehtinj7/CS-C3100/2020/slides/3.1.intro.to.sp... · Guilherme Marconi • How? Modeling Curves in 2D 4 • Polylines –

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: CS-C3100 Computer Graphics Bézier Curves and Splines 3.1 ...lehtinj7/CS-C3100/2020/slides/3.1.intro.to.sp... · Guilherme Marconi • How? Modeling Curves in 2D 4 • Polylines –

CS-C3100 Computer Graphics Bézier Curves and Splines

3.1 Introduction to Splines

Majority of slides from Frédo Durand

vectorportal.com

Page 2: CS-C3100 Computer Graphics Bézier Curves and Splines 3.1 ...lehtinj7/CS-C3100/2020/slides/3.1.intro.to.sp... · Guilherme Marconi • How? Modeling Curves in 2D 4 • Polylines –

• Representing 2D curves (3D: simple extension) • Splines: piecewise polynomial curves

– Defined by a sequence of control points and a mathematical rule that turns them into a smooth curve

• In particular: cubic Bézier curves

In This Video

2

Page 3: CS-C3100 Computer Graphics Bézier Curves and Splines 3.1 ...lehtinj7/CS-C3100/2020/slides/3.1.intro.to.sp... · Guilherme Marconi • How? Modeling Curves in 2D 4 • Polylines –

• Curves in 2D – Useful in their own right – Provides basis for surface

modeling

Why Curves?

Guilherme Marconi

Page 4: CS-C3100 Computer Graphics Bézier Curves and Splines 3.1 ...lehtinj7/CS-C3100/2020/slides/3.1.intro.to.sp... · Guilherme Marconi • How? Modeling Curves in 2D 4 • Polylines –

• How?

Modeling Curves in 2D

4

Page 5: CS-C3100 Computer Graphics Bézier Curves and Splines 3.1 ...lehtinj7/CS-C3100/2020/slides/3.1.intro.to.sp... · Guilherme Marconi • How? Modeling Curves in 2D 4 • Polylines –

• Polylines – Sequence of vertices connected

by straight line segments – Useful, but not for smooth curves – This is the representation

that usually gets drawn in the end (smooth curves converted into these)

• Smooth curves – How do we specify them? – A little harder (but not too much)

Modeling Curves in 2D

5

Page 6: CS-C3100 Computer Graphics Bézier Curves and Splines 3.1 ...lehtinj7/CS-C3100/2020/slides/3.1.intro.to.sp... · Guilherme Marconi • How? Modeling Curves in 2D 4 • Polylines –

6

Splines• A type of smooth curve

in the plane or in 3D • Many uses

– 2D Illustration (e.g. Adobe Illustrator) – Fonts – 3D Modeling – Animation: Trajectories

• In general: Interpolation and approximation

ACM © 1987 “Principles of traditional animation applied to 3D computer animation”

Page 7: CS-C3100 Computer Graphics Bézier Curves and Splines 3.1 ...lehtinj7/CS-C3100/2020/slides/3.1.intro.to.sp... · Guilherme Marconi • How? Modeling Curves in 2D 4 • Polylines –

How Many Dimensions?

7

Page 8: CS-C3100 Computer Graphics Bézier Curves and Splines 3.1 ...lehtinj7/CS-C3100/2020/slides/3.1.intro.to.sp... · Guilherme Marconi • How? Modeling Curves in 2D 4 • Polylines –

How Many Dimensions?

8

This curve lies on the 2D plane,

but is itself 1D.

= you need one number to identify any point on the curve

Page 9: CS-C3100 Computer Graphics Bézier Curves and Splines 3.1 ...lehtinj7/CS-C3100/2020/slides/3.1.intro.to.sp... · Guilherme Marconi • How? Modeling Curves in 2D 4 • Polylines –

How Many Dimensions?

9

This curve lies on the 2D plane,

but is itself 1D. You can just as well define 1D curves in

3D space.

Page 10: CS-C3100 Computer Graphics Bézier Curves and Splines 3.1 ...lehtinj7/CS-C3100/2020/slides/3.1.intro.to.sp... · Guilherme Marconi • How? Modeling Curves in 2D 4 • Polylines –

10

Two Definitions of a Curve1.A continuous 1D point set on the plane or space 2.A mapping from an interval S onto the plane

– That is, P(t) is the point of the curve at parameter t

• Big differences – It’s easy to generate points on the curve from the 2nd – The second definition can describe trajectories, the

speed at which we move on the curve

P : R ⇥ S ⇤� R2, P (t) =�

x(t)y(t)

Page 11: CS-C3100 Computer Graphics Bézier Curves and Splines 3.1 ...lehtinj7/CS-C3100/2020/slides/3.1.intro.to.sp... · Guilherme Marconi • How? Modeling Curves in 2D 4 • Polylines –

• A continuous 1D point set on the plane or space • A mapping from an interval S onto the plane

– That is, P(t) is the point of the curve at parameter t

• An “algebraic curve”, e.g. intersection of and

11

Example of the First Definition?

P : R ⇥ S ⇤� R2, P (t) =�

x(t)y(t)

x2 + y2 + z2 = 1 z = 0

Page 12: CS-C3100 Computer Graphics Bézier Curves and Splines 3.1 ...lehtinj7/CS-C3100/2020/slides/3.1.intro.to.sp... · Guilherme Marconi • How? Modeling Curves in 2D 4 • Polylines –

• A continuous 1D point set on the plane or space • A mapping from an interval S onto the plane

– That is, P(t) is the point of the curve at parameter t

• An “algebraic curve”, e.g. intersection of and

11

Example of the First Definition?

P : R ⇥ S ⇤� R2, P (t) =�

x(t)y(t)

x2 + y2 + z2 = 1 z = 0 It’s a circle on the xy plane :)

Page 13: CS-C3100 Computer Graphics Bézier Curves and Splines 3.1 ...lehtinj7/CS-C3100/2020/slides/3.1.intro.to.sp... · Guilherme Marconi • How? Modeling Curves in 2D 4 • Polylines –

12

General Principle for Modeling• User specifies “control points” • We’ll interpolate the control points

by a smooth curve – The curve is completely

determined by the control points. – I.e., we need an unambiguous

rule that gives us the curve points given the control points.

Page 14: CS-C3100 Computer Graphics Bézier Curves and Splines 3.1 ...lehtinj7/CS-C3100/2020/slides/3.1.intro.to.sp... · Guilherme Marconi • How? Modeling Curves in 2D 4 • Polylines –

13

Physical Splines

www.abm.org

See http://en.w

ikipedia.org/wiki/Flat_spline

Page 15: CS-C3100 Computer Graphics Bézier Curves and Splines 3.1 ...lehtinj7/CS-C3100/2020/slides/3.1.intro.to.sp... · Guilherme Marconi • How? Modeling Curves in 2D 4 • Polylines –

Splines in graphics = mathematical rule for turning sequence of points into smooth curve

14

Control points

Smooth spline curve

Control points

Page 16: CS-C3100 Computer Graphics Bézier Curves and Splines 3.1 ...lehtinj7/CS-C3100/2020/slides/3.1.intro.to.sp... · Guilherme Marconi • How? Modeling Curves in 2D 4 • Polylines –

15

Splines• Specified by a few control points

– Good for UI – Good for storage

• Results in a smooth parametric curve P(t) – Just means that we specify x(t) and y(t) – In practice low-order polynomials chained together – Convenient for animation, where t is time – Convenient for tessellation because we can discretize t and approximate the curve with a polyline

Page 17: CS-C3100 Computer Graphics Bézier Curves and Splines 3.1 ...lehtinj7/CS-C3100/2020/slides/3.1.intro.to.sp... · Guilherme Marconi • How? Modeling Curves in 2D 4 • Polylines –

Tessellation

16

Page 18: CS-C3100 Computer Graphics Bézier Curves and Splines 3.1 ...lehtinj7/CS-C3100/2020/slides/3.1.intro.to.sp... · Guilherme Marconi • How? Modeling Curves in 2D 4 • Polylines –

Tessellation

17

Page 19: CS-C3100 Computer Graphics Bézier Curves and Splines 3.1 ...lehtinj7/CS-C3100/2020/slides/3.1.intro.to.sp... · Guilherme Marconi • How? Modeling Curves in 2D 4 • Polylines –

Tessellation

18

It’s clear that adding more points will get us closer to

the curve.

Page 20: CS-C3100 Computer Graphics Bézier Curves and Splines 3.1 ...lehtinj7/CS-C3100/2020/slides/3.1.intro.to.sp... · Guilherme Marconi • How? Modeling Curves in 2D 4 • Polylines –

19

Interpolation vs. Approximation• Interpolation

– Goes through all specified points – Sounds more logical

• Approximation – Does not go through all points

Interpolation

Approximation

Page 21: CS-C3100 Computer Graphics Bézier Curves and Splines 3.1 ...lehtinj7/CS-C3100/2020/slides/3.1.intro.to.sp... · Guilherme Marconi • How? Modeling Curves in 2D 4 • Polylines –

20

Interpolation vs. Approximation• Interpolation

– Goes through all specified points – Sounds more logical – But can be more unstable, “ringing”

• Approximation – Does not go through all points – Turns out to be convenient

• In practice, we’ll do something in between.

Interpolation

Approximation

Page 22: CS-C3100 Computer Graphics Bézier Curves and Splines 3.1 ...lehtinj7/CS-C3100/2020/slides/3.1.intro.to.sp... · Guilherme Marconi • How? Modeling Curves in 2D 4 • Polylines –

21

Next up:

The Cubic Bézier Curve