cmss Listing 1

x = linspace (-1,1,31);

[xx,yy] = meshgrid (x,x);

zz = xx.^2 + yy.^2;

vmesh (zz);

The first three lines define a \( 31\times 31 \) matrix zz containing values of \( x^{2}+y^{2} \) for values of \( x \) and \( y \) regularly sampled in the interval \( \left[ -1,1\right] \). The fourth line visualizes in a separate window a surface representing zz2. By click and dragging the mouse in that new window, you should be able to rotate the object and obtain something as in Figure 1.

The variant :

vmesh (zz,"checker",[5,-2],"col",[1 0 0;0.7 0.7 0.7]');
displays (Figure 2, left) a checkered surface with 5 squares along the X direction squares that are two facets wide along the Y direction. This listing can be run with the command vrml_demo_tutorial_1. Subsequent in this document listings can be called in a similar fashion.



Søren Hauberg 2009-06-07