33
Computer Aided Geometric Computer Aided Geometric Design Design Ferienakademie 2004 Ferienakademie 2004 1 Bernstein Bernstein Polynomials, Bézier Polynomials, Bézier Curves, de Curves, de Casteljau‘s Algorithm Casteljau‘s Algorithm Shenqiang Wu Shenqiang Wu

1 Computer Aided Geometric Design Ferienakademie 2004 Bernstein Polynomials, Bézier Curves, de Casteljau‘s Algorithm Shenqiang Wu

Embed Size (px)

Citation preview

Page 1: 1 Computer Aided Geometric Design Ferienakademie 2004 Bernstein Polynomials, Bézier Curves, de Casteljau‘s Algorithm Shenqiang Wu

Computer Aided Geometric DesignComputer Aided Geometric Design

Ferienakademie 2004Ferienakademie 2004 1

Bernstein Polynomials, Bernstein Polynomials, Bézier Curves, de Casteljau‘s Bézier Curves, de Casteljau‘s

AlgorithmAlgorithm

Shenqiang WuShenqiang Wu

Page 2: 1 Computer Aided Geometric Design Ferienakademie 2004 Bernstein Polynomials, Bézier Curves, de Casteljau‘s Algorithm Shenqiang Wu

Computer Aided Geometric DesignComputer Aided Geometric Design

Ferienakademie 2004Ferienakademie 2004 2

ContentContent

1. Motivation1. Motivation 2. Problems of Polynom Interpolation2. Problems of Polynom Interpolation 3. Bézier Curves3. Bézier Curves 3.1 Bernstein Polynomials3.1 Bernstein Polynomials 3.2 Definition of Bézier Curves3.2 Definition of Bézier Curves 3.3 Evaluation3.3 Evaluation 4. Summary4. Summary

Page 3: 1 Computer Aided Geometric Design Ferienakademie 2004 Bernstein Polynomials, Bézier Curves, de Casteljau‘s Algorithm Shenqiang Wu

Computer Aided Geometric DesignComputer Aided Geometric Design

Ferienakademie 2004Ferienakademie 2004 3

Motivation (1/2)Motivation (1/2)

Target :Target : better control over the curve’s shapebetter control over the curve’s shape

Background:Background: Computer-supported automobile and aircraft designComputer-supported automobile and aircraft design

BBéézierzier (Renault) and (Renault) and de Casteljaude Casteljau (Citröen) both developed independent (Citröen) both developed independent from each other around 1960/65 descriptions of curves with the from each other around 1960/65 descriptions of curves with the following attributes:following attributes:

Substitutes of pattern drawings by CADSubstitutes of pattern drawings by CAD Flexible manipulation of curves with guaranteed and controllable shape Flexible manipulation of curves with guaranteed and controllable shape

of the resulting curveof the resulting curve Introduction of control points that not necessarily lie itself on the curveIntroduction of control points that not necessarily lie itself on the curve

Page 4: 1 Computer Aided Geometric Design Ferienakademie 2004 Bernstein Polynomials, Bézier Curves, de Casteljau‘s Algorithm Shenqiang Wu

Computer Aided Geometric DesignComputer Aided Geometric Design

Ferienakademie 2004Ferienakademie 2004 4

Motivation (2/2)Motivation (2/2)

Typical applications are:Typical applications are: Car design, aircraft design, and ship designCar design, aircraft design, and ship design Simulation of movementsSimulation of movements Animations, movie industry and computer graphicsAnimations, movie industry and computer graphics

Modelling of objects with free-form-surfaces

Page 5: 1 Computer Aided Geometric Design Ferienakademie 2004 Bernstein Polynomials, Bézier Curves, de Casteljau‘s Algorithm Shenqiang Wu

Computer Aided Geometric DesignComputer Aided Geometric Design

Ferienakademie 2004Ferienakademie 2004 5

Problems of Polynom Interpolation (1/2)Problems of Polynom Interpolation (1/2)

Polynom interpolation is an easy and unique method for describing curves Polynom interpolation is an easy and unique method for describing curves that also contain some „nice“ geometrical attributes.that also contain some „nice“ geometrical attributes.

