You are on page 1of 35

Curves

Introduction
• Representing Curves
– A number of small line-segments joined
• Interpolation
• Parametric equations
• Bezier Curves
“Computers can’t draw curves.”

The more points/line


segments that are used,
the smoother the
curve.
• Representation of “irregular surfaces”

• Example: Auto industry (car body design)


• Tool and die Manufacturing
Curve representation
• How to represent a curve easily and
efficiently
• storing a curve as many small straight line
segments
– doesn’t work well when scaled
– inconvenient to have to specify so many points
– need lots of points to make the curve look smooth
• working out the equation that represents the curve
– difficult for complex curves
– moving an individual point requires re-calculation of
the entire curve
Interpolation
•Define a small number of
points
•Use a technique called
“interpolation” to invent the
extra points for us.
•Join the points with a series of
(short) straight lines
Parametric Equations - linear
Walk from P0 to P1 at a
P1 x1,y1
constant speed.
(13,8)
Start from P0 at t=0
(7.5,4) dy Arrive at P1 at t=1
P0

x0 ,y0
dx dx = x1 - x0
(2,3)
dy = y1 - y0
Where are you at a general
time t?
Equation(s) of a straight
line as a function of an x(t) = x0 + t.dx
arbitrary parameter t.
y(t) = y0 + t.dy
Why use parametric equations?
• One, two, three or n-dimensional
representation is possible
• Can handle “infinite slope” of tangents
• Can represent multi-valued functions
Bezier Curves
• An alternative to splines

• M. Bezier was a French mathematician who worked


for the Renault motor car company.
• He invented his curves to allow his firm’s
computers to describe the shape of car bodies.
Bezier Curve Properties
• The first and last control points are interpolated
• The tangent to the curve at the first control point is along
the line joining the first and second control points
• The tangent at the last control point is along the line
joining the second last and last control points
• The curve lies entirely within the convex hull of its control
points
– The Bernstein polynomials (the basis functions) sum to 1 and are
everywhere positive
• They can be rendered in many ways
– E.g.: Convert to line segments with a subdivision algorithm
Bezier Approximation
How to provide R1 and R4 ? P2 P3

R1 R4

P4 P4
P1 P1
Instead of providing R1 and R4 , provide two additional control points ! ! !

P2 and P3

 Approxi mation
Bezier curves
• Typically, cubic polynomials
• Similar to Hermite interpolation
– Special way of specifying end tangents
• Requires special set of coefficients
• Need four points
– Two at the ends of a segment
– Two control tangent vectors
Bezier curves
• Control polygon: control points connected to each
other

• Easy to generalize to higher order


– Insert more control points
– Hermite – third order only
De Casteljau algorithm
• Can compute any point on the curve in a
few iterations
• No polynomials, pure geometry
• Repeated linear interpolation
– Repeated order of the curve times
• The algorithm can be used as definition of
the curve
De Casteljau algorithm

Third order, u=0.75


De Casteljau algorithm
De Casteljau algorithm
De Casteljau algorithm
De Casteljau Algorithm
P1 1 t t P2
t 1 t
t 1 t 1 t t
t

1 t

P3
P0 P0
1 t
(1 t ) P0  tP1 1 t
t (1 t ) 2 P0  2(1 t )tP1 (1 t ) 3 P0
1 t
P1 1 t t 2P2  3(1 t ) 2 tP1
t
(1 t ) P1  tP2 t  3(1 t )t 2 P2
1 t
t (1 t ) 2 P1  2(1 t )tP2 t 3P3
P2 1 t t t 2 P3
(1 t ) P2  tP3
t

P3

Now,
 1 3 3 1  P0 
 3 6 3 0  P1 
3
 3 i

Q (t )  t 3 t 2 t 1   
i
i 0  
 t (1  t ) 3 i
1
 3 3 0 0  P2 
  
 1 0 0 0  P3 
What does it mean ?
 T  M b  Gb

1 (1  t ) 3
Q (t )  (1  t ) P0  3t (1-t ) P1  3t (1-t ) P2  t P3
3 2 2 3 t3
3t (1-t ) 2
3
 3 i
    t (1  t ) 3i Pi , 0  t  1
i 0  i  3t 2 (1-t )

0 1
Bezier Polynomial Function

n! n i
Bin (t )  .t .(1  t )
i

i!(n  i )!
Parametric equations for x(t),y(t)
n
x(t )   xi .Bin (t )
i 0

n
y (t )   yi .Bin (t )
i 0
Some Bezier Curves
Properties of a Bézier ‍Curve

1. The degree of a Bézier curve defined by n+1


control points is n:

Parabola Curve Cubic Curve Cubic Curve

Cubic Curve
2. The curve passes though the first and the last control point
C(u) passes through P0 and Pn.
3. Bézier curves are tangent to their first and
last edges of control polyline.

2 7 4
6 5
1 3

3 8
2 0
5 8
9 6
0 4 10
1 7
4. The Bézier curve lies completely in the convex hull of the given control points.

 Note that not all control points are on the boundary of the convex hull. For example, control points 3, 4, 5, 6,
8 and 9 are in the interior. The curve, except for the first two endpoints, lies completely in the convex hull.
5. Moving control points:
5. Moving control points:
6. The point that corresponds to u on the Bézier curve is the
"weighted" average of all control points, where the
weights are the coefficients Bk,n(u).

n
C(u )   p k Bk ,n (u ), 0  u  1
k 0
7. ‍Multiple control points at a single coordinate position gives more weight to that
position.
8. ‍Closed Bézier curves are generated by specifying the first and the last control
points at the same position.

4
5 3

2 0
8
6
1 7

‍Note:
Note: Bézier curves are polynomials which cannot represent circles
and ellipses.
9. If an affine transformation is applied to a Bézier curve, the result can be
constructed from the affine images of its control points.
Disadvantages

• The degree of the Bezier curve depends on the


number of control points.

• The Bezier curve lacks local control. Changing


the position of one control point affects the entire
curve.
Problem with Bezier Curves
• To make a long continuous curve with Bezier
segments requires using many segments
• Maintaining continuity requires constraints on the
control point positions
– The user cannot arbitrarily move control vertices and
automatically maintain continuity
– The constraints must be explicitly maintained
– It is not intuitive to have control points that are not free

You might also like