POV-Ray : Newsgroups : povray.windows : How to generate sphere and cylinder with csv file Server Time
21 Jun 2021 12:21:30 EDT (-0400)
  How to generate sphere and cylinder with csv file (Message 11 to 20 of 31)  
<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>
From: Bald Eagle
Subject: Re: How to generate sphere and cylinder with csv file
Date: 30 Mar 2017 07:40:00
Message: <web.58dcedd1ae95604bc437ac910@news.povray.org>
In the wee hours, I was thinking it would be nice to be able to generate a
Delaunay triangulation of data like this.


Post a reply to this message

From: Jeff
Subject: Re: How to generate sphere and cylinder with csv file
Date: 30 Mar 2017 13:05:01
Message: <web.58dd3a58ae95604b653b97b10@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> Here ya go.
>
> Pay attention to the data format (see comments)
>
> Needs scaling to fit (a) on the screen better and (b) on top of your image to
> match locations
>
> Better code would have methods built in to catch and reject erroneous data, etc.
>
> But here are the basics.
>
> =========================================================================
>
> // Persistence of Vision Ray Tracer version 3.7
> // Scene Description Language (SDL)
> //      File: Latitude / Longitude Mapping
> //      Version: 1.0
> //      Last updated: 29-Mar-2017
> //      Description: Read Latitude and Longitude from file and connect points on
> map
> //
> // Author:   Bill Walker "Bald Eagle", 2017
> // email:    see posts in news.povray.org
> //
> //------------------------------------------------------------------------
>
> #version 3.7;
>
> global_settings {
>  assumed_gamma 1.0
>  #default {texture {pigment {rgb <1, 1, 1>} finish {ambient 1}}}
>  ambient_light rgb <1, 1, 1> // <======== flat, even illumination
> }
>
> #include "colors.inc"
>
> camera {
>  location <0, 0, -1>
>  right    x*image_width/image_height
>  look_at <0, 0, 0>
> }
>
> light_source{ <50, 50, -100>  color rgb <1, 1, 1>}
>
> // #declare EarthRadius = 6367; //radius in km
> #declare EarthRadius = 6367*0.621371; //radius in mi
>
> #macro S2C (Spherical)
>  // input - 2d vector: <Latitude, Longitude>
>  #local Lat = radians (Spherical.x);
>  #local Lon = radians (Spherical.y);
>  #local X = EarthRadius * cos(Lat) * cos(Lon);
>  #local Y = EarthRadius * cos(Lat) * sin(Lon);
>  #local Z = EarthRadius * sin(Lat);
>  #local Cartesian = <X, Y, Z>;
>  Cartesian;
> #end // end macro S2C
>
>
> #macro C2S (Cartesian)
>
>  #local R = sqrt(pow(Cartesian.x, 2) * pow(Cartesian.y, 2) * pow(Cartesian.z,
> 2));
>  #local Lat = degrees (asin (Cartesian.z / R));
>  #local Lon = degrees (atan2 (Cartesian.y, Cartesian.x));
>  #local LatLon = <Lat, Lon>;
>  LatLon;
> #end // end macro C2S
>
> //  data format: "bus", "CN/Beijing", "bus2382659521", 116.4093833, 39.9067192,
> //    etc.
> #declare Type = "";
> #declare Location = "";
> #declare ID = "";
> #declare Latitude = 0;
> #declare Longitude = 0;
>
> // count locations for sizing array
> #declare Locations = 0;
> #fopen DataFile "LatLongData.txt" read
> #while (defined (DataFile))
>  #read (DataFile, Type, Location, ID, Latitude, Longitude)
>  #declare Locations = Locations + 1;
> #end
> #fclose DataFile
>
> #declare _Type = array[Locations];
> #declare _Location = array[Locations];
> #declare _ID = array[Locations];
> #declare _Latitude = array[Locations];
> #declare _Longitude = array[Locations];
> #declare _XYZ = array[Locations];
>
> // input data into array
> #declare Datapoint = 0;
> #fopen DataFile "LatLongData.txt" read
> #while (defined (DataFile))
>  #read (DataFile, Type, Location, ID, Latitude, Longitude)
>
>  #declare _Type [Datapoint] = Type;
>  #declare _Location [Datapoint] = Location;
>  #declare _ID [Datapoint] = ID;
>  #declare _Latitude [Datapoint] = Latitude;
>  #declare _Longitude [Datapoint] = Longitude;
>  #declare _XYZ [Datapoint] = S2C (<_Latitude[Datapoint],
> _Longitude[Datapoint]>);
>  #declare Datapoint = Datapoint + 1;
> #end
> #fclose DataFile
>
> #declare Marker = 0.25;
> #declare Line = 0.05;
> #declare Linecolor = pigment {Magenta};
>
> #for (Point, 0, Locations-1)
>
>  #if (Type = "bus")
>   #declare Color = pigment {Red};
>  #elseif (Type = "subway")
>   #declare Color = pigment {Green};
>  #elseif (Type = "rail")
>   #declare Color = pigment {Blue};
>  #elseif (Type = "tram")
>   #declare Color = pigment {Yellow};
>  #else
>   #debug "Unidentified Location Type.  \n"
>   #declare Color = pigment {White};
>  #end
>
>  #declare S = 1; //<0.1, 0.1, 1/4000>;
>  #declare T = <1350, 1130, -3500>;
>
>  sphere {0, Marker pigment {Color} translate _XYZ[Point]*S translate T}
>
>  #if (Point > 0)
>   cylinder {LastPoint*S, _XYZ[Point]*S, Line pigment {Linecolor} translate T}
>  #end // end if
>
>  #debug concat( "Vector = ", vstr(3, _XYZ[Point]*S, ", ", 3, 0), " \n")
>
>  #declare LastPoint = _XYZ[Point];
>
> #end // end for Point

