POV-Ray : Newsgroups : povray.pov4.discussion.general : Spline improvements : Re: Spline improvements Server Time
30 Apr 2024 18:16:54 EDT (-0400)
  Re: Spline improvements  
From: Allen
Date: 15 Jan 2009 15:45:01
Message: <web.496f9f8ec26f2bd28f162dfb0@news.povray.org>
"Chambers" <ben### [at] pacificwebguycom> wrote:
> OK, so you're saying that
> auto_spline(x) - auto_spline(x+h) = l,
> where x is a value 0..1, h is some value 0..1-x, and l is the distance
> travelled along the spline.
>
> In other words, the "distance" between the points returned by as(0.3)
> and as(0.5) is the same as the "distance" between the points returned by
> as(0.4) and as(0.6).
>
> Put another way, if a spline were a string, then two points along the
> spline separated by a constant factor would always have the same amount
> of string between them.
>
> Is that correct?
>
> ...Ben Chambers
> www.pacificwebguy.com

Yes that's right.

I use a spline for camera movement, and in this case the 'value' for each point
is good as it lets me set up speed. I can have 0..0.5 have a distance of 2 and
0.5..1 have a distance of 4, causing the camera to speed up when using 'clock'.
Or I can use it for nonlinear random numbers, for example the following spline I
use to create a ring of rocks around a small 'planet'

#declare rpos_sp = spline
{
    linear_spline
    0.0, 3.0,
    0.25, 3.5,
    0.251, 4.0,
    0.5, 4.5,
    0.501, 5.0,
    1.0, 5.5
}

#declare rpos = rpos_spline(rand(R)).x;

In this case the spline value lets me put ~25% of the rocks at a distance of 3.0
to 3.5, ~25% at 4.0 to 4.5 and ~50% at 5.0 to 5.5, with a very small amount in
between.


But at times I just want to use a spline to duplicate objects along the spline
at even positions.  Any time I change the spline curve, I have to go back and
change the values in order to get even positions.


Post a reply to this message

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