55
Bezier Curves, B-Splines, NURBS

10. Bezier Curves, B-Splines & NURBS

Embed Size (px)

Citation preview

Page 1: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 1/55

Bezier Curves, B-Splines, NURBS

Page 2: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 2/55

Example Application:

Font Design an Displa!● Curved objects are

everywhere●

There is always need for: – mathematical fidelity

 – high precision

 – artistic freedom andflexibility

 – physical realism

Page 3: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 3/55

Example Application:

"rap#ic Design an Arts

Page 4: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 4/55

Example Application:$ool %at# "eneration an

&otion %lanning

Page 5: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 5/55

Functional Representations

● Explicit Functions: – representing one variable with another 

 –

fine if only one x value for each y value – Problem: what if I have a sphere?

● Multiple values ! "not used in graphics#

 

 z =   r 2− x

2− y

2

Page 6: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 6/55

Functional Representations

● Implicit Functions: – curves$surfaces represented as %the &eros'

 –

good for rep! of n-1() objects in n() space – *phere example:

 – +hat class of function?● polynomial : linear combo of integer powers of  x,y,z ●

algebraic curves & surfaces: rep,d by implicit polynomialfunctions

● polynomial degree: total sum of powers-i!e! polynomial of degree .:

02222 =−++   r  z  y x

02222

=−++   r  z  y x

Page 7: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 7/55

Page 8: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 8/55

Functional Representations

● +hich is best?? – It depends on the application –

Implicit is good for ● computing ray$surface intersection● point inclusion "inside$outside test#● mass 3 volume properties

 – Parametric is good for ● subdivision- faceting for rendering● *urface 3 area properties● popular in graphics

Page 9: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 9/55

'ssues in Speci(!ing)Designing

