march 1, 2009dr. muhammed al-mulhem1 ics 415 computer graphics bézier splines (chapter 8) dr....

Post on 17-Dec-2015

221 Views

Category:

Documents

1 Downloads

Preview:

Click to see full reader

TRANSCRIPT

March 1, 2009 Dr. Muhammed Al-Mulhem 1

ICS 415Computer Graphics

Bézier Splines (Chapter 8)

Dr. Muhammed Al-MulhemDr. Muhammed Al-Mulhem

March 1, 2009March 1, 2009

Dr. Muhammed Al-MulhemDr. Muhammed Al-Mulhem

March 1, 2009March 1, 2009

March 1, 2009 Dr. Muhammed Al-Mulhem 2

Bézier Curves• This spline approximation method was developed by the

French engineer Pierre Bezier for use in the design of Renault car bodies.

• Bezier curve section can be fitted to any number of control points.

• The degree of the Bezier polynomial is determined by the number of control points to be approximated and their relative position.

• In general, Bezier curve can be specified using blending functions.

• This spline approximation method was developed by the French engineer Pierre Bezier for use in the design of Renault car bodies.

• Bezier curve section can be fitted to any number of control points.

• The degree of the Bezier polynomial is determined by the number of control points to be approximated and their relative position.

• In general, Bezier curve can be specified using blending functions.

March 1, 2009 Dr. Muhammed Al-Mulhem 3

Bézier Curves Equations

• Although, Bezier curve section can be fitted to any number of control points, some graphics packages limit the number of control points to four.

• Although, Bezier curve section can be fitted to any number of control points, some graphics packages limit the number of control points to four.

March 1, 2009 Dr. Muhammed Al-Mulhem 4

Bézier Curves Equations

• Consider first the general case of n+1 control points, denoted as:

• Consider first the general case of n+1 control points, denoted as:

