]> Creatis software - CreaPhase.git/blob - octave_packages/vrml-1.0.13/test_vmesh.m
Add a useful package (from Source forge) for octave
[CreaPhase.git] / octave_packages / vrml-1.0.13 / test_vmesh.m
1 ## Copyright (C) 2002 Etienne Grossmann <etienne@egdn.net>
2 ##
3 ## This program is free software; you can redistribute it and/or modify it under
4 ## the terms of the GNU General Public License as published by the Free Software
5 ## Foundation; either version 3 of the License, or (at your option) any later
6 ## version.
7 ##
8 ## This program is distributed in the hope that it will be useful, but WITHOUT
9 ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
11 ## details.
12 ##
13 ## You should have received a copy of the GNU General Public License along with
14 ## this program; if not, see <http://www.gnu.org/licenses/>.
15
16 ###key test_vmesh
17 ##
18 ## Test vmesh.m
19
20 printf ("test_vmesh : \nDisplay a surface.\n");
21
22 R = 41;
23 C = 26;
24
25 [x,y] = meshgrid (linspace (-1,1,C), linspace (-1,1,R));
26
27 z = (cos (x*2*pi) + y.^2)/3;
28
29 vmesh (z);
30 printf ("Press a key.\n"); pause;
31
32
33 printf ("The same surface, with holes in it.\n");
34
35 z(3,3) = nan;                   # Bore a hole
36                                 # Bore more holes
37 z(1+floor(rand(1,5+R*C/30)*R*C)) = nan;
38
39                                 # Try texture as a file, an "ims" or a
40                                 # matrix. 
41 ## tex = "octave-mylib/tools/imgio/test_images/test_col.xpm";
42 ## tex = ims_load ("octave-mylib/tools/imgio/test_images/test_col.jpg");
43 ## tex = kron (ones (4),eye(2));
44
45 vmesh (z);
46
47 printf ("Press a key.\n"); pause;
48
49 printf (["The same surface, with checkered stripes ",\
50          "(see the 'checker' option).\n"]);
51
52 vmesh (z,"checker",-[6,5]);
53
54 printf ("Press a key.\n"); pause;
55
56 printf (["The same surface, with z-dependent coloring (see 'zrb', 'zgrey'\n",\
57          "  and 'zcol' options)\n"]);
58
59 vmesh (z,"zrb");
60
61 printf ("That's it!\n");
62
63
64