|
![](/i/fill.gif) |
> Thank you both Thomas and Bill for your comments.
>
> I came up with 2 versions that work. One defines an array for the points, and
> the other seems to work just as well without it.
>
> Here are the 2 versions.
>
> 1) No array
>
> #fopen MyFile "Set_of_PointsXYZ.txt" read
>
> #local i = 0;
> #while (defined(MyFile))
> #read (MyFile,Vector)
> sphere { Vector, 0.1
> texture {
> pigment{ rgb<1,0,0>}
> finish { Substance }}}
> #local i = i + 1;
> #end
>
> 2) Using an array
>
> #declare Vector = array[100000];
> #fopen MyFile "Set_of_PointsXYZ.txt" read
> #local i = 0;
> #while (defined(MyFile))
> #local Vector [i] =<0,0,0>;
> #read (MyFile,Vector[i])
> sphere { Vector[i], 0.1
> texture {
> pigment{ rgb<1,0,0>}
> finish { Substance }}}
>
> Again, thanks so much for your assistance.
>
>
Unless you plan having each spheres painted with different textures, you
should use an union and aply the texture to the union as a whole.
Using your non-array solution, it gives this:
#fopen MyFile "Set_of_PointsXYZ.txt" read
#declare DotedSphere=
union{
#while (defined(MyFile))
#read (MyFile,Vector)
sphere { Vector, 0.1}
#end
texture{pigment{rgb<1,0,0>}finish{Substance}}
}
Faster to parse as it uses less statements and takes less place in
memory. If you have 100000 points or more, the memory requirement can
become an isue.
It may also be faster to render.
You can #declare the union and use it in more than one place.
Alain
Post a reply to this message
|
![](/i/fill.gif) |