POV-Ray : Newsgroups : povray.newusers : How, spline-datas in an array ? : Re: How, spline-datas in an array ? Server Time
29 Jul 2024 06:18:49 EDT (-0400)
  Re: How, spline-datas in an array ?  
From: Chris B
Date: 23 May 2006 16:20:57
Message: <44736ea9$1@news.povray.org>
"Meothuru" <nomail@nomail> wrote in message 
news:web.4472a196f9ef9e2b5ab9a06d0@news.povray.org...
> Hi folks,
>
> in the following script, the stellar constellation
> of "Orion" is drawn by 3 spline-objects.As you can
> see, the while-loops are absolut identical.
>
> Is it possible to define the spline-coordinates in
> a two-dimensional array and let draw the figure by
> one extended loop ?
>

Hi Moethuru,

It is possible, but I can't see that you'd gain much.
You can certainly readily combine the three loops by just using different 
names for each of the splines so that they don't interfere with each other 
in the object definitions.

You could also easily use a one dimensional array to store your splines in, 
for example:
#declare Orion = array [3];
#declare  Orion[0] = spline{linear_spline ....

#declare  Orion[1] = spline{linear_spline ....

#declare  Orion[2] = spline{linear_spline ....

Otherwise, if you really want to you can assign the points to a 2D array 
using something like:
#declare Orion = array [3][8] {
  {<-1.32,3.42 ,1>, ...}
  {<.17,3.15,1>, ... }
  {<-1.3,0.5,1>, ... }
};
Then you could build your splines dynamically within 3 loops (or 2 nested 
loops), but, as I said, I can't see that you'd really gain much by going to 
that extreme.

Regards,
Chris B.


Post a reply to this message

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