34
1 06/18/22 20:38 Graphics II 91.547 Introduction to Parametric Curves and Surfaces Session 2

11/6/2016 06:55 Graphics II 91.547 Introduction to Parametric Curves and Surfaces Session 2

Embed Size (px)

Citation preview

Page 1: 11/6/2016 06:55 Graphics II 91.547 Introduction to Parametric Curves and Surfaces Session 2

104/21/23 15:09

Graphics II 91.547

Introduction to Parametric Curvesand Surfaces

Session 2

Page 2: 11/6/2016 06:55 Graphics II 91.547 Introduction to Parametric Curves and Surfaces Session 2

204/21/23 15:09

Computer GraphicsConceptual Model

ApplicationModel

ApplicationProgram Graphics

System

OutputDevices

InputDevices

API

Function Callsor Protocol

Data

Page 3: 11/6/2016 06:55 Graphics II 91.547 Introduction to Parametric Curves and Surfaces Session 2

304/21/23 15:09

Page 4: 11/6/2016 06:55 Graphics II 91.547 Introduction to Parametric Curves and Surfaces Session 2

404/21/23 15:09

Gouraud Shading:Use Mean Normal at Each Vertex

Page 5: 11/6/2016 06:55 Graphics II 91.547 Introduction to Parametric Curves and Surfaces Session 2

504/21/23 15:09

The Utah Teapot: 32 Bezier Patches

Page 6: 11/6/2016 06:55 Graphics II 91.547 Introduction to Parametric Curves and Surfaces Session 2

604/21/23 15:09

Explict Representation of Curve:Two Dimensions

y f (x)

x g(y)

DependentVariable

IndependentVariable

General case: Neither variable is a single-valued function of the other.Example: a circle centered at the origin

y r 2 x 2 y r 2 x 2

Page 7: 11/6/2016 06:55 Graphics II 91.547 Introduction to Parametric Curves and Surfaces Session 2

704/21/23 15:09

Explicit Representation of a Curve:Three Dimensions

y f (x) z g(x)

c

y

x

zPlane x = c

(y,z) (y(c), g(c))

Page 8: 11/6/2016 06:55 Graphics II 91.547 Introduction to Parametric Curves and Surfaces Session 2

804/21/23 15:09

Implicit Representation

f (x, y) 0Two Dimensions:

Should be thought of as a “membership” or “testing”function.

Divides space into points on the curve and not onthe curve.

Circle: x y r2 2 2 0

Describes a curve

Line: ax by c 0

Page 9: 11/6/2016 06:55 Graphics II 91.547 Introduction to Parametric Curves and Surfaces Session 2

904/21/23 15:09

Implicit Representation:Three Dimensions

f (x, y, z) 0 Defines a surface in three dimensions.

Example: a sphere of radius r at origin

x 2 y2 z 2 r 2 0

There is no easy way to represent a curveimplicitly in three dimensions.

Algebraic surfaces are those in which f is polynomialin x, y, z. Quadric surfaces are algebraic surfaceswhere the polynomial is of degree at most 2.

Page 10: 11/6/2016 06:55 Graphics II 91.547 Introduction to Parametric Curves and Surfaces Session 2

1004/21/23 15:09

Problems with Implicit Representation

0 Difficult to evaluate for rendering because identifying points on the curve requires explicit solution for (x,y).

0 Limited variety of curves that can be obtained.

Page 11: 11/6/2016 06:55 Graphics II 91.547 Introduction to Parametric Curves and Surfaces Session 2

1104/21/23 15:09

Parametric Representationof Curves and Surfaces

Express each spatial variable for points on the curve asa function of a non-spatial independent variable.

x x(u)

y y(u)

z z(u)

Parametric surfaces require two parameters:

x x(u,v)

y y(u,v)

z z(u,v)

Where u is defined over some closed range, e.g. [0, 1]

Page 12: 11/6/2016 06:55 Graphics II 91.547 Introduction to Parametric Curves and Surfaces Session 2

1204/21/23 15:09

What does a Parametric RepresentationReally Mean?

( , , )x y z1 1 1

( , , )x y z2 2 2

( , , )x y z3 3 3

( , , )x y z4 4 4

u1 u2 u3 u4

u

Page 13: 11/6/2016 06:55 Graphics II 91.547 Introduction to Parametric Curves and Surfaces Session 2

1304/21/23 15:09

Advantages of Parametric Representation

