+ All Categories
Home > Documents > Curves-Bezier-CAD

Curves-Bezier-CAD

Date post: 20-Dec-2015
Category:
Upload: venkatesh-sathya-harisyam
View: 11 times
Download: 0 times
Share this document with a friend
Description:
cad bezier curves
47
BEZIER CURVES BEZIER CURVES Dr. Regalla Srinivasa Prakash I/C, Regalla Srinivasa Prakash 1
Transcript

BEZIER CURVESBEZIER CURVES

Dr. Regalla Srinivasa Prakash

I/C, Regalla Srinivasa Prakash 1

Bezier CurvesA i t Add fl ibilit d i t iti f l i• Approximator – Adds flexibility and intuitive feel inmechanical design

• Credited to P. Bezier; P. De Casteljau also developedCredited to P. Bezier; P. De Casteljau also developedindependently

• Only control points (not necessarily only 2 per segment)f h i ifi i fform the input, no specification of tangent vectors –provides more direct relation between input (points) andoutput (curve)p ( )

• The order of the Bezier is variable (unlike HCC) anddepends on the number of control points, (n+1)

h• (n+1) number of control points define an nth degreecurve (we will term degree of curve as (k-1)

• Bezier curve can be smoother than HCC

I/C, Regalla Srinivasa Prakash 2

Bezier curve can be smoother than HCC

• The Bezier curve is defined in terms of (n+1)control points called as control pointscontrol points, called as control points

• These control points form the vertices of thecontrol or Bezier characteristic polygoncontrol or Bezier characteristic polygon

• The control or Bezier characteristic polygonuniquely defines the curveuniquely defines the curve

I/C, Regalla Srinivasa Prakash 3

• The curve shape tends to follow thepolygon shape and thus easy to guessand sketch

• Order of the control points is very essentialbecause changing the order can changebecause changing the order can changethe shape of the curve

I/C, Regalla Srinivasa Prakash 4

Bezier Curve• The user supplies (n+1) control points, Pi( ) i

• Write the curve as:

( ) ( )∑n

( ) ( ) 100

, ≤≤=∑=

uuBui

niiPP

( ) ( )1, uuin

CuB inini −⎟⎟

⎞⎜⎜⎝

⎛= −

!

tcoefficien binomial thewherei

⎞⎛

⎠⎝

( )!!!),(

inininCor

in

C−

=⎟⎟⎠

⎞⎜⎜⎝

I/C, Regalla Srinivasa Prakash 5

• The functions Bi,n are the Bernsteinpolynomials of degree (k-1)=np y g ( )

• We can write the complete form of Bezier curvewhile observing that C(n,0)=C(n,n)=1g ( , ) ( , )

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

221 +−+−+−= −− uunCuunCuu nnn21o PPPP

10)1()1,(... 1 ≤≤+−−+ −− uuuunnC nn

n1n PP

Special case 3 control pointsSpecial case, 3 control points

B(u) = P0 * ( 1 - u ) 2 + P1 * 2 * u ( 1 - u ) + P2 u2

Special case, 4 control points

B(u) = P0 * ( 1 - u )3 + P1 * 3 * u * ( 1 - u )2 + P2 * 3 * u2 * ( 1 - u ) + P3 * u3

I/C, Regalla Srinivasa Prakash 6

10)1()1(

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

221

≤≤+−−+

+−+−+−=−

−−

uuuunnC

uunCuunCuunn

nnn21o

PPPPPP

• Substitute u=0 and u=1,…?

10)1()1,(... ≤≤+−−+ − uuuunnC n1n PP

• The curve is tangent to the first and lastsegments of control polygonalsegments proof?segments…proof?

• Deriving the parametric form “r” times

( ) ( ) i

r

i

ir irCrn

nu=

−∑ −−

== PPr

0),(1

!!)0( ( )

( ) ( ) in

r

i

i

i

irCrn

nu −=

=

∑ −−

== PPr

0

0

),(1!

!)1(

I/C, Regalla Srinivasa Prakash 7

( ) irn =0!

Bezier Basis Functions for (n+1)=4Bezier Basis Functions for (n 1) 4

1.2

0.8

1

B0

0.4

0.6

B0B1B2B3

0

0.2

0

0

I/C, Regalla Srinivasa Prakash 8

Some Bezier Curves

What did you

observe?→→

I/C, Regalla Srinivasa Prakash 9

Characteristics of Bezier Curve

1) The curve interpolates the first and lastcontrol pointscontrol points.

• It passes through Po and Pn if wesubstitute u=0 and u=1

I/C, Regalla Srinivasa Prakash 10

2) The curve is tangent to the first and lastcurve segments of the control polygon.g p yg