Curves)Sur(aces● 2ote: the internal mathematical representation

can be very complex –

high degree polynomials – hard to see how parameters relate to shape

● 4ow do we deal with this complexity? – 5se curve control points and either 

● Interpolate● 6pproximate

Page 10: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 10/55

%oints to Curves

● The Lagrangian interpolating polynomial 

 –    n+1 points- the uni7ue polynomial of degree n

 – curve wiggles thru each control point

 – Issue: not good if you want smooth or flat curves

●  Approximation of control points – points are weights that tug on the curve or surface

Page 11: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 11/55

%arametric Curves

● 8eneral rep:

Properties: – individual functions are single(valued – approximations are done with

piecewise poly curves – 1ach segment is given by three cubic

polynomials "x-y-&# in parameter t – Concise representation

Page 12: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 12/55

Cu*ic %arametric Curves

● 9alance between – Complexity

 –

Control – +iggles

 –  6mount of computation

 – 2on(planar 

Page 13: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 13/55

%arametric Curves

● Cubic Polynomialsthat define aparametric curve

segment

are of the form

2otice we restrict theparameter t  to be

Page 14: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 14/55

%arametric Curves

● If coefficients arerepresented as a matrix

and

then:

Page 15: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 15/55

•   Q(t) can be defined with four constraints – ewrite the coefficient matrix C  as

where  M  is a ;x; basis matrix - and G  is a four(element constraintmatrix "geometry matrix #

● 1xpanding gives:

 

Q(t) is a weighted sum of the columns of thegeometry matrix- each of which represents a pointor vector in 0(space

%arametric Curves

Page 16: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 16/55

%arametric Curves

● Multiplying out gives

"i!e! just weighted sums of the elements#● The weights are cubic polynomials in t  "called

the blending functions-  B=MT #

•  M  and G matrices vary by curve – 4ermite- 9<&ier- spline- etc!

Page 17: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 17/55

+arning, +arning, +arning: 

%ening Notation A*use● t  and u are used interchangeably as a

parameteri&ation variable for functions● +hy?

 – t  historically is %time'- certain parametric functions candescribe %change over time' "e!g! motion of a camera-physics models#

 – u comes from the 0) world- i!e! where two variablesdescribe a 9(spline surface

● u and v  are the variables for defining a surface

● Choice of t or u depends on the text$reference

Page 18: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 18/55

Continuit!

Two types:● 8eometric Continuity- Gi:

 – endpoints meet

 – tangent vectors, directions are e7ual

● Parametric Continuity- C i: – endpoints meet

 – tangent vectors, directions are e7ual

 – tangent vectors, magnitudes are e7ual

● In general: C  implies G but not vice versa

Page 19: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 19/55

%arametric Continuit!

● Continuity  "recall from the calculus#: – Two curves are C i continuous at a point  p iff the

i-th derivatives of the curves are e7ual at  p

Page 20: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 20/55

Continuit!

● The derivative of is the parametric tangentvector of the curve:

Page 21: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 21/55

Continuit!

● +hat are the conditions for C 0 and C 1 continuity atthe joint of curves  xl  and  xr ? – tangent vectors at end points e7ual

 – end points e7ual

 xl   xr 

Page 22: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 22/55

Continuit!

● In 0)- compute this for each component of theparametric function – =or the x component:

● *imilar for the y  and z  components!

 xl   xr 

Page 23: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 23/55

Convex ulls

● The smallest convexcontainer of a set ofpoints

● 9oth practically andtheoretically useful ina number ofapplications

Page 24: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 24/55

Some $!pes o( Curves

● 4ermite – def,d by two end points

and two tangent

vectors● Bzier 

 – two end points plustwo control points forthe tangent vectors

● Splines – 9asis *plines

 – def,d w$ ; control points

 – 5niform- nonrational B-splines 

 – 2onuniform- nonrational 9(splines

 – 2onuniform- rational B-splines  NURBS  !

Page 25: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 25/55

Bzier Curves

● Pierre 9<&ier ><nault @A.B

● 9asic idea – four points

 – *tart point P  

 – 1nd point P !

 – Tangent at P  - P  P "

 – Tangent at P !- P ! P # 

Page 26: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 26/55

Bzier Curves

 6n 1xample:● $eometry matrix  is

where  P i  are controlpoints for the curve

● Basis %atrix  is

convex hull

Page 27: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 27/55

Bzier Curves

● The general representation of a9<&ier curve is

whereG  B ( 9<&ier 8eometry Matrix

 M  B ( 9<&ier 9asis Matrix

which is "multiplying out#:

convex hull

Page 28: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 28/55

Bernstein %ol!nomials

● The general form for the i-th 9ernstein polynomialfor a degree "  9<&ier curve is

● *ome properties of 9Ps – Invariant under transformations

 – =orm a partition of unity - i!e! summing to @

 –

ow degree 9Ps can be written as high degree 9Ps – 9P derivatives are linear combo of 9Ps

 – =orm a basis for space of polynomials w$ degD" 

Page 29: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 29/55

"eneral Bezier Curve

∑=

=n

i

ini   t  B pt  s0

,   )()(

ini

in   t t i

nt  B   −−  

  

=   )1()(,9ernsteinbasis

The Euadratic and Cubic Curves of Fava /)are 9e&ier Curves with nG/ and nG0

The pi are the control points

Page 30: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 30/55

Bernstein %ol!nomials

● =or those that forget combinatorics

iik ik    uu

ik ik ub   −−−=   )1(

)!(!!)(

Page 31: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 31/55

.oining Bzier Segments:

$#e Bernstein %ol!nomials● Hbserve

The =our Bernstein polynomials – also defined by

These represent the blending proportionsamong the control points

Page 32: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 32/55

.oining Bzier Segments:

$#e Bernstein %ol!nomials● The four cubic Bernstein

 polynomials

● Hbserve: – at tGB- only BB" is B

● curve interpolates P@

 – at tG@- only BB& is B● curve interpolates P;

Page 33: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 33/55

.oining Bzier Segments:

$#e Bernstein %ol!nomials● Cubic 9ernstein

blending functions

● Hbserve: thecoefficients are justrows in Pascal,striangle

Page 34: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 34/55

Page 35: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 35/55

Page 36: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 36/55

Bezier Curves, B-Splines,NURBS

Page 37: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 37/55

Some $!pes o( Curves

● 4ermite – def,d by two end points

and two tangent

vectors● Bzier 

 – two end points plustwo control points forthe tangent vectors

● Splines – 9asis *plines

 – def,d w$ ; control points

 – 5niform- nonrational B-splines 

 – 2onuniform- nonrational 9(splines

 – 2onuniform- rational 

B-splines  NURBS  !

Page 38: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 38/55

Bzier Curves

● Pierre 9<&ier ><nault @A.B

● 9asic idea

 – four points – *tart point P  

 – 1nd point P !

 – Tangent at P  - P  P "

 – Tangent at P !- P ! P # 

Page 39: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 39/55

Page 40: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 40/55

Page 41: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 41/55

B-Spline Curve

∑=

=n

i

ik i   t  N  pt  p0

,   )()(

)()()(

otherwise,0),[,1)(

1,1

11

1,1,

1,0

t  N t t 

t t t  N 

t t 

t t t  N 

t t t t  N 

ik 

ik i

k iik 

ik i

iik 

iii

+−

+++

++−

+

+

−+

−=

  ∈=2ormali&ed 9(

spline blendingfunctions

nJ@ control points and nJKJ/ parameters Known as Knots

)efined only on Lt0- t

nJK(/#

Page 42: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 42/55

Page 43: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 43/55

B-splines: Basic 'eas

● *imilar to 9<&ier curves – *mooth blending function times control points

9ut: – 9lending functions are non(&ero over only a smallpart of the parameter range"giving us local support #

 – +hen non&ero- they are the %concatenation' ofsmooth polynomials

Page 44: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 44/55

B-spline Blening Functions

● is a step function that is @ in theinterval

● spans two intervals and is apiecewise linear function that goesfrom B to @ "and bacK#

● spans three intervals and is apiecewise 7uadratic that grows from Bto @$;- then up to 0$; in the middle ofthe second interval- bacK to @$;- andbacK to B

● is a cubic that spans four intervals

growing from B to @$. to /$0- thenbacK to @$. and to B

9(spline blending functions

)(0,   t  Bk 

 Bk  ,1

 ( t  )

)(2,   t  Bk 

)(3,   t  Bk 

B li Bl i F ti

Page 45: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 45/55

B-spline Blening Functions:Example (or 0n 1rer Splines

● 2ote: can,t define apolynomial with theseproperties "both B and non(

&ero for ranges#● Idea: subdivide theparameter space intointervals and build a piecewise polynomial   – 1ach interval gets different

polynomial function

B li Bl i F ti

Page 46: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 46/55

B-spline Blening Functions:Example (or 2 1rer Splines

● Hbserve: – at tGB and tG@ just

three of the functionsare non(&ero

 – all are GB and sum to@- hence the convexhull property holds foreach curve segment ofa9(spline

@AA; =oley$an)am$=iner$4uges$Phillips IC8

Page 47: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 47/55

B-splines: Setting t#e 1ptions

● *pecified by –  

 – m1 control points- ' ( ) ' m

 – m-*  cubic polynomial curve segments- +,)+m

 – m-1 'not points- t   t m1

 – segments +i  of the 9(spline curve are● defined over a Knot interval

defined by ; of the control points- ' i-, ) ' i 

 – segments +i  of the 9(spline curve are blended together into

smooth transitions via"the new 3 improved# blending functions

],[ 1+ii   t t 

3≥m

E l C ti B li

Page 48: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 48/55

Example: Creating a B-splineCurve Segment

ii

  t t   1−

 P i

Qi

Page 49: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 49/55

B-splines: 3not Selection

● Instead of worKing with the parameterspace - use

● The 'not points –  joint points between

curve segments- +i 

 – 1ach has a"not value

 – m-1 Knots form1 points

10   ≤≤   t    max1210min   ...   t t t t t t  m   ≤≤≤≤≤   −

@AA; =oley$an)am$=iner$4uges$Phillips IC8

Page 50: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 50/55

B-spline: 3not Se4uences

● 1ven distribution of Knots – uniform 9(splines

 – Curve does not interpolate end points● first blending function not e7ual to @ at tGB

● 5neven distribution of Knots – non-uniform 9(splines

 –  6llows us to tie down the endpoints by repeating Knot values"in Cox(de9oor- B$BG@#

 – If a Knot value is repeated- it increases the effect "weight# of the

blending function at that point – If Knot is repeated d  times- blending function converges to @ and the

curve interpolates the control point

Creating a Non Uni(orm

Page 51: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 51/55

Creating a Non-Uni(ormB-spline: 3not Selection

● 8iven curve of degree d.,- with m1 controlpoints – first- create m-1*d-1! Knot points

 –

use Knot values (/(/(/1/*/)/ m-*/ m-1/m-1/m-1!  "adding two extra ( ,s and m-1,s#

 – 2ote● Causes Cox(de9oor to give

added weight in blending to the

first and last points when t isnear t min and t max 

Pics$Math courtesy of 8! =arin > 6*5

+atc#ing E((ects

Page 52: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 52/55

+atc#ing E((ectso( 3not Selection

● N Knot points "initially# – 2ote: Knots are distributed

parametrically based on t -hence why they %move'

● @B control points● Curves have as many

segments as they have non(&ero intervals in u

degree ofcurve

Page 53: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 53/55

B-splines: 5ocal Control %ropert!

● ocal Control – polynomial coefficients

depend on a few points

 –

moving control point "' #affects only local curve

 – +hy: 9ased on curve def,n-affected region extends atmost @ Knot point away

Page 54: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 54/55

Page 55: 10. Bezier Curves, B-Splines & NURBS

8/11/2019 10. Bezier Curves, B-Splines & NURBS

http://slidepdf.com/reader/full/10-bezier-curves-b-splines-nurbs 55/55

B-splines: Setting t#e 1ptions

● 4ow to space the "not points0

 O Uni(orm● e7ual spacing of Knots along the curve

 O Non-Uni(orm

● +hich type of parametric function?

 O Rational●

 x(t)* y(t)* +(t) defined as ratio of cubic polynomials O Non-Rational