POV-Ray : Newsgroups : povray.advanced-users : cubic splines Server Time
29 Jul 2024 12:26:34 EDT (-0400)
  cubic splines (Message 1 to 9 of 9)  
From: Christopher Johnson
Subject: cubic splines
Date: 16 May 2002 19:06:43
Message: <3ce43b83@news.povray.org>
I've been working on a macro to preprocess cubic splines so that you can
specify a specific distance along the spline as opposed to just a function
of time.  I'm running tests on it and would like to know if anyone has
tested chris colefax's macros to measure the error in his distance
estimation.  I just havn't had the time to play around with his spline
macros to test them myself yet.

The way I have been testing my routines is :

Given a spline with any number of control points --->  S
The length of the spline is ---> L

if we wanted to find the point that was 50% of the length i.e. S(0.5)

the error would be  (length of segment from S(0.0) to S(0.5)) - (0.5 * total
length)



I'm interested in your usual statistical values (max,min,mean, and std dev)
along with any parsing speed data.  Any help would be appreciated here, just
if you happen to have some numbers kicking around.  I hope to post the
routine in about a week now that classes are over I can clean them up and
document the thing.

thanks,
Christopher Johnson


Post a reply to this message

From:
Subject: Re: cubic splines
Date: 17 May 2002 02:07:42
Message: <vb79euo1cl533eesphr95n2i5lqmkc55v4@4ax.com>
On Thu, 16 May 2002 19:11:49 -0400, "Christopher Johnson"
<age### [at] hotmailcom> wrote:
> I've been working on a macro to preprocess cubic splines so that you can
> specify a specific distance along the spline as opposed to just a function
> of time.

How you do it ? I have it already done for spline tutorial I'm working on but
perhaps could be interesting to compare methods. Have you analitical solution?
I have general solution for all types of splines, not only cubic.

ABX


Post a reply to this message

From: Gleb
Subject: Re: cubic splines
Date: 17 May 2002 06:09:58
Message: <3ce4d6f6@news.povray.org>
"Christopher Johnson" <age### [at] hotmailcom> wrote in message
news:3ce43b83@news.povray.org...
>
> The way I have been testing my routines is :
>
> Given a spline with any number of control points --->  S
> The length of the spline is ---> L
>
> if we wanted to find the point that was 50% of the length i.e. S(0.5)
>
> the error would be  (length of segment from S(0.0) to S(0.5)) - (0.5 *
total
> length)

It would be better to use relative error then.

Gleb


Post a reply to this message

From: Christopher Johnson
Subject: Re: cubic splines
Date: 17 May 2002 11:13:05
Message: <3ce51e01@news.povray.org>
It's not really an analytical solution.  You pass a spline to the macro and
it creates a reference spline.  The reference spline is based on the error
between time and distance.

Say you had your spline .. S
And the resulting reference spline .. K

if you wanted a point that was 75% of the length of the spline

K(0.75).x would give you the time value T
S(T) would be the point at 75% of the length.

This method would make more sense for motion curves as opposed to
dynamically create splines for ... whatever.  The idea is that instead of
having to compute an estimation on the fly like Colefax's macro, this one is
more of a preprocessor.  You run it once.  Save the reference it creates.
Then the only computation needed for a distance is the call to the reference
macro.  I still need to clean up a few routines but the debug version was
tested with a mean error of 0.0004 off actual distance( I'll have better
numbers soon) .  It works pretty well, I just have to optimize a few of the
unsavory hacked portions.

I'll post the code when I get it cleaned up, hopefully in a couple days.



news:vb79euo1cl533eesphr95n2i5lqmkc55v4@4ax.com...
> On Thu, 16 May 2002 19:11:49 -0400, "Christopher Johnson"
> <age### [at] hotmailcom> wrote:
> > I've been working on a macro to preprocess cubic splines so that you can
> > specify a specific distance along the spline as opposed to just a
function
> > of time.
>
> How you do it ? I have it already done for spline tutorial I'm working on
but
> perhaps could be interesting to compare methods. Have you analitical
solution?
> I have general solution for all types of splines, not only cubic.
>
> ABX


Post a reply to this message

From:
Subject: Re: cubic splines
Date: 17 May 2002 11:35:24
Message: <qr7aeugkvt07m6obnchs3hben663jbnkit@4ax.com>
On Fri, 17 May 2002 11:18:10 -0400, "Christopher Johnson"
<age### [at] hotmailcom> wrote:

> It's not really an analytical solution.  You pass a spline to the macro and
> it creates a reference spline.