( ) ( ) ),(1!

!)0(0

r PP=

−−−

== ∑ irCrn

nu i

r

i

ir

( )

( ) ( ) ),(1!

!)1(0

r PP −=

−−

== ∑ irCrn

nu in

r

i

i

( )

)()0(are endpoints at the sderivativefirst the1,r ngSubstituti

0

o1 PPP' −===

nu

i

)()1()()0(

1nn

o1

PPP' −−== nunu

• Can you find the second derivative at P ? What• Can you find the second derivative at P0? Whatdo you observe?

Ans: It is determined by Po, P1 and P2. In general, the rth derivative at

I/C, Regalla Srinivasa Prakash 11

y o, 1 2 g ,an endpoint is determined by its “r” neighbouring control points.

3) The curve is symmetric with respect to u and(1 )(1-u).

• That is, reversing the direction ofparametrization does not change the curveparametrization does not change the curveshape. To check this property substitute 1-u = v.

• The symmetry of the Bezier curve is due to they ysymmetry (NOT equality) of the Bernstein basis,which in turn is due to the property of thebinomial functions: C(n i) = C(n n i)binomial functions: C(n, i) = C(n, n-i)

• Which makes Bi,n(u) and Bn-i,n(u) to be symmetricwhen plotted with respect to u.when plotted with respect to u.Be careful, Bi,n(u) ≠ Bn-i,n(u), never, except atu=0.5.

I/C, Regalla Srinivasa Prakash 12

4) The polynomial Bi,n has a maximum valueof C(n,i)(i/n)i(1 – i/n)n-i occuring at u=i/n

This can be obtained by setting dB /du = 0This can be obtained by setting dBi,n/du = 0

This means that each ith control point is mostpinfluential on the shape of the curve atu=i/n, where (n+1) are the total control, ( )points.

fFor example in a cubic Bezier curve definedby Po, P1, P2 and P3, these points are mosti fl i l 0 1/3 2/3 d 1

I/C, Regalla Srinivasa Prakash 13

influential at u=0, 1/3, 2/3 and 1.

5) The shape of the curve (for a given set of controlvertices) can be changed by two methods.

By moving a control pointBy providing multiple control points at a vertex ofBy providing multiple control points at a vertex ofcontrol polygon. Multiplicity of control points makes thecurve pulled towards that point.

Multiple control

K=1K=2

K=3 points are specified hereK 1 here

I/C, Regalla Srinivasa Prakash 14

6) A closed Bezier curve can be obtained bymaking Po and Pn coincident. Will the degreeof the curve change?of the curve change?

By making thelast point co-incide with thefirst point

By adding additionalBy adding additionalcontrol point at thefirst point

I/C, Regalla Srinivasa Prakash 15

7) Partition of Unity Property:For any valid value of u, for any degree of given

curve:n

∑ =n

niB , 1∑=i 0

,

This provides forThis provides for* invariance of Bezier curve (or invariance of therelationship between the Bezier curve and its control

l ) d ffi t f tipolygon) under affine transformations.

* Method to check numerical computation and software

I/C, Regalla Srinivasa Prakash 16

pdevelopments.

8) Positivity:For any value of u, given any degree of

curve, each Bernstein polynomial satisfies

0>B 0, >niBThis ensures that the Bezier curve liesentirely in its convex hull.e e y s co e u

I/C, Regalla Srinivasa Prakash 17

The Convex Hull Property of B i CBezier Curve

• A curve is said to have convex hullproperty if it entirely lies in its convex hullproperty if it entirely lies in its convex hulldefined by its control polygon.

• The Bezier curve defined with Bernsteinpolynomial basis possesses the convexh ll thull property

I/C, Regalla Srinivasa Prakash 18

How to get the Convex Hull of a B i ?Bezier curve?

• The convex hull of a Bezier curve is theThe convex hull of a Bezier curve is themaximum area obtained by joining allcontrol points to all control points.p p

Example – 1 Example – 2Convex Hull

I/C, Regalla Srinivasa Prakash 19

p

Degree = 3

p

Degree = 3 (Hatched region)

Convex Hull

Example – 3

(Hatched region)

Degree = ?

Example – 4

Degree = ?

I/C, Regalla Srinivasa Prakash 20

Degree = ?

Consequences of Convex Hull Propertyq p yThere are three important aspects:

1) Degeneration to a straight line: useful

2) Clipping like manipulations become easy2) Clipping like manipulations become easy

3) Wild ill ti f th b t3) Wild oscillations of the curve about anycontrol point is avoided

I/C, Regalla Srinivasa Prakash 21

Repeated SlideConsequences of Convex Hull PropertyConsequences of Convex Hull Property• There are three important aspects:1) If the control polygon degenerates to a straight1) If the control polygon degenerates to a straight

line, the curve segment also should becomestraight line. This is a useful design featureg gand is assured by convex hull property.

2) Clipping like manipulations need to clip onlythe control polygon not the actual curve, thussaving in computational time.

3) Wild oscillations of the curve about any controlpoint is avoided.

I/C, Regalla Srinivasa Prakash 22

Composite Bezier Curves: Blending• For Co continuity: the last control of the first Beziery

curve segment be coincided with the first point of thesecond Bezier curve segment.

• For C1 continuity: The end slope of the first segmenty p gneed to be equal to the starting slope of the secondsegment. This requires that the (n-1)th point of the firstsegment, the joining point and the second point of thesecond segment be collinearsecond segment be collinear.

• Now:(n+1) = Number of the control points of the first segment(m+1) = Number of the control points of the second

segmentEquating the tangent vectors (a sufficient condition)g g ( )

{n(Pn – Pn-1)}first segment = {m(P1 – Po)}second segment

{(Pn – Pn-1)}first segment = (m/n){(P1 – Po)}second segment

I/C, Regalla Srinivasa Prakash 23

{( n n 1)}first segment ( ){( 1 o)}second segment

Example• If the first segment is formed by Po, P1, P2

and P3 and second segment is formed byP4, P5, P6, P7 and P8, then P2, P3(coinciding with P4) and P5 must be

fcollinear. Therefore(P3 – P2)= (4/3)(P5 – P4)3 5

PP2 P4

P7

P1

P3

4

P

P8

I/C, Regalla Srinivasa Prakash 24Po

P5 P6

Sub-Dividing Bezier Curvesde Casteljau’s Algorithmde Casteljau s Algorithm

• Step 1: Find the midpoints of the lines joining the original control vertices. Call them M01, M12, M23g 01, 12, 23

• Step 2: Find the midpoints of the lines joining M01, M12 and M12, M23. Call them M012, M123St 3 Fi d th id i t f th li j i i M• Step 3: Find the midpoint of the line joining M012, M123. Call it M0123

• The curve with control points P0, M01, M012 and p 0, 01, 012M0123 exactly follows the original curve from the point with u=0 to the point with u=0.5

• The curve with control points M M M• The curve with control points M0123 , M123 , M23and P3 exactly follows the original curve from the point with u=0.5 to the point with u=1

I/C, Regalla Srinivasa Prakash 25

Sub-Dividing Bezier CurvesSub Dividing Bezier Curves

P PM12P1 P2

M012 M123M0123

M01 M23

P0 P3

I/C, Regalla Srinivasa Prakash 26

Sub-Dividing Bezier CurvesSub Dividing Bezier Curves

P PP1 P2

P0 P3

I/C, Regalla Srinivasa Prakash 27

de Casteljau’s Algorithm• You can find the point on a Bezier curve for any

parameter value u with a similar algorithm• Say you want u=0 25 instead of taking• Say you want u=0.25, instead of taking

midpoints take points 0.25 of the way

P1P2

M12

M23

t=0.25

P

M01

I/C, Regalla Srinivasa Prakash 28

P0 P3

• Bit questionsBit questions

I/C, Regalla Srinivasa Prakash 29

• Who invented Bezier curve?• Who invented Bezier curve?

• Bézier curve is attributed and named aftera French engineer, Pierre Bézier, whoused them for the body design of theRenault car in the 1970's.

I/C, Regalla Srinivasa Prakash 30

• What are the applications of Bezier curveWhat are the applications of Bezier curve, past and present?

• They have since obtained dominance in th t tti i d t d i ti lthe typesetting industry and in particular with the Adobe Postscript and font

d tproducts.

I/C, Regalla Srinivasa Prakash 31

• If only one control point is given what willIf only one control point is given, what willbe the Bezier curve?

If there is only one control point P0, i.e., n=0,th P( ) P f llthen P(u) = P0 for all u.

I/C, Regalla Srinivasa Prakash 32

• If there are only two control points P and• If there are only two control points P0 andP1, what will be the nature of Beziercurve?curve?