Polynom interpolation is not the method of choice within CAD applications Polynom interpolation is not the method of choice within CAD applications due to better curve descriptions (as we will see later).due to better curve descriptions (as we will see later).

Reason: Reason: polynom interpolation may oscillatepolynom interpolation may oscillate

Page 6: 1 Computer Aided Geometric Design Ferienakademie 2004 Bernstein Polynomials, Bézier Curves, de Casteljau‘s Algorithm Shenqiang Wu

Computer Aided Geometric DesignComputer Aided Geometric Design

Ferienakademie 2004Ferienakademie 2004 6

Problems of Polynom Interpolation (2/2)Problems of Polynom Interpolation (2/2)

Problems:Problems:

The polynomial interpolant may oscillate even when The polynomial interpolant may oscillate even when normalnormal data data points and paramter values are used.points and paramter values are used.

The polynomial interpolant is not shape preserving. This has nothing The polynomial interpolant is not shape preserving. This has nothing to do with numerical effects, it‘s due to the interpolation process.to do with numerical effects, it‘s due to the interpolation process.

Too high costs for interpolation process: huge amount of necessary Too high costs for interpolation process: huge amount of necessary operations for constructing and evaluating the interpolant.operations for constructing and evaluating the interpolant.

Page 7: 1 Computer Aided Geometric Design Ferienakademie 2004 Bernstein Polynomials, Bézier Curves, de Casteljau‘s Algorithm Shenqiang Wu

Computer Aided Geometric DesignComputer Aided Geometric Design

Ferienakademie 2004Ferienakademie 2004 7

Bernstein Polynomials (1/2)Bernstein Polynomials (1/2)

Preliminaries: Preliminaries: Bernstein polynomialsBernstein polynomials

Def.:Def.: A Bernstein polynomial of grade n has the following description A Bernstein polynomial of grade n has the following description

Method of approximation:Method of approximation: Bézier polynomialsBézier polynomials

nittti

ntB iinn

