34d479483c18c33419502f170a26fa604fdeb9a1
1 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
2 // Copyright (C) 2007-2008 - INRIA
3 // Copyright (C) 2010 - DIGITEO - Allan CORNET
4 //
5 // This file is released under the 3-clause BSD license. See COPYING-BSD.
7 function demo_geom3d()
9     my_handle             = scf(100001);
10     clf(my_handle,"reset");
11     demo_viewCode("geom3d.dem.sce");
13     // DEMO START
15     my_plot_desc          = "plot3d and use of geom3d";
16     my_handle.figure_name = my_plot_desc;
18     r = (%pi):-0.01:0;
19     x = r.*cos(10*r);
20     y = r.*sin(10*r);
22     deff("[z]=Surf(x,y)","z=sin(x)*cos(y)");
23     t=%pi*(-10:10)/10;
25     // Plot the surface'
26     fplot3d(t,t,Surf,35,45,"X@Y@Z",[19,2,3]);
28     // Add 2d graphics on 3d graphic'
29     z=(sin(x).*cos(y));
30     [x1,y1] = geom3d(x,y,z);
31     xpoly(x1,y1,"lines");
33     // Adjust some plotting parameters'
34     BackgroundColorId           = color(70,174,255);
35     current_axe                 = gca();
36     plot_3d                     = current_axe.children(2);
37     plot_3d.hiddencolor         = 32;
38     polyline                    = current_axe.children(1)';;
39     polyline.foreground         = 8;
40     current_axe.rotation_angles = [70,47];
41     current_axe.background      = BackgroundColorId;
43     // A second 2d graphics'
44     [x1,y1] = geom3d([0,0],[0,0],[5,0]);
45     xsegs(x1,y1);
46     xstring(x1(1),y1(1),"The point (0,0,0)");
48     xtitle(my_plot_desc," "," "," ");
50     // DEMO END
51 endfunction
54 demo_geom3d();
55 clear demo_geom3d;