POV-Ray : Newsgroups : povray.pov4.discussion.general : Spline improvements : Re: Spline improvements Server Time
3 Mar 2024 10:23:03 EST (-0500)
  Re: Spline improvements  
From: Allen
Date: 15 Jan 2009 00:10:01
Message: <web.496ec2e8c26f2bd28f162dfb0@news.povray.org>
"Chambers" <ben### [at] pacificwebguycom> wrote:
> The problem is that splines don't subdivide geometry; they merely
> provide a mechanism for finding a point on a curve.
>
> In other words, if I have a spline MySpline, then I could do:
>
> MySpline(0.5)
> MySpline(1/9)
> MySpline(3.14159265358)
>
> And all would return points.  Nowhere does the spline itself create a
> list of points.
>
> You seem to be thinking of a spline as a sort of vector array.  This is
> not the case; it is a mathematical representation used to create a
> curve.  We then take values from that curve for all sorts of reasons,
> but what use we make of them is unrelated to the spline itself.
>
> ...Ben Chambers
> www.pacificwebguy.com

That is the same as the auto_spline idea.  It is just a spline without the
values, kind of like the spline for a sphere_sweep.  The only difference is that
for an auto_spline the input values would be 0 to 1 and it would find a point on
the curve that is equal to a certain percentage along the curve.  MySpline(0.5)
would find the point half-way along the distance of the curve, MySpline(0.75)
would find the point 75% the distance of the curve, etc.

If I have a spline like:

spline
{
  linear_spline
  0.0, <0, 0, 0>,
  0.5, <1, 0, 0>,
  1.0, <1, 1, 0>
}

Then using MySpline(0.5) would return the half-way point along the spline.  But
if I change it:

spline
{
  linear_spline
  0.0, <0, 0, 0>,
  0.5, <1, 0, 0>,
  1.0, <1, 3, 0>
}

Then MySpline(0.5) is no longer half-way along the distance of the spline.  It
finds a point on the curve, based on the value for the given point provided.  I
must also change the spline value at the point in order to keep 0.5 the
midpoint:

spline
{
  linear_spline
  0.0, <0, 0, 0>,
  0.25, <1, 0, 0>,
  1.0, <1, 3, 0>
}


With an auto spline you would still provide a curve and use it to find a point
along that curve, but instead of providing values with those points, the value
would automatically be the distance to the point along the curve.  Then it
could still be treated just like a spline, except 0..1 is used to find a point
at a certain percentage along the curve:

For both splines:


auto_spline
{
  linear_spline
  <0, 0, 0>,
  <1, 0, 0>,
  <1, 1, 0>
}

auto_spline
{
  linear_spline
  <0, 0, 0>,
  <1, 0, 0>,
  <1, 3, 0>
}

MySpline(0.5) would always find the point along the spline that is half-way: <1,
0, 0> for the first and <1, 1, 0> for the second.

Anyway that's the idea.


Post a reply to this message

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