Calculates a series of values along a bezier spline.
void calc_spline(const int
npts, int *
x, int *
Calculates a series of npts values along a bezier spline, storing them in
the output x and y arrays. The bezier curve is specified by the four x/y
control points in the points array: points and points contain the
coordinates of the first control point, points and points are the
second point, etc. Control points 0 and 3 are the ends of the spline, and
points 1 and 2 are guides. The curve probably won't pass through points 1
and 2, but they affect the shape of the curve between points 0 and 3 (the
lines p0-p1 and p2-p3 are tangents to the spline). The easiest way to
think of it is that the curve starts at p0, heading in the direction of
p1, but curves round so that it arrives at p3 from the direction of p2.
In addition to their role as graphics primitives, spline curves can be
useful for constructing smooth paths around a series of control points,
as in exspline.c.
The following projects include source code containing this keyword: