0% found this document useful (0 votes)
14 views

سوال 25

The document discusses Bezier curves and their properties. It describes how Bezier curves are defined using Bernstein basis polynomials and control points. Equations for 2nd and 3rd degree Bezier curves are provided in both polynomial and matrix forms. An example of plotting a cubic Bezier curve and finding position values at certain parameter values is also given.

Uploaded by

alijasipo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

سوال 25

The document discusses Bezier curves and their properties. It describes how Bezier curves are defined using Bernstein basis polynomials and control points. Equations for 2nd and 3rd degree Bezier curves are provided in both polynomial and matrix forms. An example of plotting a cubic Bezier curve and finding position values at certain parameter values is also given.

Uploaded by

alijasipo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

2- Bezier curve:

Bezier chose a family of functions called Bernstein polynomials


to satisfy these properties. He originally chose a form of vector
representation that used the sides of the characteristic polygon
see figure (1) (2). This uses the vectors defining the polygon
vertices. It is a more compact scheme, with greater intuitive
appeal. It turns out that the functions Bezier selected depend on
the number of vertices used to specify a particular curve. To
indicate this:
n
p (u ) = ∑ pi Bi ,n (u ) ….. (1) u ∈ [0,1]
i =0

Where the basis functions are:


n
Bi ,n (u ) =  u i (1 − u ) n −i …… (2)
i

And where:
n
 
i

Denotes the familiar binomial coefficient function, or binomial


distribution from probability and statistics:
n n!
  =
 i  i!(n − i )!

The following conventions apply: if i and u equal zero, then u i = 1,

and 0! =1. If there are (n + 1) vertices, then the function


Bi ,n (u ) yields an nth-degree polynomial.
Expanding equation (2) for curves defined by three and four
points produces the following polynomial forms:
For three points, n=2, and
B0, 2 = (1 − u ) 2

B1, 2 = 2u (1 − u )

B2 , 2 = u 2

So that
p (u ) = (1 − u ) 2 p 0 + 2u (1 − u ) p1 + u 2 p 2 ….. (3)
For four points, n=3, and
B0,3 = (1 − u ) 3

B1,3 = 3u (1 − u ) 2

B2,3 = 3u 2 (1 − u )

B3,3 = u 3

So that
p (u ) = (1 − u ) 3 p 0 + 3u (1 − u ) 2 p1 + 3u 2 (1 − u ) p 2 + u 3 p3 ….. (4)
Using this cubic Bezier curve, a segment of a parabola with
endpoints at p 0 and p3 can be modeled exactly, if the end
( p 0 + 2 p1 )
tangents intersect at p1 so that p1 = and p 2 = ( p3 + 2 p1 ) .
3 3

These conditions produce


p (u ) = (1 − u ) 2 p 0 + 2(u − u 2 ) p1 + u 2 p3 …… (5)
Matrix form:
For the Bezier curve, n=2, we write equation (3) in matrix form
as follows:
 p0 
p (u ) = [(1 − 2u + u ) 2
( 2u − 2u ) 2
u ]  p1 
2
….. (6)
 p2 

1  − 2 1
1 − 2u + u = [u
2 2
u 1]− 2 2u − 2u = [u
2 2
u 1] 2  u = [u
2 2
u 1]0
 1   0  0

Or as
 1 − 2 1  p 0 
p (u ) = [u 2
u 1]− 2 2 0  p1 

…... (7)
 1 0 0  p 2 

Letting
U = [u 2 u 1] , P = [ p0 p1 p 2 ]T

 1 − 2 1
M B ( 2) = − 2 2 0
 1 0 0

We can write this equation even more compactly as


p (u ) = UM B ( 2 ) P

For the cubic Bezier curve, n=3, we write equation (5) in matrix
form as follows:
 p0 
p 
p (u ) = [(1 − 3u + 3u 2 − u 3 ) (3u − 6u 2 + 3u 3 ) (3u 2 − 3u 3 ) u 3 ] 1 
….. (8)
 p2 
 
 p3 

 − 1 3
3  − 6
1 − 3u + 3u 2 − u 3 = [u 3 u2 u 1]  3u − 6u 2 + 3u 3 = [u 3 u2 u 1] 
− 3 3
   