0 Solves problem of choice of independent variable0 Easy computation of derivatives0 Provides mechanism for “tracing” a curve or surface0 Facilitates joining of multiple curves, surfaces0 Generates a rich variety of curves, surfaces0 Ease of rendering

Page 14: 11/6/2016 06:55 Graphics II 91.547 Introduction to Parametric Curves and Surfaces Session 2

1404/21/23 15:09

Parametric Polynomial Curves

p( )

( )

( )

( )

u

x u

y u

z u

Defines points on a parametric curve.

A polynomial parametric curve of degree n is defined:

n

k

kkuu

0

)( cp

zk

yk

xk

k

c

c

c

c

Page 15: 11/6/2016 06:55 Graphics II 91.547 Introduction to Parametric Curves and Surfaces Session 2

1504/21/23 15:09

Parametric Polynomial Surfaces

p c( , )

( , )

( , )

( , )

u v

x u v

y u v

z u v

u vijj

m

i

ni j

00

0 1

0 1

u

v

u=1

v=1v=0

u=0

y

z

x

Page 16: 11/6/2016 06:55 Graphics II 91.547 Introduction to Parametric Curves and Surfaces Session 2

1604/21/23 15:09

Continuity Considerations

p(0)

p(1)q(0)

q(1)

C0 continuity: p(1) q(0)=

C1 continuity: p' (1) q' (0) p' ( )u

pup

upu

x

y

z

p' (1) kq' (0)G1 continuity:

Page 17: 11/6/2016 06:55 Graphics II 91.547 Introduction to Parametric Curves and Surfaces Session 2

1704/21/23 15:09

What degree do we want?

High order polynomials provide more control over shapeof curve. Degree n provides 3(n+1) degrees of freedom,in the choice of ck.

The higher the order of a polynomial, the less “smooth” it is.A polynomial of degre n can change directions n-1 times.

Consider polynomial oforder 5.

Page 18: 11/6/2016 06:55 Graphics II 91.547 Introduction to Parametric Curves and Surfaces Session 2

1804/21/23 15:09

Parametric Cubic Polynomial CurvesMatrix Notation

p(u) c 0 c1u c 2u2 c3u

3 c kk0

3

u k uT c

c

c

c

c

c

0

1

2

3

z

y

x

c

c

c

3

3

3

3c u

1

2

3

u

u

u

Page 19: 11/6/2016 06:55 Graphics II 91.547 Introduction to Parametric Curves and Surfaces Session 2

1904/21/23 15:09

Parametric Curves:How Do I Control the Shape?

Page 20: 11/6/2016 06:55 Graphics II 91.547 Introduction to Parametric Curves and Surfaces Session 2

2004/21/23 15:09

Interpolation:Four control points on curve

p0

p1 p2

p3u 0

u 1u 13 u 2

3

32103

33

32

22

32

132

032

2

33

31

22

31

131

031

1

00

)1(

)()()(

)()()(

)0(

ccccpp

ccccpp

ccccpp

cpp

This constraint can be expressed by the equations:

p(u) c 0 c1u c 2u2 c3u

3 c kk0

3

u k uT c

Page 21: 11/6/2016 06:55 Graphics II 91.547 Introduction to Parametric Curves and Surfaces Session 2

2104/21/23 15:09

Computing the coefficients

A

1 0 0 0

1

1

1 1 1 1

13

13

2 13

3

23

23

2 23

3

( ) ( )

( ) ( )

Expressing the constraints in matrix form:

Where:

p Ac

p

p

p

p

p

0

1

2

3

p Ac A 1p A 1Ac c

c

c

c

c

c

0

1

2

3

Page 22: 11/6/2016 06:55 Graphics II 91.547 Introduction to Parametric Curves and Surfaces Session 2

2204/21/23 15:09

Computing the coefficients

5.45.135.135.4

5.4185.229

15.495.5

0001

1A

pAc 1

Page 23: 11/6/2016 06:55 Graphics II 91.547 Introduction to Parametric Curves and Surfaces Session 2

2304/21/23 15:09

Blending Functions

p(u) c 0 c1u c 2u2 c3u

3 c kk0

3

u k uT c

Substituting from c A 1p gives: p(u) uT A 1p

which can be written as:

p(u) b(u)T p

where b(u) (A 1 )T u is a column vector of blending functions.

b( )

( )

( )

( )

( )

u

b u

b u

b u

b u

0

1

2

3

Page 24: 11/6/2016 06:55 Graphics II 91.547 Introduction to Parametric Curves and Surfaces Session 2

2404/21/23 15:09

Blending Functions

3

2

1

0

32

5.45.135.135.4

5.4185.229

15.495.5

0001

1

p

p

p

p

uuu

Page 25: 11/6/2016 06:55 Graphics II 91.547 Introduction to Parametric Curves and Surfaces Session 2

2504/21/23 15:09

Expressing a point on the curve in terms of theblending polynomials

p p p p p( ) ( ) ( ) ( ) ( )u b u b u b u b u 0 0 1 1 2 2 3 3

Control points @ u 0 u 13 u 2

3 u 1

Page 26: 11/6/2016 06:55 Graphics II 91.547 Introduction to Parametric Curves and Surfaces Session 2

2604/21/23 15:09

What the blending functions look like:

b u u u u

b u u u u

b u u u u

b u u u u

092

13

23

1272

23

2272

13

392

13

23

1

1

1

( ) ( )( )( )

( ) ( )( )

( ) ( )( )

( ) ( )( )

b(u) (A 1 )T u

Page 27: 11/6/2016 06:55 Graphics II 91.547 Introduction to Parametric Curves and Surfaces Session 2

2704/21/23 15:09

0 Contains scalars and polynomials (vectors)0 Addition, zero polynomial defined0 Can express a basis, e.g.

0 Representation of a polynomial in terms of this basis can be expressed as a column vector of scalar coefficients.

Let’s look at polynomials as a vector space.

1

2

3

u

u

u

Page 28: 11/6/2016 06:55 Graphics II 91.547 Introduction to Parametric Curves and Surfaces Session 2

2804/21/23 15:09

Conversion of representation fromone basis to another

Representation: c p

u bBasis:

1

2

3

u

u

u

92

13

23

272

23

272

13

92

13

23

1

1

1

( )( )( )

( )( )

( )( )

( )( )

u u u

u u u

u u u

u u u

c

c

c

c

0

1

2

3

p

p

p

p

0

1

2

3

Page 29: 11/6/2016 06:55 Graphics II 91.547 Introduction to Parametric Curves and Surfaces Session 2

2904/21/23 15:09

Conversion of representation fromone basis to another

Representation: c p

u bBasis:

c A p 1

b A u ( )1 T

The central issue in parametric curves (and surfaces) isthe selection of an appropriate basis for the controlpoint representation.

Page 30: 11/6/2016 06:55 Graphics II 91.547 Introduction to Parametric Curves and Surfaces Session 2

3004/21/23 15:09

How do we extend this to 3 dimensions? Interpolating Patch

p00

p30

p03

p33u = constant

v = constant

p13

p23

p01

p02 p11

p10

p20

p12

p22

p21

p31

p32

Page 31: 11/6/2016 06:55 Graphics II 91.547 Introduction to Parametric Curves and Surfaces Session 2

3104/21/23 15:09

Bicubic interpolating surface patch

p c( , )u v u vi j

jiij

0

3

0

3

1

1

12 3

2 3

2 2 2 2 2 3

3 3 3 2 3 3

2 3

2

3

v v v

u uv uv uv

u u v u v u v

u u v u v u v

u u uv

v

v

T

u v

16 coefficients allow the interpolation of 16 points.

Page 32: 11/6/2016 06:55 Graphics II 91.547 Introduction to Parametric Curves and Surfaces Session 2

3204/21/23 15:09

Solving for Coefficients

p u Cv( , )u v T

Substituting the values at 16 points: u v, , , ,0 113

23

Gives the equation: P ACA T Where

A

1 0 0 0

1

1

1 1 1 1

13

13

2 13

3

23

23

2 23

3

( ) ( )

( ) ( )as before

Page 33: 11/6/2016 06:55 Graphics II 91.547 Introduction to Parametric Curves and Surfaces Session 2

3304/21/23 15:09

Solving for Coefficients

A p A A CA

A p CA

C A p A

1 1

1

1 1

( )

( )

T

T

T

p u Cv u A p A v

p b pb

p

( , ) ( )

( , ) ( ) ( )

( , ) ( ) ( )

u v

u v u v

u v b u b v p

T T T

T

ij o

j

i

i

j ij

1 1

3

0

3

Note: separability of blending polynomial in u, v.

Page 34: 11/6/2016 06:55 Graphics II 91.547 Introduction to Parametric Curves and Surfaces Session 2

3404/21/23 15:09

Lines of constant u and v areInterpolating curves

p00

p30

p03

p33u = constant

v = constant