curves and surface i

35
Curves and Surface I Angel Ch.10

Upload: others

Post on 11-May-2022

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Curves and Surface I

Curves and Surface I

Angel Ch.10

Page 2: Curves and Surface I

Representation of Curves and Surfaces

Piece-wise linear representation is inefficient - line segments to approximate curve - polygon mesh to approximate surfaces - can not approximate general curves exactly - only continous in position (not derivatives)

Modelling of smooth curves and surface - ‘smooth’ continuous in position and derivatives (1st/2nd…) - exact representation of non-planar objects

Representation of curves and surfaces: (1) Explicit: y=g(x) (2) Implicit: f(x,y)=0 (3) Parametric: x=x(u), y=y(u)

Parametric forms commonly used in computer graphics/CAD

Page 3: Curves and Surface I

Explicit Representation of Curves

Curves in 2D y=g(x) is a general curve in x,y space x independent variable y dependent variable

Inverse relation: x=h(y) - inverse may not exist

Example: 2D Line y=ax+b a-slope b-intersection with y-axis Problem with representing a vertical line a=infinity

Example: 2D Circle radius r

- explicit equation only represent half the circle

22 xry −=

Page 4: Curves and Surface I

Explicit Curves in 3D The 3D explicit representation of a curve requires 2 equations

y=g(x) z=f(x) - y,z are both dependent variables

Example: Line in 3D

y=ax+b z=cx+d - cannot represent a line in a plane of x=const

Explicit representation of a surface z=f(x,y) - 2 independent variables x,y - z dependent variable

Cannot represent a full sphere 222 yxrz −−=

Page 5: Curves and Surface I

Explicit representations are co-ordinate system dependent - can not represent all curves such as lines/circles - Curves exist independent of any representation - failures causes serious problems in graphics/CAD

Page 6: Curves and Surface I

Implicit Representation

2D Curves: f(x,y)=0 - f() is a ‘membership’ testing function (x,y) is on the curve if f(x,y)=0 - In general no analytic way to find points on the curve

ie to evaluate y value corresponding to given x - overcomes some of coordinate system dependent problems - represents all lines and circles

Example: 2D Line ax+by+c=0 - represent vertical line a=-1, b=0

Example: 2D Circle - represents the entire circle

0222 =−+ ryx

Page 7: Curves and Surface I

3D Surfaces: f(x,y,z)=0 - membership test is (x,y,z) on the curve or surface - general representation in 3-space - represents any plane or line in 3-space

Plane: ax+by+cz+d=0 - slopes a,b,c wrt x,y,z-axis

Sphere of radius r: 02222 =−++ rzyx

3D Curves: - not easily represented in 3D - intersection of two implicit surfaces f(x,y,z)=0 g(x,y,z)=0 point (x,y,z) on curve must be a member of both function - line represented by intersection of 2 planes

Page 8: Curves and Surface I

Algebraic surfaces - class of implicit surfaces where f(x,y,z) is a polynomial function of the three variables

is an nth order polynomial - quadric surfaces n=2 are of particular importance as they represent several common surfaces sphere, cone, torus, ellipsoid

Quadrics have the property that intersection with a line gives at most 2 intersection points (used for rendering)

