Mercurial > hg > octave-lyh
annotate scripts/plot/trimesh.m @ 13123:6efa1a691713
Add further tests for scripts/plot.
plot/close.m: Tests added.
plot/gca.m, plot/gcbf.m, plot/gcbo.m, plot/hggroup.m, plot/isfigure.m: Ditto.
plot/gtext.m, plot/ginput.m: Dummy test added.
author | Kai Habel <kai.habel@gmx.de> |
---|---|
date | Sun, 11 Sep 2011 18:24:58 +0200 |
parents | dc29b64668fa |
children | e8564e8b0043 |
rev | line source |
---|---|
11523 | 1 ## Copyright (C) 2007-2011 David Bateman |
6823 | 2 ## |
3 ## This file is part of Octave. | |
4 ## | |
5 ## Octave is free software; you can redistribute it and/or modify it | |
6 ## under the terms of the GNU General Public License as published by | |
7016 | 7 ## the Free Software Foundation; either version 3 of the License, or (at |
8 ## your option) any later version. | |
6823 | 9 ## |
10 ## Octave is distributed in the hope that it will be useful, but | |
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 ## General Public License for more details. | |
14 ## | |
15 ## You should have received a copy of the GNU General Public License | |
7016 | 16 ## along with Octave; see the file COPYING. If not, see |
17 ## <http://www.gnu.org/licenses/>. | |
6823 | 18 |
19 ## -*- texinfo -*- | |
10793
be55736a0783
Grammarcheck the documentation from m-files.
Rik <octave@nomad.inbox5.com>
parents:
10549
diff
changeset
|
20 ## @deftypefn {Function File} {} trimesh (@var{tri}, @var{x}, @var{y}, @var{z}) |
7650 | 21 ## @deftypefnx {Function File} {@var{h} =} trimesh (@dots{}) |
10793
be55736a0783
Grammarcheck the documentation from m-files.
Rik <octave@nomad.inbox5.com>
parents:
10549
diff
changeset
|
22 ## Plot a triangular mesh in 3D@. The variable @var{tri} is the triangular |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
23 ## meshing of the points @code{(@var{x}, @var{y})} which is returned |
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
24 ## from @code{delaunay}. The variable @var{z} is value at the point |
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
25 ## @code{(@var{x}, @var{y})}. The output argument @var{h} is the graphic |
12187
87926ee23581
Add undocumented function trisurf to manual.
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
26 ## handle of the plot. |
87926ee23581
Add undocumented function trisurf to manual.
Rik <octave@nomad.inbox5.com>
parents:
11587
diff
changeset
|
27 ## @seealso{triplot, trisurf, delaunay3} |
6823 | 28 ## @end deftypefn |
29 | |
30 function h = trimesh (tri, x, y, z, varargin) | |
31 | |
32 if (nargin < 3) | |
6826 | 33 print_usage (); |
6823 | 34 endif |
35 | |
36 if (nargin == 3) | |
37 triplot (tri, x, y); | |
38 elseif (ischar (z)) | |
39 triplot (tri, x, y, z, varargin{:}); | |
40 else | |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
9051
diff
changeset
|
41 newplot (); |
6823 | 42 if (nargout > 0) |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
43 h = patch ("Vertices", [x(:), y(:), z(:)], "Faces", tri, |
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
44 "FaceColor", "none", "EdgeColor", __next_line_color__(), |
10549 | 45 varargin{:}); |
6823 | 46 else |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
47 patch ("Vertices", [x(:), y(:), z(:)], "Faces", tri, |
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
48 "FaceColor", "none", "EdgeColor", __next_line_color__(), |
10549 | 49 varargin{:}); |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
9051
diff
changeset
|
50 endif |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
9051
diff
changeset
|
51 |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
9051
diff
changeset
|
52 if (! ishold ()) |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
9051
diff
changeset
|
53 set (gca(), "view", [-37.5, 30], |
10549 | 54 "xgrid", "on", "ygrid", "on", "zgrid", "on"); |
6823 | 55 endif |
56 endif | |
57 endfunction | |
58 | |
59 %!demo | |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
9051
diff
changeset
|
60 %! N = 10; |
6823 | 61 %! rand ('state', 10) |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
9051
diff
changeset
|
62 %! x = 3 - 6 * rand (N, N); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
9051
diff
changeset
|
63 %! y = 3 - 6 * rand (N, N); |
6823 | 64 %! z = peaks (x, y); |
9110
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
9051
diff
changeset
|
65 %! tri = delaunay (x(:), y(:)); |
22ae6b3411a7
Add isocolor, isonormals and isosurface functions (For Martin Helm). Add 3D filled triangular patches and the trisurf function
David Bateman <dbateman@free.fr>
parents:
9051
diff
changeset
|
66 %! trimesh (tri, x(:), y(:), z(:)); |