POV-Ray : Newsgroups : povray.advanced-users : Normalizing a quadratic spline : Re: Normalizing a quadratic spline Server Time
29 Jul 2024 14:15:06 EDT (-0400)
  Re: Normalizing a quadratic spline  
From: Chris Colefax
Date: 10 Jan 2002 07:12:51
Message: <3c3d8543@news.povray.org>
Christopher Johnson <age### [at] hotmailcom> wrote:
> Alright, first off .... I do realize that Colefax's spline macros will
solve
> this but I'm trying to figure this out.
>
> I wrote a macro to generate splines from a set of points.  It uses the
> spline feature of 3.5 but calculates the time values to eliminate
> acceleration and deceleration along the spline.
>
> It estimates the length of the spline between control points and for the
> overall length.
> I'm assuming the difference in time between points is proportional to the
> segment lengh / overall length.
>
> It works fine for linear splines but quadratic's tend to drift quite a
bit.
> I even tried writing a length finder where you could set to acceptable
error
> and the times still drift.
>
> Can anyone point me in the right direction here.

As you've discovered, traversing a curved spline at a constant speed is not
that simple.  The problem is that not only does each segment travel at its
own speed, but within each segment there is acceleration and deceleration
(generally slower around tighter corners).

Now, I believe that there may be an analytical solution to the problem for
quadratic splines, although this would involve recoding the internal spline
functions.  Instead, you may wish to try a solution similar to that I've
used in my Spline Macro file.

The file calculates cubic splines, for which no analytical solution exists.
Therefore, to achieve constant speed the macros actually evaluate the spline
at regular intervals, storing each time value and distance travelled in an
array.  This array is then used to estimate the time value needed to return
a point at a particular distance along the spline, and using equally-spaced
distance values allows the spline to be traversed at constant speed.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.