i ,...,0 ,1,0mit )1()(

with binomial coefficients

0

0 )!!*(/!

otherwise

niwheninin

i

n

Page 8: 1 Computer Aided Geometric Design Ferienakademie 2004 Bernstein Polynomials, Bézier Curves, de Casteljau‘s Algorithm Shenqiang Wu

Computer Aided Geometric DesignComputer Aided Geometric Design

Ferienakademie 2004Ferienakademie 2004 8

Bernstein Polynomials (2/2)Bernstein Polynomials (2/2)

Attributes of Bernstein polynomials:Attributes of Bernstein polynomials:

i-times null in t=0, (n-i)-times null in t=1i-times null in t=0, (n-i)-times null in t=1

n

i

n

i

ni

iin

n

tBtti

n

tt

0 0)(1

11

1) der (PartiontBn

i

ni 0,1t 1)(

0

Proof:

)( )1()( SymmetrietBtB nin

ni

)(RekursiontBttBttB ini

ni

ni )()1()()( 1

1

1,0,0, 1,0)( tnintBni

Page 9: 1 Computer Aided Geometric Design Ferienakademie 2004 Bernstein Polynomials, Bézier Curves, de Casteljau‘s Algorithm Shenqiang Wu

Computer Aided Geometric DesignComputer Aided Geometric Design

Ferienakademie 2004Ferienakademie 2004 9

Basis functions of Bernstein PolynomialsBasis functions of Bernstein Polynomials

Bernstein-Polynome vom Grad 4

Page 10: 1 Computer Aided Geometric Design Ferienakademie 2004 Bernstein Polynomials, Bézier Curves, de Casteljau‘s Algorithm Shenqiang Wu

Computer Aided Geometric DesignComputer Aided Geometric Design

Ferienakademie 2004Ferienakademie 2004 10

Bézier Curves (1/2) Bézier Curves (1/2)

Def.:Def.: The following curve The following curve

is called is called Bézier curve Bézier curve of grade nof grade n

with control points bwith control points b00,…,b,…,bnn

ni

ni

n

ii RbttBbtX

and 1,0for )(:)(0

bb11

bb22

bb33

bb44

Bézier curveBézier curve

Control polygonControl polygon

33

22

21

30 )1(3)1(3)1()( tbttbttbtbtX

The complete form of a Bézier The complete form of a Bézier polynomial of grade 3, for example, with polynomial of grade 3, for example, with control points control points bb00,…,b,…,bn n looks as follows:looks as follows:

Page 11: 1 Computer Aided Geometric Design Ferienakademie 2004 Bernstein Polynomials, Bézier Curves, de Casteljau‘s Algorithm Shenqiang Wu

Computer Aided Geometric DesignComputer Aided Geometric Design

Ferienakademie 2004Ferienakademie 2004 11

Bézier Curves (2/2)Bézier Curves (2/2)

Different Bézier Curves with its control polygons

Page 12: 1 Computer Aided Geometric Design Ferienakademie 2004 Bernstein Polynomials, Bézier Curves, de Casteljau‘s Algorithm Shenqiang Wu

Computer Aided Geometric DesignComputer Aided Geometric Design

Ferienakademie 2004Ferienakademie 2004 12

Attributes of Bézier Curves (1/9)Attributes of Bézier Curves (1/9)

Attributes of Bézier curves:Attributes of Bézier curves:

x(0)=bx(0)=b00 and x(1)=b and x(1)=bnn, that means the Bézier curve , that means the Bézier curve lies on blies on b00 and b and bnn. .

Values x(t) are a convex combination of the control pointsValues x(t) are a convex combination of the control points

The Bézier curve entirely lies in its control polyeder or The Bézier curve entirely lies in its control polyeder or control polygoncontrol polygon

x‘(0)=n(bx‘(0)=n(b11-b-b00) and x‘(1)=n(b) and x‘(1)=n(bnn-b-bn-1n-1) (tangents in ) (tangents in start and end point)start and end point)

Page 13: 1 Computer Aided Geometric Design Ferienakademie 2004 Bernstein Polynomials, Bézier Curves, de Casteljau‘s Algorithm Shenqiang Wu

Computer Aided Geometric DesignComputer Aided Geometric Design

Ferienakademie 2004Ferienakademie 2004 13

Attributes of Bézier curves (2/9)Attributes of Bézier curves (2/9)

Bézier curves are invariant under projectionsBézier curves are invariant under projections

Bézier curves are symmetric within their control pointsBézier curves are symmetric within their control points

Are all Bézier points collinear the Bézier curve becomes a Are all Bézier points collinear the Bézier curve becomes a lineline

Bézier curves are shape preserving: non negative Bézier curves are shape preserving: non negative (monoton, convex…) data leads to a non negative (monoton, convex…) data leads to a non negative (monoton, convex…) curve(monoton, convex…) curve

Page 14: 1 Computer Aided Geometric Design Ferienakademie 2004 Bernstein Polynomials, Bézier Curves, de Casteljau‘s Algorithm Shenqiang Wu

Computer Aided Geometric DesignComputer Aided Geometric Design

Ferienakademie 2004Ferienakademie 2004 14

Attributes of Bézier Curves (3/9)Attributes of Bézier Curves (3/9)

Endpoint interpolation and attributes of tangents:Endpoint interpolation and attributes of tangents:

A Bézier curve interpolates the first and the last point of its A Bézier curve interpolates the first and the last point of its control polygon and has the first and last line element of its control polygon and has the first and last line element of its control polygon as tangent.control polygon as tangent.

control polygon

line elementline element

Bézier curve

b0

bn

Page 15: 1 Computer Aided Geometric Design Ferienakademie 2004 Bernstein Polynomials, Bézier Curves, de Casteljau‘s Algorithm Shenqiang Wu

Computer Aided Geometric DesignComputer Aided Geometric Design

Ferienakademie 2004Ferienakademie 2004 15

Attributes of Bézier Curves (4/9)Attributes of Bézier Curves (4/9)

Convex hull property:

A Bézier curve lies within the convex hull of its control polygon.

Page 16: 1 Computer Aided Geometric Design Ferienakademie 2004 Bernstein Polynomials, Bézier Curves, de Casteljau‘s Algorithm Shenqiang Wu

Computer Aided Geometric DesignComputer Aided Geometric Design

Ferienakademie 2004Ferienakademie 2004 16

Attributes of Bézier Curves (5/9)Attributes of Bézier Curves (5/9)

Variation diminishing property:

Given: Bézier curve, any kind of line or plane

A Bézier curve doesn’t change the sides of any line or plane not more often as its control polygon.

1

3

2

1

Sample lines1

3

2

1

3

2

Page 17: 1 Computer Aided Geometric Design Ferienakademie 2004 Bernstein Polynomials, Bézier Curves, de Casteljau‘s Algorithm Shenqiang Wu

Computer Aided Geometric DesignComputer Aided Geometric Design

Ferienakademie 2004Ferienakademie 2004 17

Attributes of Bézier Curves (6/9)Attributes of Bézier Curves (6/9)

Linear precision:

Are the control points b0,...,bn of a Bézier curve collinear the Bézier curve itself becomes a line.

Control polygon

Bézier curve

b0

bn

Page 18: 1 Computer Aided Geometric Design Ferienakademie 2004 Bernstein Polynomials, Bézier Curves, de Casteljau‘s Algorithm Shenqiang Wu

Computer Aided Geometric DesignComputer Aided Geometric Design

Ferienakademie 2004Ferienakademie 2004 18

c1

c2 c3

c0

Attributes of Bézier Curves (7/9)Attributes of Bézier Curves (7/9)

Subdivision:

Given is a Bézier curve with its control polygon (b0,...,bn) resp. [0,1].

Sometimes it’s necessary to cut a single Bézier curve into two parts, both together being identically to the originating curve.

1. The subdivision algorithm from de Casteljau leads to the control polygons (c0,...,cn) and (d0,...,dn) of the Bézier curves within the intervals [0,t] and [t,1], resp.

b0

b1

b2

b3

Example: n=3

d2

d1d0

d3

Page 19: 1 Computer Aided Geometric Design Ferienakademie 2004 Bernstein Polynomials, Bézier Curves, de Casteljau‘s Algorithm Shenqiang Wu

Computer Aided Geometric DesignComputer Aided Geometric Design

Ferienakademie 2004Ferienakademie 2004 19

Attributes of Bézier Curves (8/9)Attributes of Bézier Curves (8/9)

b0

b1

b2

b3

Subdivision:

Given is a Bézier curve with its control polygon (b0,...,bn)

2. Successively subdivision with de Casteljau’s algorithm leads to a series of polygons fast converging to the curve.

Page 20: 1 Computer Aided Geometric Design Ferienakademie 2004 Bernstein Polynomials, Bézier Curves, de Casteljau‘s Algorithm Shenqiang Wu

Computer Aided Geometric DesignComputer Aided Geometric Design

Ferienakademie 2004Ferienakademie 2004 20

Attributes of Bézier Curves (9/9)Attributes of Bézier Curves (9/9)

b0

b1

b2

b3

Subdivision:

Given is a Bézier curve with its control polygon (b0,...,bn)

3. Cutting off edges doesn’t lead to further changes of sides.

Variation diminishing property

Page 21: 1 Computer Aided Geometric Design Ferienakademie 2004 Bernstein Polynomials, Bézier Curves, de Casteljau‘s Algorithm Shenqiang Wu

Computer Aided Geometric DesignComputer Aided Geometric Design

Ferienakademie 2004Ferienakademie 2004 21

Increase of Grade of Bézier curves (1/2)Increase of Grade of Bézier curves (1/2)

Problem: After a Bézier polygon has been modified several times, it can be seen that the curve of grade n is not flexible enough to represent the desired shape.

Idea: Add one edge without changing the current shape of the curve.

Solution: Increase the grade of the Bézier curve from n to n+1, thus, the new Bézier points Bk can be determined from the old Bézier points bi as follows:

.10 where1

11 1

nkb

n

kb

n

kB kkk

Page 22: 1 Computer Aided Geometric Design Ferienakademie 2004 Bernstein Polynomials, Bézier Curves, de Casteljau‘s Algorithm Shenqiang Wu

Computer Aided Geometric DesignComputer Aided Geometric Design

Ferienakademie 2004Ferienakademie 2004 22

Increase of Grade of Bézier Curves (2/2)Increase of Grade of Bézier Curves (2/2)

Application:Application: Design of surfacesDesign of surfaces Data exchange between different CAD and graphic systemsData exchange between different CAD and graphic systems

Increase of grade: both polygons describe the same (cubic) curveIncrease of grade: both polygons describe the same (cubic) curve

Page 23: 1 Computer Aided Geometric Design Ferienakademie 2004 Bernstein Polynomials, Bézier Curves, de Casteljau‘s Algorithm Shenqiang Wu

Computer Aided Geometric DesignComputer Aided Geometric Design

Ferienakademie 2004Ferienakademie 2004 23

Evaluation of Bézier CurvesEvaluation of Bézier Curves

Method for determination of single curve points, Method for determination of single curve points, i.e. determination of x(t) for some t:i.e. determination of x(t) for some t:

de Casteljau‘s algorithmde Casteljau‘s algorithm

Recursive calculation of Bernstein polynomialsRecursive calculation of Bernstein polynomials

Page 24: 1 Computer Aided Geometric Design Ferienakademie 2004 Bernstein Polynomials, Bézier Curves, de Casteljau‘s Algorithm Shenqiang Wu

Computer Aided Geometric DesignComputer Aided Geometric Design

Ferienakademie 2004Ferienakademie 2004 24

Recursive Calculation Recursive Calculation

otherwise 0

0i when 1 : )(

)()()1( : )(

0

11

tB

tBttBttB

i

ri

ri

ri

Recursive calculation of Bernstein polynomialsRecursive calculation of Bernstein polynomials

According to this definition According to this definition Bézier curves are calculated Bézier curves are calculated with the help of Bernstein with the help of Bernstein polynomials.polynomials.

Example of a cubic Bézier curveExample of a cubic Bézier curve

Page 25: 1 Computer Aided Geometric Design Ferienakademie 2004 Bernstein Polynomials, Bézier Curves, de Casteljau‘s Algorithm Shenqiang Wu

Computer Aided Geometric DesignComputer Aided Geometric Design

Ferienakademie 2004Ferienakademie 2004 25

de Casteljau‘s Algorithm (1/2)de Casteljau‘s Algorithm (1/2)

Geometric construction according to de Casteljau‘s algorithm for n=3 and t=2/3

b0

b1 b2

b3

b01

b11

b21

b02

b12

b03

0 1t

Page 26: 1 Computer Aided Geometric Design Ferienakademie 2004 Bernstein Polynomials, Bézier Curves, de Casteljau‘s Algorithm Shenqiang Wu

Computer Aided Geometric DesignComputer Aided Geometric Design

Ferienakademie 2004Ferienakademie 2004 26

de Casteljau‘s Algorithm (2/2)de Casteljau‘s Algorithm (2/2)

de Casteljau‘s algorithmde Casteljau‘s algorithm

i=0,…,n:i=0,…,n: It can be described with theIt can be described with the

following scheme: following scheme:

k=1,…,n:k=1,…,n:

i=k,…,n:i=k,…,n:

This leads toThis leads to

ii bb :0

111)1(:

ki

ki

ki btbtb

nnbtx )( n

nnnnnnn

nnnnnn

bbbbbb

bbbbb

bbbb

bbb

bb

...........

..........

1210

11

21

11

011

22

12

022

11

011

000

Page 27: 1 Computer Aided Geometric Design Ferienakademie 2004 Bernstein Polynomials, Bézier Curves, de Casteljau‘s Algorithm Shenqiang Wu

Computer Aided Geometric DesignComputer Aided Geometric Design

Ferienakademie 2004Ferienakademie 2004 27

Example: De Casteljau‘s Algorithm (1/2)Example: De Casteljau‘s Algorithm (1/2)

Given: Bézier curve of grade 4Given: Bézier curve of grade 4

With Bézier pointsWith Bézier points

WantedWanted

forfor

44

33

222

31

40

t×b + t×) t - (1×4b + t×) t - (1×6b

+t ×) t - (1×4b + ) t - (1×b = X(t)

0.5). (7.5,b , 5.5) (6,b , 5.5) (1,b , (0,2)b , (1,0)b 43210

)X(t0 0.6 t0

Page 28: 1 Computer Aided Geometric Design Ferienakademie 2004 Bernstein Polynomials, Bézier Curves, de Casteljau‘s Algorithm Shenqiang Wu

Computer Aided Geometric DesignComputer Aided Geometric Design

Ferienakademie 2004Ferienakademie 2004 28

Example: de Casteljau‘s Algorithm (2/2)Example: de Casteljau‘s Algorithm (2/2)

de Casteljau scheme for the de Casteljau scheme for the

x-componentx-component

11

0 0.40 0.4

1 0.6 0.521 0.6 0.52

6 4.0 2.64 1.86 4.0 2.64 1.8

7.5 6.9 5.74 4.5 7.5 6.9 5.74 4.5 3.42 = x(t=0.6)3.42 = x(t=0.6)

de Casteljau scheme for thede Casteljau scheme for the

y-componenty-component

00

2 1.22 1.2

5.5 4.1 2.95.5 4.1 2.9

5.5 5.5 4.9 4.145.5 5.5 4.9 4.14

0.5 6.7 3.6 4.9 0.5 6.7 3.6 4.9 4.174 = 4.174 = y(t=0.6)y(t=0.6)

Resultat: X(t=0.6)=(x,y)=(3.42,4.174)Resultat: X(t=0.6)=(x,y)=(3.42,4.174)

Page 29: 1 Computer Aided Geometric Design Ferienakademie 2004 Bernstein Polynomials, Bézier Curves, de Casteljau‘s Algorithm Shenqiang Wu

Computer Aided Geometric DesignComputer Aided Geometric Design

Ferienakademie 2004Ferienakademie 2004 29

Rating of Bézier Curves (1/2)Rating of Bézier Curves (1/2)

Rating of Bézier curves according to Rating of Bézier curves according to controlabilitycontrolability and and localitylocality::

iniiii etBtxtxebb )()()(

Local changes of control points have Local changes of control points have globalglobal effects, but their effects, but their influence is only of local interest:influence is only of local interest:

The change is only significant within the scope of the The change is only significant within the scope of the control point .control point .

ini etB )(

ib

Page 30: 1 Computer Aided Geometric Design Ferienakademie 2004 Bernstein Polynomials, Bézier Curves, de Casteljau‘s Algorithm Shenqiang Wu

Computer Aided Geometric DesignComputer Aided Geometric Design

Ferienakademie 2004Ferienakademie 2004 30

Rating of Bézier Curves (2/2)Rating of Bézier Curves (2/2)

Complex shapes of the desired curves may result in a Complex shapes of the desired curves may result in a huge amount of control points that again leads to a huge amount of control points that again leads to a high ploynom gradehigh ploynom grade..

Problems:Problems: Double pointsDouble points are are

possible, i.e. the projectionpossible, i.e. the projectionis not bijetiveis not bijetive)(txt

Page 31: 1 Computer Aided Geometric Design Ferienakademie 2004 Bernstein Polynomials, Bézier Curves, de Casteljau‘s Algorithm Shenqiang Wu

Computer Aided Geometric DesignComputer Aided Geometric Design

Ferienakademie 2004Ferienakademie 2004 31

Further Freeform CurvesFurther Freeform Curves

B-SplinesB-Splines NURBSNURBS

Page 32: 1 Computer Aided Geometric Design Ferienakademie 2004 Bernstein Polynomials, Bézier Curves, de Casteljau‘s Algorithm Shenqiang Wu

Computer Aided Geometric DesignComputer Aided Geometric Design

Ferienakademie 2004Ferienakademie 2004 32

Freeform SurfacesFreeform Surfaces

Bézier surfaceBézier surface

Page 33: 1 Computer Aided Geometric Design Ferienakademie 2004 Bernstein Polynomials, Bézier Curves, de Casteljau‘s Algorithm Shenqiang Wu