1 0
− 3 1
3 0 
3u 2 − 3u 3 = [u 3 u2 u 1]  u 3 = [u 3 u2 u 1] 
0 0 
   
0 0 

Or as
−1 3 − 3 1  p 0 
 3 −6 3 0  p1 
p (u ) = [u 3 u2 u 1] ….. (9)
− 3 3 0 0  p 2 
  
1 0 0 0  p 3 

Letting
U = [u 3 u2 u 1]

P = [ p0 p1 p2 p3 ]

−1 3 −3 1
 3 −6 3 0
M B ( 3) =
− 3 3 0 0
 
 1 0 0 0

We can write this equation even more compactly as


p (u ) = UM B (3) P

3 p1

2.8

2.6

polygon
2.4

2.2
y-axis

bezeir curve
2

1.8

1.6 p2

1.4

1.2

p0
1

1 1.2 1.4 1.6 1.8 2 2.2 2.4 2.6 2.8 3


x-axis

Figure (1) Bezier curve 2nd degree.


2 p1 p2
polygon

1.8

Be zier curve

1.6
y-axis

1.4

1.2

1 p0 p3

1 1.5 2 2.5 3 3.5 4 4.5 5


x-axis

Figure (2) cubic Bezier curve 3rd degree

Example 1: plot Bezier curve that represent by the control


points
p 0 = (1,1) p1 = (2,2) p 2 = (4,2) p3 = (5,1)

And find the inertial data at u=0, 0.5, 0.8,1?


Solution: see figure (2)
−1 3 − 3 1  p 0 
 3 −6 3 0  p1 
p(u ) = [u 3 u2 u 1] u ∈ [0,1]
− 3 3 0 0  p 2 
  
1 0 0 0  p 3 

−1 3 − 3 1  1 
 3 −6 3 0 2
p (u ) x = [u 3 u2 u 1]
− 3 3 0 0  4
  
1 0 0 0 5 
−1 3 − 3 1  1 
 3 −6 3 0 2
p (u ) y = [u 3 u2 u 1]
− 3 3 0 0  2
  
1 0 0 0  1 

When u=0 p (0) x = 1 p ( 0) y = 1

u = 0.5 p (0.5) x = 3 p (0.5) y = 1.75

u = 0.8 p (0.8) x = 4.296 p (0.8) y = 1.48

u =1 p (1) x = 5 p (1) y = 1

Bezier surface:
Points on a Bezier patch are given by the following tensor
product, a simple extension of the general equation for points on
a Bezier curve:
n m
p (u , w) = ∑∑ pij Bi ,n (u ) B j ,m ( w) ….. (10) u , w ∈ [0,1]
i =0 j =0

The pij comprise an (n+1)× (m+1) rectangular array of control


points defining the vertices of the characteristic polyhedron of
the Bezier patch, which lies entirely within its convex hull.
Bi ,n (u ) And B j ,m ( w) are the basis functions, defined in the same
way as for Bezier curves.
The general matrix equation for a Bezier patch is:
p (u , w) = UM B PM BT W T …... (11)
Or p (u , w) = U 1×n M B ,n×n Pn×m M BT ,m×mWmT×1

Where the dimensions of the matrices depend on the dimensions


of the control point array. The subscripts indicating the matrix
sizes are not repeated in later expressions, and they are used
here merely to illustrate their relationship to the control points.
The Bezier patch need not be described by a square array of
control points, although we will begin by exploring a 4×4 array
of points, which defines the bicubic Bezier patch.
We can express a bicubic Bezier patch in a form similar to the
bicubic hermit patch. Using the binomial representation of the
cubic Bezier curve, the matrix equation for a patch defined by a
4×4 array of control points is
p (u , w) = U 1×4 M B , 4×4 P4×4 M BT , 4×4W4T×1

Again, where the subscripts on the matrices indicate their


dimensions. Expanded, this equation becomes:
 (1 − w) 3 
 
3w(1 − w) 2 
p (u , w) = [(1 − u ) 3 3u (1 − u ) 2 3u (1 − u ) u ]P
2 3
….. (12)
3w 2 (1 − w)
 
 w3 

Where:
 p11 p12 p13 p14 
