POV-Ray : Newsgroups : povray.newusers : Visualization of a sand grain : Re: Visualization of a sand grain Server Time: 20 Jun 2019 07:03:25 GMT
 Re: Visualization of a sand grain
 From: Le Forgeron Date: 2 Apr 2019 16:02:14
```Le 02/04/2019 Ã  08:51, Wallace a Ã©critÂ :
> "Bald Eagle" <cre### [at] netscapenet> wrote:
>> "Wallace" <819### [at] qqcom> wrote:
>>> Hi folks, I am new to the software and this community. I am a year 4 civil
>>> engineering student. To finish my final year project, I am required to learn
>>> this software. I use Pack3D in matlab to generate some particles with a lot of
>>> xyz coordiantes as well as radius from central point. I wonder how could I use
>>> Povray visualize a single particle with lots of x-y-z coordinate. I cant find
>>> the correct coding for my visualization. Hope can find some help here. Thank
>>> you!
>>
>> Write the <x,y,z> vector and radius to a file.
>> Read in the values, generate a sphere of that radius at that point.
>> loop.
>> Could you explain more in details?

> Since I have no coding background before, I have to start from zero. The data I go
> t from matlab is a particle with 162 points, a list of xyz coordinates and the
distance between every point and the cen
> tral point of the particle. I wonder any coding example that i could refer to?

Sound like you want to see the hull of the points around the central
point... connecting the cloud of points back to make a surface...

Something I would rather try in meshlab, because the involved
algorithm(s) to select the "right" neighbours of a point to make a
triangle is a vast field (something specialized software for 3D scanners
have to do, as part of reconstruction of the mesh from the scanned points).

Are the 162 points ordered in any way ? or do you have to assume they
are random ?

(povray supports up to 5D vector, so xyz + distance fits easily in 4D array)

#declare MyPoint=array[162];

// and here come the hope the points are in a file as
// "X, Y, Z, Distance" one point per line
#local Entry = 0;
#local XValue = 0;
#local YValue = 0;
#local ZValue = 0;
#local DistanceValue = 0;
#while(Entry<162)
#read (MyDataFile, XValue, YValue, ZValue, DistanceValue)
#declare MyPoint[Entry] = < XValue, YValue, ZValue, DistanceValue >;
#declare Entry = Entry + 1;
#end

#fclose MyDataFile

This would not show any shape so far, but you could then use the SDL to
manipulate your data for further operations.

http://wiki.povray.org/content/Reference:File_I/O_Directives

>> Points for style would be to figure out where the camera should be located to
>> make sure all the spheres are in the raytraced image.
>>
>>
>> This has been covered before, and I replied rather frequently to Ari -
>> Thank you so much for your help.
>>