¡@
Bezier Curves
The Bezier Curves are used in computer-aided design and are named after a mathematician working in the automotive industry.
A cubic Bezier curve is determined by four control points , , , and , and is defined by the parametric equations
where is in [].
Notice that when we have and when we have , so the curve starts at and ends at .
Here we graph the Bezier curve with control points , , , and .
A procedure to graph Bezier curves :
Then on the same screen, graph the line segments , , and . Notice that the middle control points and do not lie on the curve; the curve starts at heads toward and without reaching them, and ends at .
¡@
A procedure to graph Bezier curves with line segments connecting control points:
> with(plottools):
> Bezier:=proc(x0,y0,x1,y1,x2,y2,x3,y3)
local f,g,c,l1,l2,l3,p0,p1,p2,p3;
f:=t->x0*(1-t)^3+3*x1*t*(1-t)^2+3*x2*t^2*(1-t)+x3*t^3:
g:=t->y0*(1-t)^3+3*y1*t*(1-t)^2+3*y2*t^2*(1-t)+y3*t^3:
c:=plot([f(t),g(t),t=0..1],thickness=2,scaling=constrained, axes=none):
display(c);
end:
Warning, the name arrow has been redefined
> Bezier_L:=proc(x0,y0,x1,y1,x2,y2,x3,y3)
local f,g,c,l1,l2,l3,p0,p1,p2,p3;
f:=t->x0*(1-t)^3+3*x1*t*(1-t)^2+3*x2*t^2*(1-t)+x3*t^3:
g:=t->y0*(1-t)^3+3*y1*t*(1-t)^2+3*y2*t^2*(1-t)+y3*t^3:
c:=plot([f(t),g(t),t=0..1],thickness=2,scaling=constrained):
l1:=line([x0,y0], [x1,y1], color=blue):
l2:=line([x1,y1], [x2,y2], color=blue):
l3:=line([x2,y2], [x3,y3], color=blue):
p0:=pointplot([x0,y0],symbol=circle,color=black):
p1:=pointplot([x1,y1],symbol=circle,color=black):
p2:=pointplot([x2,y2],symbol=circle,color=black):
p3:=pointplot([x3,y3],symbol=circle,color=black):
display(c,l1,l2,l3,p1,p2,p3,p0);
end:
> x0:=4: y0:=1:
> x1:=28: y1:=48:
> x2:=50: y2:=42:
> x3:=40: y3:=5:
> Bezier_L(x0,y0,x1,y1,x2,y2,x3,y3);
¡@
¡@
From the graph above, it appears that the tangent at passes through and the tangent at passes through .
To produce a Bezier curve with a loop, we can change the second control point .
> display(seq(Bezier_L(x0,y0,28+5*n,48-4.3*n,x2,y2,x3,y3),n=0..10),insequence=true); ¡@
Some laser printer use Bezier curves to represent letters and other symbols. A reasonable representation of the letter C can be done as follows:
> x0:=35.5: y0:=22:
> x1:=28: y1:=30:
> x2:=25: y2:=10:
> x3:=36: y3:=17:
> Bezier(x0,y0,x1,y1,x2,y2,x3,y3);
More complicated shapes can be represented by piecing together two or more Bezier curves. Suppose the first Bezier curve has control points , , , and the second one has control points , , , . If we want these two pieces to join together smoothly, then the tangents at should match and so the points , and all have to lie on this common tangent line. We can use this principle to find control points for a pair of Bezier curves that represent the letter S.
> b1:=Bezier(x0,y0,x1,y1,x2,y2,x3,y3):
> b2:=Bezier(x3,y3,x4,y4,x5,y5,x6,y6):
> display(b1,b2);