|  |  | [running Windows 10]
(This might be old news?)
I was playing with splines recently, and came across a strange quirk when using
negative 'index' or parameter values for some of the points: Apparently, a comma
separator is needed after those points (otherwise a fatal error when the spline
is parsed), whereas positive-parameter points need no commas. This occurs in
both v3.7.0 and 3.8 beta 1. (As far as I know, there is no caveat or restriction
about creating points with negative index values.) The type of spline used--
linear, cubic etc-- has no effect on this behavior.
The documentation at "3.3.1.11 Spline" is somewhat unclear as to a *requirement*
for commas between separate points:
"The first item gives the type of interpolation [linear, cubic, etc]...
Following this are a number of float values each followed by a position vector,
all separated by commas." But the spline example there uses no comma separators,
and my own experience is that that are usually not needed.
With negative-index points, there appears to be a pattern(?) to the behavior.
Some examples:
This spline has only ONE negative-index point-- and parses OK as-is; no commas
between the points are needed:
#declare MY_SP_1 =
spline{
     natural_spline
    -0.3, < .3, .6, .5 >
     0, < -.52, -.36, -.59>
     0.5, < -1.0, .27, .68>,
     1.0, < .6, -.95, -.15>
     2.0, < -.75, -.52, -1.5>
     2.7, <.3,.5,2>
 }
This has TWO negative index points-- a comma is required after
the FIRST point only:
#declare MY_SP_2 =
spline{
     linear_spline
    -0.45, <.1,.3,-.1>,
    -0.3, < .3, .6, .5 >
     0, < -.52, -.36, -.59>
     0.5, < -1.0, .27, .68>
     1.0, < .6, -.95, -.15>
     2.0, < -.75, -.52, -1.5>
     2.7, <.3,.5,2>
 }
This one has TWO negative index points at the beginning (as above), plus
another one later-- a comma is required  after the FIRST point and another
*before* the later negative-index.
#declare MY_SP_3 =
spline{
     cubic_spline
   -0.45, <.1,.3,-.1>,
   -0.3, < .3, .6, .5 >
    0, < -.52, -.36, -.59>
    0.5, < -1.0, .27, .68>, // comma needed here, preceding the next
                            // negative index
   -1.0, < .6, -.95, -.15>
    2.0, < -.75, -.52, -1.5>
    2.7, <.3,.5,2>
 }
This one has THREE negative index points-- commas are required after the FIRST
and SECOND points:
#declare MY_SP_4 =
spline{
     cubic_spline
    -0.6, <.2,.1,.3>,
    -0.45, <.1,.3,-.1>,
    -0.3, < .3, .6, .5 >
     0, < -.52, -.36, -.59>
     0.5, < -1.0, .27, .68>
     1.0, < .6, -.95, -.15>
     2.0, < -.75, -.52, -1.5>
     2.7, <.3,.5,2>
 }
Post a reply to this message
 |  |