Thank you so much, really appreciate it :)


Post a reply to this message

From: Alain
Subject: Re: How to generate sphere and cylinder with csv file
Date: 30 Mar 2017 16:19:13
Message: <58dd6841$1@news.povray.org>
> Here ya go.
>
> Pay attention to the data format (see comments)
>
> Needs scaling to fit (a) on the screen better and (b) on top of your image to
> match locations
>
> Better code would have methods built in to catch and reject erroneous data, etc.
>
> But here are the basics.
>
> =========================================================================
>
> // Persistence of Vision Ray Tracer version 3.7
> // Scene Description Language (SDL)
> //      File: Latitude / Longitude Mapping
> //      Version: 1.0
> //      Last updated: 29-Mar-2017
> //      Description: Read Latitude and Longitude from file and connect points on
> map
> //
> // Author:   Bill Walker "Bald Eagle", 2017
> // email:    see posts in news.povray.org
> //
> //------------------------------------------------------------------------
>
> #version 3.7;
>
> global_settings {
>  assumed_gamma 1.0
>  #default {texture {pigment {rgb <1, 1, 1>} finish {ambient 1}}}
>  ambient_light rgb <1, 1, 1> // <======== flat, even illumination
> }
>
This is the default value for ambient_lights. So, it's prety useless for 
what you want to do.

Beter to use :
#default{finish{ambient 1 diffuse 0}}
This statement is not a in it's place inside the global_settings block.

Even beter. Don't play with ambient, but, instead, use the +q0 switch.
With that switch, all lights are ignored, as well as reflections and 
refraction, only full ambient pigments are used.
You also get the advantage that it render faster.


Post a reply to this message

From: Jeff
Subject: Re: How to generate sphere and cylinder with csv file
Date: 1 Apr 2017 01:50:00
Message: <web.58df3f01ae95604b653b97b10@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> In the wee hours, I was thinking it would be nice to be able to generate a
> Delaunay triangulation of data like this.

Hi, i want to a question.
1. is it possible to use pictures as a plane ? so, i want to use the pictures as
the layers, but because i have 4 mode in this file, i need 4 layers for it.
so, each layer will have their own picture as the plane.

example picture:
https://www.google.com/search?q=multi-layer+networks&source=lnms&tbm=isch&sa=X&ved=0ahUKEwiu9YLwxoLTAhUOwGMKHdU9CTsQ_AU
IBigB&biw=1536&bih=724

i want to have 4 vertical layers and align to each other.


Post a reply to this message

