|
![](/i/fill.gif) |
> I am new to povray and have been trying to render a surface without much
> success, the surface could not be mathematically represented (will at
> least not
> in one piece) as a function, but I do have the x, y, and z data. How do I
> go
> about rendering this in povray? Joining up bicubic patch objects should
> work
> but I do have a large number of points, the mesh grid is a square one if
> that
> helps. To give an example, say the following is a portion of the surface I
> want
> to render (a saddle point of Z=sin(X*Y). Could anyone point to to the
> right
> direction or give me some sample code to study?
#version 3.6;
#include "colors.inc"
#include "finish.inc"
global_settings {
assumed_gamma 1.0
}
// --- camera, lights &
background ------------------------------------------
camera {
location <0.0, 0.5, -4.0>
direction 1.5*z
right x*image_width/image_height
look_at <0.0, 0.0, 0.0>
}
sky_sphere {
pigment {
gradient y
color_map {
[0.0 Red]
[0.5 Red]
[0.5 White]
[1.0 White]
}
scale 0.05
}
}
light_source {
<-30, 30, -30>
color rgb <1, 1, 1>
}
// ---
macros ---------------------------------------------------------------
#declare XYZdata = array [49]
{<-1.5,-1.5, 0.7781>,<-1,-1.5, 0.9975>,<-0.5,-1.5, 0.6816>,<0,-1.5, 0>,
<0.5,-1.5, -0.6816>, <1.0,-1.5,-0.9975>,<1.5,-1.5, -0.7781>,
<-1.5,-1.0, 0.9975>,<-1,-1.0, 0.8415>,<-0.5,-1.0, 0.4794>,<0,-1.0, 0>,
<0.5,-1.0, -0.4794>, <1.0,-1.0,-0.8415>,<1.5,-1.0, -0.9975>,
<-1.5,-0.5, 0.6816>,<-1,-0.5, 0.4794>,<-0.5,-0.5, 0.2474>,<0,-0.5, 0>,
<0.5,-0.5, -0.2474>, <1.0,-0.5,-0.4794>,<1.5,-0.5, -0.6816>,
<-1.5,0,0>,<-1,0,0>,<-0.5,0,0>,<0,0,0>,<0.5,0,0>, <1.0,0,0>,<1.5,0,0>,
<-1.5,0.5,-0.6816>,<-1,0.5,-0.4794>,<-0.5,0.5,-0.2474>,<0,0.5, 0>,
<0.5,0.5,0.2474>, <1.0,0.5,0.4794>,<1.5,0.5,0.6816>,
<-1.5,1,-0.9975>,<-1,1,-0.8415>,<-0.5,1,-0.4794>,<0,1,0>,<0.5,1,0.4794>,
<1.0,1, 0.8415>,<1.5,1, 0.9975>,
<-1.5,1.5,-0.7781>,<-1,1.5,-0.9975>,<-0.5,1.5,-0.6816>,<0,1.5, 0>,
<0.5,1.5,0.6816>, <1.0,1.5, 0.9975>,<1.5,1.5,0.7781>};
#macro point_cloud(A, r)
#local _pce = dimension_size(A,1);
#local c = 0;
#while (c<_pce)
sphere{A[c],r}
#local c=c+1;
#end
#end
// ---
scene ----------------------------------------------------------------
union {
point_cloud(XYZdata,0.05)
texture {pigment {White} finish {Dull}}
scale 0.5
}
parametric {
function { u }, // x-axis
function { v }, // y-axis
function { sin(u*v) } // z-axis
<-1.5,-1.5>, <1.5,1.5> // <u1,v1>, <u2,v2> limits
contained_by { box { -1.5, 1.5 } }
accuracy 0.005
precompute 15 x,y,z
texture {pigment {Blue}}
scale 0.5
}
Post a reply to this message
|
![](/i/fill.gif) |