|
![](/i/fill.gif) |
"Grobi" <and### [at] boesmann com> wrote in message
news:web.4982c17ba614deff9eb381d30@news.povray.org...
> Hi there,
>
> thanks for your answers.
>
> I have something like 50-100 thousand coordinates, only the x-value is
> incremented in a regular fashion, y and z are a bit random.
>
> I currently have a sphere at every coordinate, which looks nice and is the
> closest to the actual measument.
>
> But how exactly do i convert those coordinates to a mesh (triangles)?
>
> thanks
>
> Andreas
>
You could do that by generating a mesh or a mesh2 object. The mesh2 object
would probably be a little easier, because the syntax allows you to specify
a list of vertex_vectors in the same basic format as for the array of
coordinates. You would then need to specify a list of face_indices, which is
like specifying how to join the dots using triangular faces.
This is where it starts to get tricky. If the points followed a sort of 2D
grid pattern then it's pretty easy to work out a way to join up the dots and
get a continuous surface where the vertices are at the height given by the
3rd dimension of your coordinates. Indeed I think that there are various
macros about that would be able to help you do that for well-defined grid
patterns.
However, if it is only the x-value that is incremental (and that goes up in
fairly chunky steps), then working out a meaningful way to join the dots
becomes quite awkward. One approach would be to take all the <y,z> values
for a particular value of x and sort them on their y value. It would be
possible then to run along the first set of points using a triangle to
connect each point to the next and back to the y-axis. You could process the
second set connecting them back to the nearest vertex on the first set etc.
I suspect this would be quite challenging though, particularly if you're new
to POV-Ray and/or programming in general.
Plan B.
-------
A simpler alternative that sidesteps these problems entirely is to consider
using prism objects instead of meshes. It's a bit of a cheat, but with this
number of points it could give you something that looks fairly similar. This
idea is to basically draw a series of pyramids with their apexes at the
required coordinates. It may therefore trick the viewer, giving the illusion
of forming a coherent mesh-like surface.
The example below uses the original 9 points you posted, but transposes the
y and z coordinates because the section of the prism object needs to be
defined in the x-z plane.
If this doesn't give you what you want, it may be worth posting the image
you made using spheres onto povray.binaries.images. This should at least
give an impression of the sort of point distribution you're working with,
which may inspire other ideas. You might also wish to provide a URL to an
image on the Internet that shows the sort of representation you'd like to
achieve.
Regards,
Chris B.
camera {location <-1,1,-1> look_at <1,0.5,1> }
light_source {<-10,20,-50>, rgb 2}
#declare Data = array [9] {
<20,11.6751,0.071>,
<20,11.6408,0.07>,
<20,11.6066,0.0698>,
<21,11.5724,0.0709>,
<21,11.5382,0.0704>,
<21,11.5039,0.0709>,
<22,11.4697,0.0711>,
<22,11.4355,0.0713>,
<22,11.4012,0.0712>,
};
#declare MyPrism = prism {
linear_spline conic_sweep
-1, 0, 5,
<-0.8, -0.8>,
<+0.8, -0.8>,
<+0.8, +0.8>,
<-0.8, +0.8>,
<-0.8, -0.8>
translate y
}
#local I=0;
#while (I<9)
#declare OneValue = (Data[I]-<20,11.4,0.069>)*<1,10,1000>;
// cylinder {OneValue,OneValue+z,0.1 pigment {rgb OneValue/10}}
object {
MyPrism
pigment {rgb OneValue/10}
translate <OneValue.x,0,OneValue.y>
scale <1,OneValue.z/5,1>
}
#local I=I+1;
#end
plane {y,0 pigment {rgb <1,1,0>}}
Post a reply to this message
|
![](/i/fill.gif) |