|
![](/i/fill.gif) |
Serge LAROCQUE <sgl### [at] hotmail com%> wrote:
: I have an algorithm (from my old notes) for a cubic spline. It, however, works
: with through points rather than control points.
That's exactly how it should (as the lathe object works; see the povray
documentation).
: For 'n' points, the algorithm
: produces 'n-1' cubic polynomials for in between the points
In that case it may not be the algorithm used by povray. In the lathe
object, using a cubic spline, 'n' points produce a curve that goes through
'n-2' points, ie. starts from point 2 and ends at the point n-1. The first
and last points are only control points.
This means that first we take the 4 first points and calculate the curve
between point 2 and 3 using points 1 and 4 as control points (the curve starts
from point 2 and ends at point 3). Then we take the points 2 to 5 and
calculate the curve that starts from point 3 and end at point 4 using the
points 2 and 5 as control points, and so on. In result we get a smooth
curve that goes from point 2 to point n-1.
A quadratic curve generates 'n-1' curve segments since it uses just one
control point instead of two. In this case, too, the curve goes through all
the points.
--
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/
Post a reply to this message
|
![](/i/fill.gif) |