POV-Ray : Newsgroups : povray.binaries.images : Is there a spline solution out there? : Re: Is there a spline solution out there? Server Time
1 Oct 2024 22:24:49 EDT (-0400)
  Re: Is there a spline solution out there?  
From: Jerry Anning
Date: 14 Aug 2000 13:19:45
Message: <399828d1.2275552@news.povray.org>
On Mon, 14 Aug 2000 09:04:51 -0400, "Greg M. Johnson"
<gre### [at] my-dejanewscom> wrote:

>I get an error message for subscript out of range when it hits the code:
>
> + Horn(3, Points[Pf + 2])

This shows the perils of cut-and-pasting parts of messy one-off code.
replace the part at the beginning where you set up the Points array
with this:

#declare Dim = 6;  // this means an array of 6 control points

#declare Ptemp = array[Dim]
 { <.1, .5, .9>, <.8, 2, 3> ...} // temp for the control points

#declare Points = array[Dim + 2] // will be actual working points

#declare Points[0] = Ptemp[Dim - 1]; // this and following line
// allow for first and last points properly

#declare Points[Dim + 1] = Ptemp[0];

Discussion:  in most spline types, including these, the first and last
control points are not part of the final curve.  This fixes things so
that *all* of the control points (corners) you provide are part of the
curve and you get the endpoints you expect.  I left this out earlier
because I stupidly confused it with part of the closure code that I
removed.

Jerry Anning
clem "at" dhol "dot" org


Post a reply to this message

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