Curves Bezier CAD
Curves Bezier CAD
Curves Bezier CAD
Bezier Curves
A
Approximator
i t
Adds
Add flexibility
fl ibilit and
d intuitive
i t iti
f l in
feel
i
mechanical design
Credited to P. Bezier; P. De Casteljau also developed
independently
Only control points (not necessarily only 2 per segment)
f
form
the
h input,
i
no specification
ifi i
off tangent vectors
provides more direct relation between input (points) and
output
p ((curve))
The order of the Bezier is variable (unlike HCC) and
depends on the number of control points, (n+1)
(n+1) number of control points define an nthh degree
curve (we will term degree of curve as (k-1)
Bezier curve can be smoother than HCC
I/C, Regalla Srinivasa Prakash
Bezier Curve
The user supplies ((n+1)) control points, Pi
Write the curve as:
n
P(u ) = Pi Bi ,n (u )
0 u 1
i =0
n i
n i
Bi ,n (u ) = C u (1 u )
i
where the binomial coefficient
n
n!
C or C (n, i ) =
i!(n i )!
i
I/C, Regalla Srinivasa Prakash
0 u 1
Special case,
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
0 u 1
1
C (r , i ) Pi
(n r )! i =0
r
n
!
i
(
)
Pr (u = 1) =
1
C (r , i ) Pn i
(n r )! i =0=0
I/C, Regalla Srinivasa Prakash
B0
B1
B2
B3
0.6
0.4
0
0.2
0
What did
you
observe?
10
1
C (r , i ) Pi
(n r )! i =0
r
r
n
!
i
(
)
Pr (u = 1) =
1
C (r , i ) Pn i
(n r )! i =0
Substituting r = 1, the first derivatives at the endpoints are
P' (u = 0) = n(P1 Po )
P' (u = 1) = n(Pn Pn1 )
11
12
13
K=3
K=2
K=1
K
1
Multiple
control
points
are
specified
here
14
By making the
last point coincide with the
first point
By adding additional
control point at the
first point
15
B
i =0
i ,n
=1
16
8) Positivity:
For any value of u, given any degree of
curve, each Bernstein polynomial satisfies
Bi ,n > 0
This ensures that the Bezier curve lies
entirely
e
e y in its
s co
convex
e hull.
u
17
18
Example
p 1
Convex Hull
Example
p 2
Degree = 3
(Hatched region)
Degree = 3
19
Convex Hull
(Hatched region)
Example 3
Degree = ?
Example 4
Degree = ?
I/C, Regalla Srinivasa Prakash
20
Consequences
q
of Convex Hull Property
p y
There are three important aspects:
1) Degeneration to a straight line: useful
2) Clipping like manipulations become easy
3) Wild oscillations
ill ti
off the
th curve about
b t any
control point is avoided
I/C, Regalla Srinivasa Prakash
21
Repeated Slide
Consequences of Convex Hull Property
22
23
Example
If the first segment is formed by Po, P1, P2
and P3 and second segment is formed by
P4, P5, P6, P7 and P8, then P2, P3
(coinciding with P4) and P5 must be
collinear. Therefore
f
(P3 P2)= (4/3)(P5 P4)
P7
P2
P4
P1
P8
P3
P5
P6
P
o
24
de Casteljaus
Casteljau s Algorithm
Step 1: Find the midpoints of the lines joining the
original
g
control vertices. Call them M01, M12, M23
Step 2: Find the midpoints of the lines joining
M01, M12 and M12, M23. Call them M012, M123
Step
St 3:
3 Find
Fi d the
th midpoint
id i t off the
th line
li joining
j i i M012,
M123. Call it M0123
The curve with control p
points P0, M01, M012 and
M0123 exactly follows the original curve from the
point with u=0 to the point with u=0.5
The curve with control points M0123 , M123 , M23
and 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
Sub
Dividing Bezier Curves
M12
P1
M012
M0123
P2
M123
M01
M23
P0
P3
26
Sub-Dividing
Sub
Dividing Bezier Curves
P1
P2
P0
P3
27
de Casteljaus 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,
u=0 25 instead of taking
midpoints take points 0.25 of the way
M12
P2
P1
M23
t=0.25
M01
P0
P3
I/C, Regalla Srinivasa Prakash
28
Bit questions
29
30
31
32
= Po (1 u ) + P1u = Po + u (P1 Po )
I/C, Regalla Srinivasa Prakash
0 u 1
33
34
35
36
37
Solution:
As the number of control points increases it is necessary to have higher
order polynomials and possibly higher factorials. It is common
therefore to piece together small sections of Bzier curves to form a
g
curve. This also helps
p control local conditions, normally
y
longer
changing the position of one control point will affect the whole curve.
Of course since the curve starts and ends at the first and last control
point it is easy to physically match the sections. It is also possible to
g
at the ends is along
g the
match the first derivative since the tangent
line between the two points at the end.
38
39
40
41
42
Soution:
The degree of the curve is
one less than the number of
control points, so it is a
quadratic for 3 control
points. It will always be
symmetric for a symmetric
control point arrangement.
I/C, Regalla Srinivasa Prakash
Courtesy: http://astronomy.swin.edu.au/~pbourke/curves/bezier/
43
Th
The curve always
l
passes
through the end points and
is tangent to the line
between the last two and
first two control points.
points
This permits ready piecing
p Bzier curves
of multiple
together with first order
continuity.
I/C, Regalla Srinivasa Prakash
44
Courtesy: http://astronomy.swin.edu.au/~pbourke/curves/bezier/
45
46
47