|
|
Open any textbook on computer graphics [yeah, like those are common any
more...] and there will be at least an entire chapter if not an entire
part dedicated solely to splines. You would not believe how many
different kinds of spline technology exist!
So anyway, recently I've decided to revisit this topic using the
ever-correct and well-written Wikipedia.
everything there is to know about these now. Wikipedia has some lovely
animations which visually illustrate exactly how to plot such a curve:
Suppose you want to plot the point 3/5th of the way along the curve.
- Draw a straight line between each consecutive pair of points, and find
the point 3/5th of the way along each line. (There will be N of these.)
- We have now constructed a new set of N points from the existing set of
N+1 points. Each time we repeat the procedure, we end up with a smaller
set of points. Repeat the process until only 1 point removes. This is
the point 3/5th of the way along the curve.
into two parts of unequal length. If you keep the first point of every
spline. Ditto for the last point in every set. The two new splines
coincide with the old one exactly (aside from the obvious change of
parameter values).
Alternatively, you can represent the spline as the sum of the control
points multiplied by the Bernstein polynomials of the appropriate order.
But this is [apparently] less numerically-stable than the above, and
just more complicated to program.
move any single control point, THE ENTIRE SPLINE CHANGES. It must be
pretty damned annoying to spend hours getting one part of the curve just
right, and then trying to edit another part and seeing the part you just
did start moving around. (!)
100 control points, you use them to control several dozen independent
effort, I have yet to determine how you can construct such a set of
splines from the control points so that the final curve appears smooth
and joinless.
transform the curve by just transforming the control points, or being
able to cut the curve in half. But aside from the problem of editing
circle exactly, only in approximation. (But then, straight lines can
describe a circle *in approximation*! Computer games try it all the time...)
control point has a "weight" associated with it. As best as I can tell,
the algorithm works like this: Let's assume we want a 2D spline. You
draw the spline in 3D, with the weight being the distance from the
camera. You then project the spline back into 2D using a perspective
projection. The control points have their coordinates adjusted so that
no matter what the distance from the camera is, they still appear at the
same position in 2D space (from the camera's viewpoint). But this still
affects the resulting spline curve.
(Most weirdly, a *negative* weight in effect calculates some kind of
360-degree frog-eye camera weirdness. But the end result is useful.)
sections ("although the representation is not unique").
And then we come to B-splines, and that's where it all starts to get a
bit fuzzy. A B-spline has a "knot vector" which controls the blending
functions. If the number of control points equals the degree, the
equidistant, the B-spline has the property that moving one control point
only affects a limited part of the curve.
(This already suggests a way to have 100 control points define a single,
continuous curve. If only, say, 4 of the points are active at any time,
but the blending functions go smoothly to zero, you can calculate each
segment of curve using only 4 control points, but the resulting curve is
guaranteed to be smooth.)
The blending functions appear to be recursively-defined, so that the
zero-order functions are piece-wise constant, the first-order functions
are piece-wise linear, and higher functions are linear combinations of
the next order down, so the functions get smoother and smoother as you
go up.
Still not really comprehending this knot vector business...
Wikipedia has a huge, huge article on NURBS. But NURBS starts for
"non-uniform rational B-spline". It's a B-spline which is rational
projecting into the distance) and has a non-uniform knot vector. So if
you can figure out B-splines... basically, you know NURBS.
...my head hurts! >_<
Post a reply to this message
|
|
|
|
Invisible <voi### [at] devnull> wrote:
> 100 control points, you use them to control several dozen independent
> effort, I have yet to determine how you can construct such a set of
> splines from the control points so that the final curve appears smooth
> and joinless.
If you wanted to smoothly join spline1 and spline2:
1)the endpoint of spline1 must be in the same location as the start point of
spline2
2) the last control point of spline1, the endpoint of spline1/start point of
spline2, and the first control point of spline2 must be co-linear.
The discontinuity is caused by the change in slope between the control points
and their respective endpoint. Note that the line between a control point and
its nearest endpoint form a line that has the slope of the curve at the
endpoint. If you make the slopes of the two adjacent splines different, then
they do not connect smoothly.
-Reactor
Post a reply to this message
|
|
|
|
Reactor wrote:
> If you wanted to smoothly join spline1 and spline2:
> 1)the endpoint of spline1 must be in the same location as the start point of
> spline2
> 2) the last control point of spline1, the endpoint of spline1/start point of
> spline2, and the first control point of spline2 must be co-linear.
>
> The discontinuity is caused by the change in slope between the control points
> and their respective endpoint. Note that the line between a control point and
> its nearest endpoint form a line that has the slope of the curve at the
> endpoint. If you make the slopes of the two adjacent splines different, then
> they do not connect smoothly.
As I discovered further down, using a B-spline means that the degree of
the curve is unrelated to the number of control-points, and smoothness
is guaranteed (depending on the order of the curve).
Now all I have to do is figure out how B-splines actually work. >_<
Post a reply to this message
|
|