i.e., n=1, then the formula reduces to a linesegment between the two control points.

)()()()( 1,11,0

1

01, +==∑ uBuBuBu

ii 10i PPPP

( ) 10)1(0

≤≤−+=+−==

uuuui

o1o1o PPPPP

I/C, Regalla Srinivasa Prakash 33

• Prove that the Bezier curve with Bernsteinpolynomials in general does not passthrough any of the control points exceptg ythe first and last.

Solution:From the formula P(0) = P and P(1) = PFrom the formula P(0) = P0 and P(1) = Pn.

I/C, Regalla Srinivasa Prakash 34

• Prove that the curve is always containedProve that the curve is always containedwithin the convex hull of the control pointsand that it never oscillates wildly awayand that it never oscillates wildly awayfrom the control points.

Solution: Positivity property.

I/C, Regalla Srinivasa Prakash 35

• How do you obtain the closed Bezier curve? What is the effect on the degree of the curve?

Solution: Closed curves can be generated by making thelast control point the same as the first control point. Firstorder continuity can be achieved by ensuring the tangentorder continuity can be achieved by ensuring the tangentbetween the first two points and the last two points arethe same.

I/C, Regalla Srinivasa Prakash 36

• What is meant by multiplicity of control points and what isthe consequence of it? Will multiple control points at a

di l i h h d f h ?coordinate location change the degree of the curve?

Solution:Adding multiple control points at a single position in space will

add more weight to that point "pulling" the Bézier curvetowards it.

I/C, Regalla Srinivasa Prakash 37

• Why it is necessary to blend multiple Bezier curve segments tomodel a part represented by a set of data points, instead of buildinga single curve?g

Solution:

As the number of control points increases it is necessary to have higherorder polynomials and possibly higher factorials. It is commontherefore to piece together small sections of Bézier curves to form alonger curve. This also helps control local conditions, normallyg p ychanging the position of one control point will affect the whole curve.Of course since the curve starts and ends at the first and last controlpoint it is easy to physically match the sections. It is also possible tomatch the first derivative since the tangent at the ends is along theg gline between the two points at the end.

I/C, Regalla Srinivasa Prakash 38

• Does Bezier curve provide C2 continuity atDoes Bezier curve provide C continuity atthe blend point?

Solution;Solution;Second order continuity is generally not

iblpossible.

I/C, Regalla Srinivasa Prakash 39

• Is it possible to build two parallel Beziercurves?curves?

Solution:Except for the redundant cases of 2 control

points (straight line), it is generally notpossible to derive a Bézier curve that isparallel to another Bézier curve. It isn'tpossible to create a Bézier curve that isparallel to another, except in the trivialcases of coincident parallel curves orstraight line Bézier curves.

I/C, Regalla Srinivasa Prakash 40

• Can a circle be exactly represented by aBezier curve?

Solution:

A circle cannot be exactly represented withBé ia Bézier curve.

I/C, Regalla Srinivasa Prakash 41

• What are the advantages of Bezier curve?Is it possible to build interpolating BezierIs it possible to build interpolating Beziercurve?

S l tiSolution:Bézier curves have wide applications

because they are easy to compute andvery stable. There are similar formulationswhich are also called Bézier curves whichbehave differently, in particular it ispossible to create a similar curve exceptthat it passes through the control points.

I/C, Regalla Srinivasa Prakash 42

How the degree of Bezier curve is decided? Is thecurve ever symmetric?

Soution:

curve ever symmetric?

Soution:The degree of the curve is

one less than the number ofone less than the number ofcontrol points, so it is aquadratic for 3 controlquadratic for 3 controlpoints. It will always besymmetric for a symmetricsymmetric for a symmetriccontrol point arrangement.

I/C, Regalla Srinivasa Prakash 43Courtesy: http://astronomy.swin.edu.au/~pbourke/curves/bezier/

What is the advantage of tangency of Bezier curve to the first and last control polygonal segments?

Th l

first and last control polygonal segments?

• The curve always passesthrough the end points andis tangent to the lineis tangent to the linebetween the last two andfirst two control pointsfirst two control points.This permits ready piecingof multiple Bézier curvesptogether with first ordercontinuity.

I/C, Regalla Srinivasa Prakash 44

What is meant by the curve “well behaving”?

• The curve always lies within the convexhull of the control points Thus the curvehull of the control points. Thus the curveis always "well behaved" and does notoscillating erraticallyoscillating erratically.

I/C, Regalla Srinivasa Prakash 45Courtesy: http://astronomy.swin.edu.au/~pbourke/curves/bezier/

What are the limitations of Bezier Curve?

Solution:• When interpolation is required, Bezier curve can

not provide that feature.• There is no local control only global control is• There is no local control, only global control is

available• When a large number of control points are to be g p

modeled by a single curve segment, Bezier curve is practically impossible because the degree of the curve has to be very high, exactly deg ee o t e cu e as to be e y g , e act yone less than the number of control points. Moreover, it will only be local control over the entire portion the curve

I/C, Regalla Srinivasa Prakash 46

entire portion the curve.

What is invariance of Bezier curve?

• Translational invariance means that translating the control points and then evaluating the curve is the same as evaluating and then t l ti thtranslating the curve

• Rotational invariance means that rotating the control points and then evaluating the curve is the same as evaluating and then rotating the curve

• These properties are essential for parametric curves used in graphics

• It is easy to prove that Bezier curves, Hermite curves and everything else we will study are translation and rotation invariant

• Some forms of curves, rational splines, are also perspective invariant– Can do perspective transform of control points and then evaluate the

curve

I/C, Regalla Srinivasa Prakash 47


Recommended