POV-Ray : Newsgroups : povray.windows : How to generate sphere and cylinder with csv file : Re: How to generate sphere and cylinder with csv file Server Time
13 Oct 2024 00:25:08 EDT (-0400)
  Re: How to generate sphere and cylinder with csv file  
From: Jeff
Date: 28 Mar 2017 07:25:00
Message: <web.58da47d9ae95604b4de507a60@news.povray.org>
From: "Jeff" <jef### [at] gmailcom>
Newsgroups: povray.windows
Subject: Re: How to generate sphere and cylinder with csv file

"Bald Eagle" <cre### [at] netscapenet> wrote:
> So, real quick,
>
> #include "colors.inc"
> #if (variable = "bus")
>   #declare Color = pigment {Red};
> #else if (variable2 = "rail")
>
> #else
> #end
>
> Write your data to a text file, use the #open, #read directives to read the
> values in.
>
> #declare a Y variable as that value.
> same for the Z variable  (notice both are Uppercase)
>
> searching for:  #read #write data from file
> pulls up the following, with lots more
>
>http://news.povray.org/povray.general/thread/%3Cweb.4d05993a67d8c71bd6b9b2630@news.povray.org%3E/?ttop=357624&toff=50
>
>
http://news.povray.org/povray.general/thread/%3Cweb.43886ab1919621bdcce6fd2b0@news.povray.org%3E/?ttop=330491&toff=13
50

>
> Don't worry about the length, just use the coordinates of the 2 spheres as the
> endpoint coordinates of the cylinder.
>
> You're probably going to have to convert your values from long/lat to some
> meaningful x,y,z coordinates (polar to Cartesian)

hi, if i open the .csv file , and save it as .txt file, will that do the
conversion? and i have like 1000+ sphere that i need to generate from the data,
is there any efficient way to do it, instead of write down the sphere position?
so, is this the way to do it? hey, i want to talk more detail about, and i need
your help. here is my email: jef### [at] gmailcom. thanks before :)


#include "colors.inc"
#declare myImage = image{ png "C:\\Users\\Jeff\\Desktop\\beijing.png" }

#fopen nodesfile "nodes.txt" read
#fopen linksfile "links.txt" read
  #while (defined(nodesfile))
    #read (nodesfile,Var1,Var2,Var3,Var4)


#if (Var1 = "bus")
    #declare Color = pigment {Red};
#else if (Var2 = "subway")
    #declare Color = pigment {Green};
#else if (Var3 = "rail")
    #declare Color = pigment {Blue};
#else (Var4 = "tram")
    #declare Color = pigment {Yellow};
#end

camera
{ location <0,0,-10>
  look_at 0
  rotate <0,clock*360,0>
}

light_source    {
                <10,10,-10>
                color White
                }


Post a reply to this message

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