p p 22 p 23 p 24 
P =  21
 p31 p32 p33 p34 
 
 p 41 p 42 p 43 p 44 

The matrix P contains the points that define the characteristic


polyhedron and, there by, the Bezier patch.
Example 2: plot Bezier surface that represent by the control
points
p 00 = (1,1,1) p 01 = (2,1,2) p 02 = (3,1,1)

p10 = (1,2,2) p11 = (2,2,2) p12 = (3,2,2)

p 20 = (1,3,1) p 21 = (2,3,2) p 22 = (3,3,1)

And find the internal data at u = 0, w = 0 , u = 1, w = 1 , u = 0, w = 1 ,


u = 1, w = 0 , u = 0.5, w = 0.5

Solution: see figure (3)


p 02   1 − 2 1
T
 1 − 2 1  p 00 p 01
p(u, w) = [u 2 u 1]− 2 2 0  p10 p11 p12  − 2 2 0 w 2 [ w 1 ] T

 1 0 0  p 20 p 21 p 22   1 0 0

 1 − 2 1 1 2 3  1 − 2 1
T

p (u , w) x = [u 2 u 1]− 2 2 0 1 2 3 − 2 2 0 w 2 [ w 1 ]


T

 1 0 0 1 2 3  1 0 0

 1 − 2 1  1 1 1   1 − 2 1 
T

p(u, w) y = [u 2 u 1]− 2 2 0 2 2 2 − 2 2 0 w 2 [ w 1 ] T

 1 0 0 3 3 3  1 0 0

 1 − 2 1  1 2 1   1 − 2 1 
T

p(u, w) z = [u 2 u 1]− 2 2 0 2 2 2 − 2 2 0 w 2 [ w 1 ] T

 1 0 0 1 2 1  1 0 0

When u = 0, w = 0 p (0,0) x = 1 p (0,0) y = 1 p (0,0) z = 1

u = 1, w = 1 p (1,1) x = 3 p (1,1) y = 3 p (1,1) z = 1

u = 1, w = 0 p (1,0) x = 3 p (1,0) y = 1 p (1,0) z = 1

u = 0, w = 1 p (0,1) x = 1 p (0,1) y = 3 p (0,1) y = 1

u = 0.5, w = 0.5 p (0.5,0.5) x = 2 p (0,0) y = 1 p (0.5,0.5) y = 1.75


polygon
2

Bezier surface
1.5
z-axis

0.5
3.5

3.5
3
3
2.5
2.5
2 w u
2
1.5
1.5

y-axis 1 1 x-axis

Figure (3) Bezier surface (3×3)

polygon
2 Bezier surface

1.5
z-axis

0.5
4.5
4.5
4
4
3.5 w 3.5
u 3
3
2.5 2.5
2 2
1.5 1.5
1 1
y-axis 0.5 0.5 x-axis

Figure (4) Bezier surface (4×4)


Start

Input control points coordinates


p 0 , p1 , p 2 , p3
Input incremental value (∆u )

−1 3 − 3 1  p 0 
 3 −6 3 0  p1 
p (u ) = [u 3 u2 u 1]
− 3 3 0 0  p 2 
  
1 0 0 0  p 3 

Output
Internal data of curve
Curve presentation

End

Figure (5) Bezier curve block diagram


Start

Input control points


coordinates of curve
( xi , yi )

Input increment value


(∆u )

u=0

−1 3 − 3 1  p 0 
 3 −6 3 0  p1 
p (u ) = [u 3 u2 u 1]
− 3 3 0 0  p 2 
  
1 0 0 0  p 3 

u=u+1

0 ≤ u ≤1

Output
Internal data of curve
Curve presentation

End

Figure (6) Bezier curve flow chart (2D)


Start

Input number f control points in


x& y direction (n, m)

Input control points


coordinates of surface
Vector (n*m), ( xi , y i , z i )

Input increment value


(∆u , ∆w)

u=0

W=0

p (u , w) = U 1×4 M B , 4×4 P4×4 M BT , 4×4W4T×1

w=w+1

0 ≤ w ≤1

u=u+1

0 ≤ u ≤1

Output
Internal data of surface
Surface presentation

End

Figure (7) Bezier surface flow chart (3D)

You might also like