10)()(0

,

uuBEZPuPn

knkk

March 1, 2009 Dr. Muhammed Al-Mulhem 5

Bézier Curves Equations

• The Bézier blending function BEZ k, n (u) are the Bernstein

polynomials

• Where parameters C(n,k) are the binomial coefficients

• The Bézier blending function BEZ k, n (u) are the Bernstein

polynomials

• Where parameters C(n,k) are the binomial coefficients

knknk uuknCuBEZ )1(),()(,

)!(!

!),(

knk

nknC

March 1, 2009 Dr. Muhammed Al-Mulhem 6

Bézier Curves Equations

• P(u) in slide #4 represent a set of three parametric equations for the individual curve coordinates.

• P(u) in slide #4 represent a set of three parametric equations for the individual curve coordinates.

)()(

)()(

)()(

0,

0,

0,

uBEZzuz

uBEZyuy

uBEZxux

n

knkk

n

knkk

n

knkk

March 1, 2009 Dr. Muhammed Al-Mulhem 7

Bézier Curves Equations

• In most cases, a Bézier curve is a polynomial of degree one less that the designated number of control points.

• Three points generate a parabola, four points a cubic curve, and so on.

• Next slide demonstrate the appearance of some Bézier curves for various selections of control points in the x-y plane (z=0).

• In most cases, a Bézier curve is a polynomial of degree one less that the designated number of control points.

• Three points generate a parabola, four points a cubic curve, and so on.

• Next slide demonstrate the appearance of some Bézier curves for various selections of control points in the x-y plane (z=0).

March 1, 2009 Dr. Muhammed Al-Mulhem 8

Bézier Curves Equations

March 1, 2009 Dr. Muhammed Al-Mulhem 9

Bézier Curves Equations

• With certain control points placements, however, we obtain degenerate Bézier polynomials.

• For example,

• A Bézier curve generated with three collinear control points is a straight-line segment.

• A set of control points that are all at the same coordinate position produce a Bézier curve that is a single point.

• With certain control points placements, however, we obtain degenerate Bézier polynomials.

• For example,

• A Bézier curve generated with three collinear control points is a straight-line segment.

• A set of control points that are all at the same coordinate position produce a Bézier curve that is a single point.

March 1, 2009 Dr. Muhammed Al-Mulhem 10

Bézier Curves Equations

• A recursive calculations can be used to obtain successive binomial-coefficient values as:

• A recursive calculations can be used to obtain successive binomial-coefficient values as:

knforknCk

knknC

)1,(

1),(

March 1, 2009 Dr. Muhammed Al-Mulhem 11

Bézier Curves Equations

• Also, the Bézier blending function satisfy the recursive relationship:

• Also, the Bézier blending function satisfy the recursive relationship:

kk

kkk

nknknk

uBEZanduBEZ

with

knuBEZuuBEZuuBEZ

)1(

1)()()1()(

,0,

1,11,,

March 1, 2009 Dr. Muhammed Al-Mulhem 12

Properties of Bézier Curves

• The curve connects the first and last control points.

• Thus, a basic characteristic of any Bézier curve is that:

P(0) = p0

P(1) = pn

• The curve connects the first and last control points.

• Thus, a basic characteristic of any Bézier curve is that:

P(0) = p0

P(1) = pn

March 1, 2009 Dr. Muhammed Al-Mulhem 13

Properties of Bézier Curves

• Values for the parametric first derivatives of a Bézier curve at the endpoints can be calculated from control point coordinates as:

P’(0) = -np0 + n p1

P’(1) = -npn-1 + n pn

• From these expressions, we see that the slope at the beginning of the curve is a long the line joining the first two control points, and

• the slope at the end of the curve is a long the line joining the last two control points.

• Values for the parametric first derivatives of a Bézier curve at the endpoints can be calculated from control point coordinates as:

P’(0) = -np0 + n p1

P’(1) = -npn-1 + n pn

• From these expressions, we see that the slope at the beginning of the curve is a long the line joining the first two control points, and

• the slope at the end of the curve is a long the line joining the last two control points.

March 1, 2009 Dr. Muhammed Al-Mulhem 14

Properties of Bézier Curves

• The parametric second derivatives of a Bézier curve at the endpoints are calculated as:

P’’(0) = n (n – 1) [ (p2 - p1) - (p1 - p0) ]

P’’(1) = n (n – 1) [ (pn-2 - pn-1) - (pn-1 - pn) ]

• The parametric second derivatives of a Bézier curve at the endpoints are calculated as:

P’’(0) = n (n – 1) [ (p2 - p1) - (p1 - p0) ]

P’’(1) = n (n – 1) [ (pn-2 - pn-1) - (pn-1 - pn) ]

March 1, 2009 Dr. Muhammed Al-Mulhem 15

Properties of Bézier Curves

• Another property of any Bézier curve is that it lies within the convex hull (convex polygon boundary) of the control points.

• This follows from the fact that the Bézier bending functions are all positive and their sum is always 1.

• Another property of any Bézier curve is that it lies within the convex hull (convex polygon boundary) of the control points.

• This follows from the fact that the Bézier bending functions are all positive and their sum is always 1.

1)(0

,

uBEZn

knk

March 1, 2009 Dr. Muhammed Al-Mulhem 16

Design Techniques using Bézier Curves

• A closed Bézier curve is generated when we set the last control point position to the coordinate position of the first control point.

• A closed Bézier curve is generated when we set the last control point position to the coordinate position of the first control point.

March 1, 2009 Dr. Muhammed Al-Mulhem 17

Design Techniques using Bézier Curves

• Also, specifying multiple control points at a single coordinate position gives more weight to that position.

• The resulting curve is pulled nearer to this position.

• Also, specifying multiple control points at a single coordinate position gives more weight to that position.

• The resulting curve is pulled nearer to this position.

March 1, 2009 Dr. Muhammed Al-Mulhem 18

Design Techniques using Bézier Curves

• We can fit Bézier curve to any number of control points, but this requires the calculation of polynomial functions of higher degree.

• When complicated curves are to be generated, they can be formed by piecing together several Bézier curves of lower degrees.

• Generating smaller Bézier curves also gives us better local control over the shape of the curve.

• We can fit Bézier curve to any number of control points, but this requires the calculation of polynomial functions of higher degree.

• When complicated curves are to be generated, they can be formed by piecing together several Bézier curves of lower degrees.

• Generating smaller Bézier curves also gives us better local control over the shape of the curve.

March 1, 2009 Dr. Muhammed Al-Mulhem 19

Design Techniques using Bézier Curves

• Since Bézier curve connect the first and last control points, it is easy to match curve sections (zero-order continuity).

• Also, Bézier curves have the important property that the tangent to the curve at an endpoint is along the line joining that endpoint to the adjacent control point.

• Since Bézier curve connect the first and last control points, it is easy to match curve sections (zero-order continuity).

• Also, Bézier curves have the important property that the tangent to the curve at an endpoint is along the line joining that endpoint to the adjacent control point.

March 1, 2009 Dr. Muhammed Al-Mulhem 20

Design Techniques using Bézier Curves

• To obtain first-order continuity between curve sections, we can pick control points p0’ and p1’ for the next curve

section to be along the same straight line as control points pn-1 and pn of the preceding section.

• To obtain first-order continuity between curve sections, we can pick control points p0’ and p1’ for the next curve

section to be along the same straight line as control points pn-1 and pn of the preceding section.

p3

March 1, 2009 Dr. Muhammed Al-Mulhem 21

Cubic Bézier Curves

• Cubic Bézier curves are generated with four control points.

• The four blending function for cubic Bézier curves, obtained by substituting n =3 into equations in slide # 5. The results are:

• Cubic Bézier curves are generated with four control points.

• The four blending function for cubic Bézier curves, obtained by substituting n =3 into equations in slide # 5. The results are:

33,3

23,2

23,1

33,0

)1(3

)1(3

)1(

uBEZ

uuBEZ

uuBEZ

uBEZ

March 1, 2009 Dr. Muhammed Al-Mulhem 22

Cubic Bézier Curves

• The plots of the four cubic Bézier blending functions are as follows:

• The plots of the four cubic Bézier blending functions are as follows:

March 1, 2009 Dr. Muhammed Al-Mulhem 23

Cubic Bézier Curves

• The form of the blending functions determines how the control points influence the shape of the curve for values of parameter u over the range from 0 to 1.

• At u=0, the only nonzero blending function is BEZ0,3,

which has value 1.

• At u=1, the only nonzero blending function is BEZ3,3,

which has value 1.

• The form of the blending functions determines how the control points influence the shape of the curve for values of parameter u over the range from 0 to 1.

• At u=0, the only nonzero blending function is BEZ0,3,

which has value 1.

• At u=1, the only nonzero blending function is BEZ3,3,

which has value 1.

March 1, 2009 Dr. Muhammed Al-Mulhem 24

Cubic Bézier Curves

• A cubic Bézier curve always begins at control point p0

and ends at p3.

• The other functions, BEZ1,3, and BEZ2,3, influence the

shape of the curve at intermediate values of parameter u, so the resulting curve tends toward the points p1 and p2.

• Blending function BEZ1,3, is maximum at u=1/3, and

BEZ2,3, is maximum at u=2/3.

• A cubic Bézier curve always begins at control point p0

and ends at p3.

• The other functions, BEZ1,3, and BEZ2,3, influence the

shape of the curve at intermediate values of parameter u, so the resulting curve tends toward the points p1 and p2.

• Blending function BEZ1,3, is maximum at u=1/3, and

BEZ2,3, is maximum at u=2/3.

March 1, 2009 Dr. Muhammed Al-Mulhem 25

Bézier in Matrix Form

• A matrix form for the cubic Bézier curve function is obtained by expanding the polynomial expressions for the blending functions.

• Where the Bézier matrix is

• A matrix form for the cubic Bézier curve function is obtained by expanding the polynomial expressions for the blending functions.

• Where the Bézier matrix is

3

2

1

0

23 ..1)(

p

p

p

p

MuuuuP Bez

0001

0033

0363

1331

BezM

top related