POV-Ray : Newsgroups : povray.advanced-users : Curve fitting a function with a cubic spline Server Time
25 Nov 2024 21:41:10 EST (-0500)
  Curve fitting a function with a cubic spline (Message 1 to 5 of 5)  
From: Christopher Johnson
Subject: Curve fitting a function with a cubic spline
Date: 17 Jan 2002 01:28:02
Message: <3c466ef2$1@news.povray.org>
I've been searching around the web on this one and I'm stumped

Say I have a function that is continuous between two defined points.  Which
method should I use to pick control points to fit a cubic spline to the
function.  I've found information on the least squares method but I'm not
entirely sure how to proceed.  The function is two dimensional.  0 to 1 on
the x axis and 0 to 1 on the y.  The function plots are close to linear from
(0,0) to (1,1) with a small amount of drift that can't be ignored.  It's the
deviation from linear that I'm interested in so i can't just assume it's
linear.  It may be that I've just stared at the problem blindly for too long
but any help would be appreciated

thanks
Chris


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: Curve fitting a function with a cubic spline
Date: 17 Jan 2002 18:59:58
Message: <3C476509.937360DC@hotmail.com>
Christopher Johnson wrote:
> 
> I've been searching around the web on this one and I'm stumped
> 
> Say I have a function that is continuous between two defined points.  Which
> method should I use to pick control points to fit a cubic spline to the
> function.  I've found information on the least squares method but I'm not
> entirely sure how to proceed.  The function is two dimensional.  0 to 1 on
> the x axis and 0 to 1 on the y.  The function plots are close to linear from
> (0,0) to (1,1) with a small amount of drift that can't be ignored.  It's the
> deviation from linear that I'm interested in so i can't just assume it's
> linear.  It may be that I've just stared at the problem blindly for too long
> but any help would be appreciated

Unfortunately I don't have to to investigate
this, but you can try this search:

http://www.google.com/search?hl=en&q=curve+fitting+3rd+degree+polynomial+%22cubic+spline%22

Btw.:
Are you thinking of using _one_ or _several_
cubic splines to interpolate the function ?


Tor Olav


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: Curve fitting a function with a cubic spline
Date: 17 Jan 2002 19:02:16
Message: <3C476596.1884D1F7@hotmail.com>
Tor Olav Kristensen wrote:
>...
> Unfortunately I don't have to to investigate
> this, but you can try this search:

Or just this:

http://www.google.com/search?q=curve+fitting+3rd+degree+polynomial&hl=en


Tor Olav


Post a reply to this message

From: Christopher Johnson
Subject: Re: Curve fitting a function with a cubic spline
Date: 17 Jan 2002 20:57:50
Message: <3c47811e@news.povray.org>
"Tor Olav Kristensen" <tor### [at] hotmailcom> wrote in message
news:3C476509.937360DC@hotmail.com...
>
> Unfortunately I don't have to to investigate
> this, but you can try this search:
>
>
http://www.google.com/search?hl=en&q=curve+fitting+3rd+degree+polynomial+%22
cubic+spline%22
>
> Btw.:
> Are you thinking of using _one_ or _several_
> cubic splines to interpolate the function ?
>
>
> Tor Olav

I'm trying to get away with using a single spline.  The function curve
should be fairly simple under most if not all conditions.  My recent
attempts have been aimed at placing control points at the peaks, troughs,
and zero crossing points of the function.  It works to a degree but I need
to make the peak,trough,zero routines more accurate and rework how it
determines the first and last point in the spline.  Thanks for the link, I
managed to dig up some old SIGGRAPH papers on the subject today as well.

Chris


Post a reply to this message

From: Christopher Johnson
Subject: Re: Curve fitting a function with a cubic spline
Date: 18 Jan 2002 14:34:49
Message: <3c4878d9@news.povray.org>
"Tor Olav Kristensen" <tor### [at] hotmailcom> wrote in message
news:3C476509.937360DC@hotmail.com...

>
> Unfortunately I don't have to to investigate
> this, but you can try this search:
>
>
http://www.google.com/search?hl=en&q=curve+fitting+3rd+degree+polynomial+%22
cubic+spline%22
>
> Btw.:
> Are you thinking of using _one_ or _several_
> cubic splines to interpolate the function ?
>
>
> Tor Olav

Ok, I've managed to write a macro to fit the a cubic spline (pov 3.5 b10) to
a function.  I assigned control points to the peaks, troughs, and zero
crossings of the function.  The only thing I still can't figure out is how
to find the endpoints.  For n points running from 0 to n, I've only managed
to get everything between 1 and n-1.  I tried the links that Tor Olav
suggested and even tried other sites on the subject but I'm still stumped.
Odds are the answer is staring me in the face but .....

I'm using the POV 3.5 cubic spline feature so I need to find the time value
and coords of the endpoints.

Thanks
Chris


Post a reply to this message

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