|
|
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
|
|