POV-Ray : Newsgroups : povray.general : povray for isosurfaces plots? (quantum physics) : Re: povray for isosurfaces plots? (quantum physics) Server Time
31 Jul 2024 22:17:51 EDT (-0400)
  Re: povray for isosurfaces plots? (quantum physics)  
From: Chris B
Date: 10 Aug 2006 11:52:00
Message: <44db5620$1@news.povray.org>
"gawryl" <gaw### [at] gmailcom> wrote in message 
news:web.44db4583f98bfec2dcd30180@news.povray.org...
> "Chris B" <c_b### [at] btconnectcomnospam> wrote:
>
>> If you want to draw a surface then it gets a bit more tricky because you
>> need something that's going to work out how to join all of your points
>> together and in which sequence etc. So you'd probably be better off
>> pre-processing the set of points using some external tool to generate a 
>> mesh
>> object that could potentially then be fed into POV-Ray to render.
>>
>> Regards,
>> Chris B.
>
> First of all - thanks for you help ;-)
>
> Yes, I'm thinking about the surface but maybe your idea with points
> (spheres) is also good. So - could you help me and send an example code
> with an answer how to do this?
> My data is 3d grid of real numbers (for simplicity) - feel free to chose
> your own favorite format - i can reorganize my data - and i need to choose
> color of particular sphere at point (x,y,z) as a some functions, witch
> depends of a value of this point f(x,y,z).
>
> regards,
> gawryl
>

Hi Gawryl,

Judging from the responses from Mike and Stephen, df3 sounds like a pretty 
good way to go and would give you a whole range of options for displaying 
your data. If your data is actually a uniform grid rather than a random set 
of points then you should also be able to use some of the mesh generating 
macros available for POV-Ray to generate a surface.

On the other hand, if you just want to generate dots from a set of points 
stored in a CSV file you could do this with a POV-Ray scene file containing 
the following statements:

camera {location <0, 2, -10> look_at <0,2,0>}
light_source { <0, 50, -30> color 1}

#declare Radius = 0.2;

#fopen InputFile "ngtemp125.csv" read

#while (defined(InputFile))
  #read (InputFile, PosX, PosY, PosZ)
  #declare ThisPosition = <PosX, PosY, PosZ>;
  #declare ThisColour   = ThisPosition/4;
  sphere {ThisPosition, Radius pigment {rgb ThisColour}}
#end


This would read a file called 'ngtemp.csv' containing your numbers in sets 
of three, separated by commas.
For example:

1,3,8,
1.8938846629843754,3.2984375429843754,1.9877653387655554,
2.1487437664643754,3.9238757989843754,2.4835774777755554,
3.8938846629843754,4.2984375429843754,3.9877653387655554,

In the case above I've simply based the colour of each sphere upon the 
position of the dot, but it's quite possible to incorporate more 
sophisticated functions to define the colour, or to add the RGB colour 
components to the CSV file and just read six values for each position.

Regards,
Chris B.


Post a reply to this message

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