If I understand it correctly it is similiar to my idea. Look below:

#macro Spline_With_Linear_Movement(Spline,Min,Max,Accuracy)
  spline{
    #local Last=Spline(Min);
    #local Length=0;
    #local C=Min;
    #while (C<=Max)
      #local C=min(C,Max);
      #local Point=Spline(C);
      #local Length=Length+vlength(Point-Last);
      Length , Point
      #local C=C+Accuracy;
    #end
  }
#end

#macro Time_To_Length_Converter(Spline,Min,Max,Accuracy)
  #local Conversion=function{spline{
    #local Last=Spline(Min);
    #local Length=0;
    #local C=Min;
    #while (C<=Max)
      #local C=min(C,Max);
      #local Point=Spline(C);
      #local Length=Length+vlength(Point-Last);
      C , Length
      #local C=C+Accuracy;
    #end
  }};
  function(T){Conversion(T).x}
#end

ABX


Post a reply to this message

From: Christopher Johnson
Subject: Re: cubic splines
Date: 17 May 2002 12:18:59
Message: <3ce52d73@news.povray.org>
That looks like the first incarnation I had.  The problem here is that the
number of control points on the reference spline can become rather unwieldy
with high degrees of accuracy.  I'm using a modified min/max search to find
where the error is highest (+/-) on the original spline and only adding
points there.  The result is that you have to make several passes, but it
doesn't waste time computing points where it doesn't need to.  This also
allows you to set a threshold ... if the error isn't higher than the mean
(or whatever other threshold value), then don't add a point.  I'm working on
adjustable optimizations right now, so you can prioritize between speed,
accuracy, and number of points.



Christopher Johnson



news:qr7aeugkvt07m6obnchs3hben663jbnkit@4ax.com...
> On Fri, 17 May 2002 11:18:10 -0400, "Christopher Johnson"
> <age### [at] hotmailcom> wrote:
>
> If I understand it correctly it is similiar to my idea. Look below:
>
> #macro Spline_With_Linear_Movement(Spline,Min,Max,Accuracy)
>   spline{
>     #local Last=Spline(Min);
>     #local Length=0;
>     #local C=Min;
>     #while (C<=Max)
>       #local C=min(C,Max);
>       #local Point=Spline(C);
>       #local Length=Length+vlength(Point-Last);
>       Length , Point
>       #local C=C+Accuracy;
>     #end
>   }
> #end
>
> #macro Time_To_Length_Converter(Spline,Min,Max,Accuracy)
>   #local Conversion=function{spline{
>     #local Last=Spline(Min);
>     #local Length=0;
>     #local C=Min;
>     #while (C<=Max)
>       #local C=min(C,Max);
>       #local Point=Spline(C);
>       #local Length=Length+vlength(Point-Last);
>       C , Length
>       #local C=C+Accuracy;
>     #end
>   }};
>   function(T){Conversion(T).x}
> #end
>
> ABX


Post a reply to this message

From:
Subject: Re: cubic splines
Date: 17 May 2002 12:23:52
Message: <cibaeuok917e81ab3s3gf02ulk9c5n5oq4@4ax.com>
On Fri, 17 May 2002 12:24:05 -0400, "Christopher Johnson"
<age### [at] hotmailcom> wrote:
> I'm working on

All this sounds promising.

ABX


Post a reply to this message

From: Christopher Johnson
Subject: Re: cubic splines
Date: 17 May 2002 13:59:08
Message: <3ce544ec@news.povray.org>
I just posted some of the error test results to the images group.  These
were created without any thresholding.  Aside from some loose ends, I'm
pretty happy with the way it's working.

Christopher Johnson



news:cibaeuok917e81ab3s3gf02ulk9c5n5oq4@4ax.com...
> On Fri, 17 May 2002 12:24:05 -0400, "Christopher Johnson"
> <age### [at] hotmailcom> wrote:
> > I'm working on
>
> All this sounds promising.
>
> ABX


Post a reply to this message

From: Christopher Johnson
Subject: Re: cubic splines
Date: 17 May 2002 13:59:10
Message: <3ce544ee$1@news.povray.org>
On the images post .... the images may come up in the wrong order but the
filenames are correct.

sorry


news:cibaeuok917e81ab3s3gf02ulk9c5n5oq4@4ax.com...
> On Fri, 17 May 2002 12:24:05 -0400, "Christopher Johnson"
> <age### [at] hotmailcom> wrote:
> > I'm working on
>
> All this sounds promising.
>
> ABX


Post a reply to this message

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