POV-Ray : Newsgroups : povray.general : Reading from a text file : Re: Reading from a text file Server Time
29 Jul 2024 10:24:55 EDT (-0400)
  Re: Reading from a text file  
From: Scott
Date: 5 Jan 2012 14:15:01
Message: <web.4f05f5b48e1c2e69be8719c80@news.povray.org>
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.


Post a reply to this message

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