POV-Ray : Newsgroups : povray.general : Macro for connecting n points through Spline Server Time
27 Dec 2024 13:52:01 EST (-0500)
  Macro for connecting n points through Spline (Message 1 to 6 of 6)  
From: Kima
Subject: Macro for connecting n points through Spline
Date: 20 Apr 2023 06:50:00
Message: <web.6441184a860526a665103170d427f3e5@news.povray.org>
I know how Spline works for two points, but how can we create a smooth line of
spheres passing through n points? I am looking for something like line smoothing
in graphs/charts.

I assume we have to create n-1 Splines, but how do we calculate the control
points to have a smooth curvature over points?

In the tutorial on Bezier patches, there is an explanation for aligning the
control points for Bezier surfaces, but I am not sure if we need to apply the
same approach here.


Post a reply to this message

From: ingo
Subject: Re: Macro for connecting n points through Spline
Date: 20 Apr 2023 07:20:00
Message: <web.64411f4bf0b679ef17bac71e8ffb8ce3@news.povray.org>
"Kima" <nomail@nomail> wrote:

> In the tutorial on Bezier patches, there is an explanation for aligning the
> control points for Bezier surfaces, but I am not sure if we need to apply the
> same approach here.

For interpolation between points I would not use a Bezier spline as there are
many ways to position the handles/control points. Use one of quadratic_spline,
cubic_spline, natural_spline or one from my curve macro's
https://ingoogni.nl/download/ There is also the Interpolate macro in math.inc
that does cosine interpolation or exponential interpolation.

ingo


Post a reply to this message

From: Kima
Subject: Re: Macro for connecting n points through Spline
Date: 20 Apr 2023 08:00:00
Message: <web.64412832f0b679ef65103170d427f3e5@news.povray.org>
"ingo" <nomail@nomail> wrote:
>
> For interpolation between points I would not use a Bezier spline as there are
> many ways to position the handles/control points. Use one of quadratic_spline,
> cubic_spline, natural_spline or one from my curve macro's
> https://ingoogni.nl/download/ There is also the Interpolate macro in math.inc
> that does cosine interpolation or exponential interpolation.
>
> ingo

WOW! Your collection of spline macros is quite something. I will use them.
Thanks for sharing :-)


Post a reply to this message

From: Josh English
Subject: Re: Macro for connecting n points through Spline
Date: 20 Apr 2023 16:40:08
Message: <6441a328$1@news.povray.org>
On 4/20/2023 3:47 AM, Kima wrote:
> I know how Spline works for two points, but how can we create a smooth line of
> spheres passing through n points? I am looking for something like line smoothing
> in graphs/charts.
> 
> I assume we have to create n-1 Splines, but how do we calculate the control
> points to have a smooth curvature over points?
> 
> In the tutorial on Bezier patches, there is an explanation for aligning the
> control points for Bezier surfaces, but I am not sure if we need to apply the
> same approach here.
> 

My bez.inc file has several functions to do this.

https://www.joshuarenglish.com/povray/bez.html


Post a reply to this message

From: Bald Eagle
Subject: Re: Macro for connecting n points through Spline
Date: 20 Apr 2023 18:30:00
Message: <web.6441bc30f0b679ef1f9dae3025979125@news.povray.org>
"Kima" <nomail@nomail> wrote:
> I know how Spline works for two points, but how can we create a smooth line of
> spheres passing through n points? I am looking for something like line smoothing
> in graphs/charts.
>
> I assume we have to create n-1 Splines, but how do we calculate the control
> points to have a smooth curvature over points?
>
> In the tutorial on Bezier patches, there is an explanation for aligning the
> control points for Bezier surfaces, but I am not sure if we need to apply the
> same approach here.

You need to make sure that the control points 1-in from the end of each spline
segment is on the same line, so that the endpoints are tangent.  IIRC, that is
covered in the documentation somewhere.

https://www.youtube.com/watch?v=jvPPXbo87ds&pp=ygUNZnJleWEgc3BsaW5lcw%3D%3D

I also have a PDF that covers this specifically for POV-Ray

- BW


Post a reply to this message

From: Kima
Subject: Re: Macro for connecting n points through Spline
Date: 22 Apr 2023 00:40:00
Message: <web.64436452f0b679ef65103170d427f3e5@news.povray.org>
Thanks for all the tips. It is embarrassing, but I must admit as it may help
someone else. I knew I had used it a long time ago but stupidly forgot it.

I was looking for "sphere_sweep"!

It is funny that people have encountered all sorts of problems in the long
history of POV-Ray, and we often try in vain to re-invent the wheel :-)


Post a reply to this message

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