From: Jeff
Subject: Re: How to generate sphere and cylinder with csv file
Date: 1 Apr 2017 02:05:00
Message: <web.58df4252ae95604b653b97b10@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> In the wee hours, I was thinking it would be nice to be able to generate a
> Delaunay triangulation of data like this.

another question is , is it possible to rotate, zoom in and zoom out freely in
POV-RAY?

i mean, when you have thousands or even millions nodes and links and its so many
of em, that you need to put your camera far far away, but then the nodes and
links are sooooo small.

so, how to deliver the information effectively that people can see all of the
nodes and links, but at the same time its not too small (or too hard) to see?
is there any solutions to solve this problem in POV-RAY?

so, how did you do it in your experience that you have done it with millions of
em?


Post a reply to this message

From: Stephen
Subject: Re: How to generate sphere and cylinder with csv file
Date: 1 Apr 2017 03:17:22
Message: <58df5402$1@news.povray.org>
On 4/1/2017 6:47 AM, Jeff wrote:
> "Bald Eagle" <cre### [at] netscapenet> wrote:
>> In the wee hours, I was thinking it would be nice to be able to generate a
>> Delaunay triangulation of data like this.
>
> Hi, i want to a question.
> 1. is it possible to use pictures as a plane ? so, i want to use the pictures as
> the layers, but because i have 4 mode in this file, i need 4 layers for it.
> so, each layer will have their own picture as the plane.
>
> example picture:
>
https://www.google.com/search?q=multi-layer+networks&source=lnms&tbm=isch&sa=X&ved=0ahUKEwiu9YLwxoLTAhUOwGMKHdU9CTsQ_AU
> IBigB&biw=1536&bih=724
>
> i want to have 4 vertical layers and align to each other.
>
>
>
I use a very thin box instead of a plane and an image_map.

Or you can use a polygon. (From help file)


polygon {
   4,
   <0, 0>, <0, 1>, <1, 1>, <1, 0>
   texture {
     finish { ambient 1 diffuse 0 }
     pigment { image_map { gif "test.gif"  } }
     }
   //scale and rotate as needed here
   }


-- 

Regards
     Stephen


Post a reply to this message

From: clipka
Subject: Re: How to generate sphere and cylinder with csv file
Date: 1 Apr 2017 03:39:38
Message: <58df593a@news.povray.org>
Am 01.04.2017 um 09:17 schrieb Stephen:
> On 4/1/2017 6:47 AM, Jeff wrote:
>> "Bald Eagle" <cre### [at] netscapenet> wrote:
>>> In the wee hours, I was thinking it would be nice to be able to
>>> generate a
>>> Delaunay triangulation of data like this.
>>
>> Hi, i want to a question.
>> 1. is it possible to use pictures as a plane ? so, i want to use the
>> pictures as
>> the layers, but because i have 4 mode in this file, i need 4 layers
>> for it.
>> so, each layer will have their own picture as the plane.
>>
>> example picture:
>>
https://www.google.com/search?q=multi-layer+networks&source=lnms&tbm=isch&sa=X&ved=0ahUKEwiu9YLwxoLTAhUOwGMKHdU9CTsQ_AU
>>
>> IBigB&biw=1536&bih=724
>>
>> i want to have 4 vertical layers and align to each other.
>>
>>
>>
> I use a very thin box instead of a plane and an image_map.
> 
> Or you can use a polygon. (From help file)

Or use a plane, and use the `once` flag on the image (preventing it from
repeating, and making the rest of the plane transparent) and `use_alpha
on` in the finish (preventing specular highlights from showing up in the
transparent portion).


Post a reply to this message

From: clipka
Subject: Re: How to generate sphere and cylinder with csv file
Date: 1 Apr 2017 03:47:47
Message: <58df5b23$1@news.povray.org>
Am 01.04.2017 um 08:01 schrieb Jeff:
> "Bald Eagle" <cre### [at] netscapenet> wrote:
>> In the wee hours, I was thinking it would be nice to be able to generate a
>> Delaunay triangulation of data like this.
> 
> another question is , is it possible to rotate, zoom in and zoom out freely in
> POV-RAY?
> 
> i mean, when you have thousands or even millions nodes and links and its so many
> of em, that you need to put your camera far far away, but then the nodes and
> links are sooooo small.
> 
> so, how to deliver the information effectively that people can see all of the
> nodes and links, but at the same time its not too small (or too hard) to see?
> is there any solutions to solve this problem in POV-RAY?

