annotate scripts/geometry/trimesh.m @ 10549:95c3e38098bf

Untabify .m scripts
author Rik <code@nomad.inbox5.com>
date Fri, 23 Apr 2010 11:28:50 -0700
parents 16f53d29049f
children be55736a0783
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9245
16f53d29049f update copyright notices
John W. Eaton <jwe@octave.org>
parents: 9110
diff changeset
1 ## Copyright (C) 2007, 2008, 2009 David Bateman
6823
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
2 ##
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
3 ## This file is part of Octave.
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
4 ##
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
6 ## under the terms of the GNU General Public License as published by
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6832
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6832
diff changeset
8 ## your option) any later version.
6823
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
9 ##
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
13 ## General Public License for more details.
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
14 ##
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6832
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6832
diff changeset
17 ## <http://www.gnu.org/licenses/>.
6823
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
18
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
19 ## -*- texinfo -*-
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
20 ## @deftypefn {Function File} {} trimesh (@var{tri}, @var{x}, @var{y}, @var{z})
7650
eb7bdde776f2 Texinfo fixes
John W. Eaton <jwe@octave.org>
parents: 7017
diff changeset
21 ## @deftypefnx {Function File} {@var{h} =} trimesh (@dots{})
9051
1bf0ce0930be Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
22 ## Plot a triangular mesh in 3D. The variable @var{tri} is the triangular
6832
3c500bc71e14 [project @ 2007-08-25 00:35:33 by dbateman]
dbateman
parents: 6826
diff changeset
23 ## meshing of the points @code{(@var{x}, @var{y})} which is returned
9051
1bf0ce0930be Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
24 ## from @code{delaunay}. The variable @var{z} is value at the point
1bf0ce0930be Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents: 8920
diff changeset
25 ## @code{(@var{x}, @var{y})}. The output argument @var{h} is the graphic
6832
3c500bc71e14 [project @ 2007-08-25 00:35:33 by dbateman]
dbateman
parents: 6826
diff changeset
26 ## handle to the plot.
6823
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
27 ## @seealso{triplot, delaunay3}
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
28 ## @end deftypefn
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
29
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
30 function h = trimesh (tri, x, y, z, varargin)
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
31
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
32 if (nargin < 3)
6826
8618f29520c6 [project @ 2007-08-24 16:02:07 by jwe]
jwe
parents: 6823
diff changeset
33 print_usage ();
6823
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
34 endif
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
35
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
36 if (nargin == 3)
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
37 triplot (tri, x, y);
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
38 elseif (ischar (z))
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
39 triplot (tri, x, y, z, varargin{:});
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
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
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
42 if (nargout > 0)
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
43 h = patch ("Vertices", [x(:), y(:), z(:)], "Faces", tri,
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9245
diff changeset
44 "FaceColor", "none", "EdgeColor", __next_line_color__(),
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9245
diff changeset
45 varargin{:});
6823
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
46 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
47 patch ("Vertices", [x(:), y(:), z(:)], "Faces", tri,
10549
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9245
diff changeset
48 "FaceColor", "none", "EdgeColor", __next_line_color__(),
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9245
diff changeset
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
95c3e38098bf Untabify .m scripts
Rik <code@nomad.inbox5.com>
parents: 9245
diff changeset
54 "xgrid", "on", "ygrid", "on", "zgrid", "on");
6823
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
55 endif
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
56 endif
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
57 endfunction
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
58
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
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
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
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
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
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(:));