s = vmesh (x, y, z [, options] ) - Visualize a 3D surface
s = vmesh (z [, options] )
Visualizes a 3D surface. Returns the VRML code.
x : RxC or C : X coordinates of the points on the surface
y : RxC or R : Y " "
z : RxC : Z " "
s : string : The code
If x and y are omitted, they are assumed to be linspace(-1,1,C or R).
Points presenting one or more 'inf' or 'nan' coordinates are ignored.
Options : (all options of vrml_surf may be used too)
"col" , col : 3 : RGB Color, Default = [0.3,0.4,0.9]
or 3x(R*C): Color of vertices (vrml colorPerVertex is TRUE).
or 3x((R-1)*(C-1))
: Color of facets
or 1 : Reflectivity (equivalent to [col,col,col] in RGB)
or R x C : Reflectivity of vertices
or 1x(R*C)
or (R-1)x(C-1)
or (R-1)*(C-1)
: Reflectivity of facets.
RGB and reflectivity values should be in the [0,1] interval.
"checker", c : 1x2 : Color as a checker. If c(1) is positive, checker has
c(1) rows. If it is negative, each checker row is
c(1) facets high. c(2) does the same for columns.
or 1x1 : Same as [c,c].
"zgray" : Color varies from black for lowest point to white
for highest.
"zrb" : Color varies from blue for lowest point to red for
highest.
"zcol", zcol : Mx3 : Color is linearly interpolated between the RGB
values specified by the rows of zcol.
"steps" : Represent surface as a piecewise constant Z = f(X,Y)
function
"bars" : Represent surface as a bar plot
"bwid" : Bar width, relative to point separation. Default = 2/3
"level", l : 1xN : Display one or more horizontal translucent plane(s)
z == l(i) (1 <= i <= length(l))
"lcol", lc : Nx3 : Color of the plane(s). Default = [.7 .7 .7]
"ltran",lt : Nx1 : Transparency of the plane(s). Default = 0.3
"tex", texFile
"normalize" : Normalize z to [-1,1]
See also: vrml_surf(), vrml_faces(), demo("vmesh")
The following code
% Test the vmesh and vrml_browse functions with the test_vmesh script
R = 41; C = 26;
[x,y] = meshgrid (linspace (-8+eps,8+eps,C), linspace (-8+eps,8+eps,R));
z = sin (sqrt (x.^2 + y.^2)) ./ (sqrt (x.^2 + y.^2));
vmesh (z);
printf ("Press a key.\n"); pause;
############## The same surface, with holes (NaN's) in it. ###############
z(3,3) = nan; # Bore a hole
# Bore more holes
z(1+floor(rand(1,5+R*C/30)*R*C)) = nan;
vmesh (z);
printf ("Press a key.\n"); pause;
###### The same surface, with checkered stripes - 'checker' option ######
vmesh (z,"checker",-[6,5]);
printf ("Press a key.\n"); pause;
##### With z-dependent coloring - 'zrb', 'zgray' and'zcol' options. #####
vmesh (z,"zrb");
printf ("That's it!\n");
Produces the following output
cmd = freewrl /tmp/octave_vrml_output.wrl Press a key. cmd = freewrl /tmp/octave_vrml_output.wrl Press a key. cmd = freewrl /tmp/octave_vrml_output.wrl Press a key. cmd = freewrl /tmp/octave_vrml_output.wrl That's it!
Package: vrml