POV-Ray : Newsgroups : povray.beta-test : cubic spline bug : Re: cubic spline bug Server Time
29 Jul 2024 16:31:06 EDT (-0400)
  Re: cubic spline bug  
From: Mark Wagner
Date: 17 Apr 2002 01:00:33
Message: <3cbd0171@news.povray.org>

<4j0obu8bqevuf7spm93rlj2nl7rp8tlkb7@4ax.com>...
>POV 3.5 RC1 icl on WinNT Sp 6 PII 233 with 128 MB
>
>According to documentation "Val_1, Val_2, etc, are the value of the spline
>parameter at each specific point. " (6.1.9). So when there is different
point
>for t=0 and t=1 than I expect that Spline(0) is different than Spline(1).
>Below example shows that for cubic spline it is not true.
>// START
>
>#macro List() 0 <1,1,0> 1 <3,8,0> 2 <7,7,0> 3 <7,3,0> #end
>#macro Test(S) cylinder{ S(0) S(1) 1 } #end
>
>#local Spline = spline { List() };


>Test( spline{ Spline cubic_spline     } )


>Test( spline{ cubic_spline     List() } )
>
>// END

This is because of the way cubic_splines (aka Catmull-Rom splines) are
defined: the first and last points are tangents, rather than points on the
spline.  As a result, cubic_spline interpolation is only valid between the
second and next-to-last points.  For all other spline types, interpolation
is valid from the first point to the last point.  For t-values outside the
valid range, POV-Ray returns the value of the nearest valid point.  As a
result,

>Test( spline{ cubic_spline     0 <1,1,0> 1 <3,8,0> 2 <7,7,0> 3 <7,3,0> } )

uses the points S(0) = <3,8,0> and S(1) = <3,8,0>, since the first valid
point on a cubic_spline is the second one in the list.

Whoever's maintaining the relevant part of the documentation should make a
note of this.


--
Mark

The Universe is expanding.
The budget for its exploration is shrinking.


Post a reply to this message

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