POV-Ray : Newsgroups : povray.general : #reading Vectors Server Time
26 Nov 2024 05:50:47 EST (-0500)
  #reading Vectors (Message 1 to 2 of 2)  
From: Some Yahoo
Subject: #reading Vectors
Date: 12 Jul 2011 22:04:51
Message: <4e1cfd43$1@news.povray.org>
I'm trying to #read an array of vectors.

This is odd, but the first row reads OK, but the second row reads the "x" as a float,
and then barfs with a...

Attempted to redefine a vector identifier as a float identifier.

heres the code...

#if (file_exists(datafile) )
    #debug "FILE EXISTS\n"
//read DATAFILE
   #fopen MyFile datafile read

   #declare i=0;
   #while (i<ballcount)
     #declare loc=<0,0,0>;
     #declare vel=<0,0,0>;
     #declare col=<0,0,0>;

     #debug concat(" reading ",str(i,5,0),"\n")
     #read(MyFile, loc,vel,col)

     #debug "\nLOCATION  "
     #debug vstr(3, loc, ",", 0,1)
     #debug " VELOCITY "
     #debug vstr(3, vel, ",", 0,1)
     #debug " COLOR    "
     #debug vstr(3, col, ",", 0,1)
     #debug "\n"



     #declare locations[i]=loc;
     #declare velocities[i]=vel;
     #declare colors[i]=col;


     #declare i=i+1;
   #end

   #fclose MyFile


#else


---------
here's the first 2 lines of data...


<-7.02064,-1.15909,14.9307> , <4.75732,-1.34518,4.37984> ,
<0.297774,0.71896,0.0969344>
<11.3354,2.57253,0.0310413> , <4.6581,3.18916,0.0764248> ,
<0.438586,0.236457,0.970929>


---------
...and here's the debug stream.

FILE EXISTS
  reading     0

LOCATION  -7.0,-1.2,14.9 VELOCITY 4.8,-1.3,4.4 COLOR    0.3,0.7,0.1
  reading     1

LOCATION  11.3,0.0,0.0 VELOCITY 2.6,0.0,0.0 COLOR    0.0,0.0,0.0
File: C:\Documents and Settings\Bryan Valencia\My
Documents\POV-Ray\v3.6\scenes\collisions\collisions.pov  Line: 79
File Context (5 lines):
     #declare locations[i]=loc;
     #declare velocities[i]=vel;
     #declare colors[i]=col;

     #declare i=i+1;

Parse Error: Attempted to redefine vector identifier as float identifier.


Post a reply to this message

From: Some Yahoo
Subject: Re: #reading Vectors
Date: 12 Jul 2011 22:09:36
Message: <4e1cfe60$1@news.povray.org>
Never mind I got it... I need a comma at the end of each line in the data file.


Post a reply to this message

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