]> Creatis software - CreaPhase.git/blob - octave_packages/vrml-1.0.13/vrml_demo_tutorial_1.m
Add a useful package (from Source forge) for octave
[CreaPhase.git] / octave_packages / vrml-1.0.13 / vrml_demo_tutorial_1.m
1 ## Copyright (C) 2002-2009 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 printf (["\n",\
17          "    VRML Mini-HOWTO's first listing\n",\
18          "    Display a quadratic surface w/ 31 x 31 points\n\n"]);
19
20 printf (["    Reminder of FreeWRL keystrokes and mouse actions :\n"\
21          "      q : quit\n",\
22          "      w : switch to walk mode\n",\
23          "      e : switch to examine mode\n",\
24          "      h : toggle headlights on or off\n",\
25          "      drag left mouse : rotate (examine mode) or translate\n",\
26          "          (walk mode).\n",\
27          "      drag right mouse : zoom (examine mode) or translate\n",\
28          "          (walk mode).\n",\
29          "\n"]);
30
31 ## Listing 1
32
33 x = linspace (-1,1,31);
34
35 [xx,yy] = meshgrid (x,x);
36
37 zz = xx.^2 + yy.^2;
38
39 vmesh (zz);
40
41 ## Variant of listing 1
42
43 printf ("    Hit a key to see the variant of listing 1\n\n");
44
45 pause
46
47 vmesh (zz,"checker",[5,-2],"col",[1 0 0;0.7 0.7 0.7]', "emit",0);
48
49 vmesh (zz,"checker",[5,-2],"col",[1 0 0;0.7 0.7 0.7]', "emit",0);
50
51 printf ("    Another one, just with 7 x 7 points\n");
52
53 x = linspace (-1,1,7);
54
55 [xx,yy] = meshgrid (x,x);
56
57 zz = 2 - xx.^2 - yy.^2;
58
59 printf ("    Now, with steps, then barss\n");
60
61 vmesh (zz);
62
63 vmesh (zz,"steps");
64
65 vmesh (zz,"bars");