So you want to render not to a static image, but rather to /some/ output
file format that allows for free manipulation of the camera angle?


As for zooming in, that's easy: Just render a humongously large image.

As for rotating the camera around the scene, that's tricky. I think some
sites that let you see a product in 3D actually fake this feature by
technically showing a paused movie, and letting the user jog forward and
backward through the movie.


Post a reply to this message

From: Bald Eagle
Subject: Re: How to generate sphere and cylinder with csv file
Date: 1 Apr 2017 15:25:00
Message: <web.58dffd74ae95604b80403a200@news.povray.org>
"Jeff" <jef### [at] gmailcom> wrote:

You just need to hit F1 and type in image_map.
or search around the web
http://www.joshuarenglish.com/cyclopedia/image_planar.html
http://www.f-lohmueller.de/pov_tut/tex/tex_870e.htm


> another question is , is it possible to rotate, zoom in and zoom out freely in
> POV-RAY?

Of course.  Read the docs on the camera {}
You can zoom in, out, rotate, pan, translate, change camera angle, and use all
sorts of different camera types other than the usual perspective camera.

> i mean, when you have thousands or even millions nodes and links and its so many
> of em, that you need to put your camera far far away, but then the nodes and
> links are sooooo small.

Yes, that's a problem with a whole field of study - presentation, analysis, and
visualization of multidimensional data.

> so, how to deliver the information effectively that people can see all of the
> nodes and links, but at the same time its not too small (or too hard) to see?
> is there any solutions to solve this problem in POV-RAY?

There's the size of the nodes, the thickness of the connecting lines, the
contrast between those and the background, etc.

> so, how did you do it in your experience that you have done it with millions of
> em?

Well, you have to determine what you want to show, and why.
Then you have to do the math to place the camera and adjust the view angle and
zoom.

I'd work on just getting the simple overlays to look good, as that will likely
take some time to get scaled and transparently overlaid properly.
Then see how all the data points look once they're all plotted on the map(s)


Post a reply to this message

From: Jeff
Subject: Re: How to generate sphere and cylinder with csv file
Date: 6 Apr 2017 01:05:00
Message: <web.58e5cc16ae95604b653b97b10@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> "Jeff" <jef### [at] gmailcom> wrote:
>
> You just need to hit F1 and type in image_map.
> or search around the web
> http://www.joshuarenglish.com/cyclopedia/image_planar.html
> http://www.f-lohmueller.de/pov_tut/tex/tex_870e.htm
>
>
> > another question is , is it possible to rotate, zoom in and zoom out freely in
> > POV-RAY?
>
> Of course.  Read the docs on the camera {}
> You can zoom in, out, rotate, pan, translate, change camera angle, and use all
> sorts of different camera types other than the usual perspective camera.
>
> > i mean, when you have thousands or even millions nodes and links and its so many
> > of em, that you need to put your camera far far away, but then the nodes and
> > links are sooooo small.
>
> Yes, that's a problem with a whole field of study - presentation, analysis, and
> visualization of multidimensional data.
>
> > so, how to deliver the information effectively that people can see all of the
> > nodes and links, but at the same time its not too small (or too hard) to see?
> > is there any solutions to solve this problem in POV-RAY?
>
> There's the size of the nodes, the thickness of the connecting lines, the
> contrast between those and the background, etc.
>
> > so, how did you do it in your experience that you have done it with millions of
> > em?
>
> Well, you have to determine what you want to show, and why.
> Then you have to do the math to place the camera and adjust the view angle and
> zoom.
>
> I'd work on just getting the simple overlays to look good, as that will likely
> take some time to get scaled and transparently overlaid properly.
> Then see how all the data points look once they're all plotted on the map(s)


Hi, when i try to run the code it says "Parse Error: Expected'float,vector,or
string literal', string identifier found instead".

do you know what cause the problem?


Post a reply to this message

<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>

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