0)(1

=+++∑=

ii

ii

n

i

ii zcybxad

Page 9: Curves and Surface I

Parametric Representation

Parametric curve in 3-space is a function of 1-parameter, u x=x(u) y=y(u) z=z(u) - general representation - same in 2-space and 3-space - u is independent variable and x,y,z dependent

Curve can be written as the set (locus) of points:

p(u) = [x(u) y(u) z(u)]

Derivative of curve:

⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢

=

duudzduudyduudx

duudp

)(

)(

)(

)(

- partial derivative wrt each function - points in the direction tangent to the curve - magnitude is rate of change wrt to u (velocity)

Page 10: Curves and Surface I

Example: 3D Line

⎥⎥⎥

⎢⎢⎢

−+−+−+

=

⎥⎥⎥

⎢⎢⎢

⎡−+

⎥⎥⎥

⎢⎢⎢

⎡=

−+=

)()()(

)1(

)1()(

212

212

212

2

2

2

1

1

1

21

zzzyyyxxx

zyx

zyx

ppp

ααα

αα

ααα

Derivatives:

⎥⎥⎥

⎢⎢⎢

−−−

==)()()(

)()(

21

21

21

zzyyxx

pddp α

αα

α

Page 11: Curves and Surface I

Parametric surface: x=x(u,v) y=y(u,v) z=z(u,v)

- 2 independent parameters u,v p(u,v) = [ x(u,v) y(u,v) z(u,v)]T

plane tangent therepresent sderivative Partial - d(v)p(v)

),(),(),(

uv)z(u,

uv)y(u,

uv)x(u,

up(u)

sDerivative Partial

v

u

u

u

u

p

vuzvuyvux

p

=∂

⎥⎥⎥

⎢⎢⎢

⎡=

⎥⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢⎢

∂∂∂

∂∂

==∂

Page 12: Curves and Surface I

Parametric representation - widely used in computer graphics for curves and surfaces and CAD - general representation of many forms. - simple computation of derivatives - requires a parameterization (u,v) of the surface ie underlying 2D coordinate system for a 3D surface - representation depends on 2D coordinate system - polynomial parametric forms used to represent a wide variety of surfaces. How can we define the parametric form of a surface?

Page 13: Curves and Surface I

Parametric Polynomial Curves

∑∑∑

===

=

===

+

⎥⎥⎥

⎢⎢⎢

⎡=

=

⎥⎥⎥

⎢⎢⎢

⎡=

n

kzk

kn

kyk

kn

kxk

k

zk

yk

xk

k

k

n

kk

k

cuuzcuuycuux

ccc

c

c

cuup

uzuyux

up

000

0

)()()(

:equations of setst independen 3 givingfreedom, of degrees 1)3(n has curve parametric The

zy,in x, tscoefficient independenh matrix witcolumn a is where

)(

:bygiven isn degree of curve parametric polynomialA )()()(

)( :as drepresente is space-3in curve parametricA

Page 14: Curves and Surface I

We can define the curves x(u), y(u), z(u) over a range of u

maxmin uuu ≤≤

- p(u) over this range gives a curve segment

Without loss of generality we can define the curve segment:

10 ≤≤ u

Page 15: Curves and Surface I

Parametric Polynomial Surfaces

Define a surface by n and m order polynomials in u and v

∑∑= =

=⎥⎥⎥

⎢⎢⎢

⎡=

n

k

m

jjk

jk cvuvuzvuyvux

vup0 0),(

),(),(

),(

Surface has 3(n+1)(m+1) degrees of freedom

Usually, n=m and we parameterize u,v over the range 0,1 giving a surface patch. The surface can be viewed in the limit as a collection of curves generated by holding u or v constant

Page 16: Curves and Surface I

∑∑

∑∑

= =

= =

=⎥⎥⎥

⎢⎢⎢

⎡=

=⎥⎥⎥

⎢⎢⎢

⎡=

n

k

m

jjk

jk

v

v

v

v

n

k

m

jjk

jk

u

u

u

u

cvjuvuzvuyvux

vup

cvkuvuzvuyvux

vup

0 0

1

0 0

1

),(),(),(

),(

),(),(),(

),(

sDerivative Partial

∑∑

∑∑

= =

−−

= =

=⎥⎥⎥

⎢⎢⎢

⎡==

−=⎥⎥⎥

⎢⎢⎢

⎡=

n

k

m

jjk

jk

v

v

v

vuuv

n

k

m

jjk

jk

u

u

u

uu

cvkjuvuzvuyvux

vupvup

cvukkvuzvuyvux

vup

0 0

11

0 0

2

),(),(),(

),(),(

)1(),(),(),(

),(

sDerivative PartialOrder 2nd

Page 17: Curves and Surface I

Design Criteria Representations of curves and surfaces in computer graphics and CAD should satisfy the following:

•  Local control of shape •  Smoothness and continuity •  Direct evaluation of derivatives •  Stability

(small change in parameters gives a small change in shape) •  Fast Rendering

Use representations based on low-order parametric polynomials to satisfy the above

Page 18: Curves and Surface I

Local Control of Shape

- ideally control local shape with a set of local parameters rather than global change in shape - easier to design desired shape Represent curve shape p(u) by a set of ‘control points’:

- local curve shape is based on the position of the control points Interpolating curve: passes through all control point

Page 19: Curves and Surface I

Smoothness and Continuity

‘Smoothness’ of a curve refers to the continuity of derivatives of the curve For a parametric curve all derivatives exist and are continuous

.....)1()()()(2

2

1

1

0∑∑∑=

=

=

−===n

k

kkuu

n

k

kk

n

ku

kk uckkupukcupucup

For two curves meeting at a join point the smoothness is defined by the highest derivative which is continuous

discontinuity in 1st derivative continuous in 1st derivative

Page 20: Curves and Surface I

space-3in continous is curve ly theconsequent andu spaceparameter in continous are sDerivative

)0()1(:

)0()1(:)0()1(:

continous isch whi parameters respect to with derivativeorder highest -

Continuity Parametric

2

1

0

uuuu

uu

n

qpCqpCqpC

C

=

==

Page 21: Curves and Surface I

direction same in the is curvature - )0()1(:

shape control toparameter free remaining use 3n rather tha derivateson sconstraint 2only requires -

direction same in the are curve to tangents- )0()1(:magnitudedifferent

but direction same in the are space-3in sderivative - Continuity Geometric

2

1

uuuu

uu

n

qpG

qpG

G

Page 22: Curves and Surface I

Parametric Cubic Polynomial Curves

What is the correct order of polynomial curve - low-order: less flexible - high-order: costly, bumpy (too many degrees of freedom)

Designing curve locally by a set of control points we can use a low-order curve to approximate complex shapes. Cubic polynomial curves are widely used:

c unknowns 12in equations 12

1

)(

3

2

3

2

1

0

3

0

33

2210

⎥⎥⎥

⎢⎢⎢

⎡=

⎥⎥⎥⎥

⎢⎢⎢⎢

=

⎥⎥⎥⎥

⎢⎢⎢⎢

=

==+++= ∑=

kz

ky

kx

k

k

Tkk

ccc

c

uuu

u

cccc

c

cuucucucuccup

Want methods of deriving parameters c for a desired curve!

Page 23: Curves and Surface I

Cubic Polynomial Interpolation

3...0zyx

p

:hem through tpassesexactly and embetween thesinterpolat that curve derive 12dof) (ie points-4 ofset aGiven

i

i

i

i =⎥⎥⎥

⎢⎢⎢

⎡= i

0p

1p

2p

3p

1,32,

310,u curve thealong intervals spacedequally at be points Let the

points theesinterpolat)( curve thesuch that c tscoefficien theareWhat

=

=

i

T

pcuup

( ) ( )( ) ( )

32103

33

32

22

32

132

032

2

33

31

22

31

131

031

1

00

)1()(

)(

)0(:conditionsfour thegives This

ccccppccccpp

ccccpp

cpp

+++==+++==

+++==

==

Page 24: Curves and Surface I

( ) ( )( ) ( )

matricieselement 4x3 are ,1111

11

0001 :formmatrix In

3322

32

32

3312

31

31

3

2

1

0

3

2

1

0

3

2

1

0

3

2

1

0

cp

A

zzzz

yyyy

xxxx

pppp

p

Acp

⎥⎥⎥⎥

⎢⎢⎢⎢

=

⎥⎥⎥⎥

⎢⎢⎢⎢

=

⎥⎥⎥⎥

⎢⎢⎢⎢

=

=

points control 4 ofset given a esinterpolat that curve thedefines -5.45.135.135.45.4185.229

15.495.50001

matrix' inginterpolat' obtain the toinverted becan andsigular -non is

:unknowns) 12in equations (12c parameters curveunknown want p, points control know We

1

1

l

l

l

l

M

AM

MApMpAc

⎥⎥⎥⎥

⎢⎢⎢⎢

−−−−

−−==

−==

Page 25: Curves and Surface I

segmentsbetween Conly but segment each for continuityC has curve Resulting

same hassegment each en segment theach for [0,1]ulet weIf......

..... ..... .....

:points controlfour of group aby definedeach curves inginterpolat cubic ofset a definecan we

...., points control of sequence aGiven

03

96

63

30

10

l

m

M

pppppp

ppp

=

Page 26: Curves and Surface I

Blending Functions

⎥⎥⎥⎥

⎢⎢⎢⎢

==

===

)()()()(

)(

)(b functions blending ofset a toaccording p points control ofn combinatio theasion interpolat heconsider tcan We

3

2

1

0

ii

ubububub

uMub

pb(u)pMuc up(u) u

Tl

T l

TT

∑=

=+++=3

022221100

i

)(p (u)p (u)p (u)p (u))(

:pointeach of onscontributi individual the together blends''or weightsu which in polynomial a is)(bfunction blendingEach

iii pubbbbbup

u

Page 27: Curves and Surface I

21

32

31

29

3

31

227

2

32

227

1

32

31

29

0

uabout symmetric arefunction Blending :Note))((

)1)(()1)((

)1)()(( :ioninterpolat cubicfor functions Blending

=−−=

−−−=−−=

−−−−=

uuu(u)buuu(u)buuu(u)b

uuu(u)b

All zeros of the blending functions are in the interval [0,1] - blending functions must vary substantially over [0,1]

ie rapid changes - results from requirement that curve pass through all control points

This results in limited usefulness of ‘interpolating’ cubic polynomial + polynomial is discontinuous between sections Apply same derivation process to polynomials with other constraints

Page 28: Curves and Surface I

Cubic Interpolation Patch

Extension of interpolating curve to a surface

[ ]

points ofset given a esinterpolath whicsurface theevaluate tofind want to which wetscoefficien 48 has - C

11

),(

:points 16by defined ispatch surface inginterpolat Bicubic

3

2

3

2

33323130

23222120

13121110

03020100

3

0

3

0

zijyijxijij

T

i jij

ji

ccccvvv

v

uuu

u

cccccccccccccccc

C

Cvucvuvup

=

⎥⎥⎥⎥

⎢⎢⎢⎢

=

⎥⎥⎥⎥

⎢⎢⎢⎢

=

⎥⎥⎥⎥

⎢⎢⎢⎢

=

==∑∑= =

Page 29: Curves and Surface I

ijij

ij

p

p

c tscoefficienunknown to pointsknown therelating equations 16obtain wecase) curve in the (as points control individual for the equations theseApplying

1,,0, vu,for v)p(u, points control let the curve a of case in the As

32

31==

1,,for sexpressionsimilar obtain weLikewise,points 4by defined curve a of tscoefficien for the had weas same theis This

0001

)0,(

))( curve a(for 0 curve heConsider t

32

31

30

20

10

00

=

⎥⎥⎥⎥

⎢⎢⎢⎢

=

⎥⎥⎥⎥

⎢⎢⎢⎢

=

==

v

Cu

pppp

Muup

pMuupv

Tl

T

lT

points 16 ofmatrix theis

tscoefficienunknown for the thisSolve of inverse theof transpose theis

:obtain eequation w single ain together curves thePutting

PPMMC

MM

CMuCAuPMu

Tll

lT

l

Tl

TTTl

T

=

==−

Page 30: Curves and Surface I

points control 16 theesinterpolath patch whic surface bicubic thedefines This),(

gives surface afor equation theinto thisngSubstitutivPMMuvup T

llT=

curvesby formed surface - surface product'tensor ' a of Example[0,1])in zeros (allsmooth not are patches curves inginterpolat bicubicfor As

surface' separable' separable are functions inginterpolat - points 16for patches together blendingby formed is Surface

point for patch blending a describes Each term

),(

vandu in function blending

ofset a ofion interpolat theas surface heconsider tcan ely,Alternativ

vof each value toingcorrespondu in curves ofset a ofion interpolat theas dinterprete becan patch surface bicubic The

3

0

3

0

ijji

i jijji

Ti

p(v)(u)bb

(v)p(u)bbvup

uM(u) bl

∑∑= =

=

=

Page 31: Curves and Surface I

Hermite Curves and Surfaces

Rather than interpolating points we interpolate between endpoints + tangents at end points

- ensures continuity between curve/surface segments

3211

3210300

32)1( )0( points-end at the tangent theConstrain

)1( )0( points-end intersects Curve

:as sconstraint define Curve a of Form Hermite

cccpcp

ccccppcpp

uu ++==

+++====

c

⎥⎥⎥⎥

⎢⎢⎢⎢

=

⎥⎥⎥⎥

⎢⎢⎢⎢

=

3210001011110001

)1(p(0)p

p(1)0)(p

q

:formmatrix In

u

u

Page 32: Curves and Surface I

⎥⎥⎥⎥

⎢⎢⎢⎢

−−−

==

1122123301000001

matrix geometry' Hermite' Gives

:find toequations Solve

HH MqMc

qMuup HT=)(

:bygiven is polynomial Resulting

function blending inginterpolathan smoother t - [0,1]in szero' their of none have functions blendingfour The

232

132

)(

)()( :points on the functions blending ofset a as drepresente becan This

23

23

23

23

⎥⎥⎥⎥⎥

⎢⎢⎢⎢⎢

−+−

+−+−

==

=

uuuuuuu

uu

uMub

qubup

TH

T

Page 33: Curves and Surface I

curve continous C a givingbothfor [0,1]u with curve theofsection adjacent are q(u) and p(u) where

)0()1()0()1(

curveadjacent theof pointstart theas derivative same thehas curve one ofpoint end thesuch that -

derivates continuous with curve arepresent toused becan spolynomial Hermite

1

===

uu qpqp

This overcomes the problem with interpolating cubics where the end-points were only continuous in position

Page 34: Curves and Surface I

0100

11010100

3

0

3

0

ie points controlinput thefrom defined becan sDerivative

ion.interpolatdirect over the advantages haspatch surface Hermite Therefore,

patches.adjacent between derivative1st andposition in continous ish patch whic surface a gives Solving

)0,0()0,0()0,0()0,0( :define we(0,0)corner At

sderivative their and pointscorner 4 theeinterpolat todefined is

)()(),(

:patch surface Hermite

ppp

cpcpcpcp

qububvup

u

uvvu

ijji j

i

−=

====

=∑∑= =

Page 35: Curves and Surface I

Summary

Surface representation - explicit - implicit - parametric

parametric forms are widely used in computer graphics Parametric forms

- Interpolating curves and surfaces

Next lecture: other parametric forms of surfaces Hermite, Bezier, B-Spline, NURBS