Mercurial > hg > octave-lyh
annotate scripts/geometry/trimesh.m @ 9051:1bf0ce0930be
Grammar check TexInfo in all .m files
Cleanup documentation sources to follow a few consistent rules.
Spellcheck was NOT done. (but will be in another changeset)
author | Rik <rdrider0-list@yahoo.com> |
---|---|
date | Fri, 27 Mar 2009 22:31:03 -0700 |
parents | eb63fbe60fab |
children | 22ae6b3411a7 |
rev | line source |
---|---|
8920 | 1 ## Copyright (C) 2007, 2008 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 -*- | |
20 ## @deftypefn {Function File} {} trimesh (@var{tri}, @var{x}, @var{y}, @var{z}) | |
7650 | 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 | 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 | 26 ## handle to the plot. |
6823 | 27 ## @seealso{triplot, delaunay3} |
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 | |
41 idx = tri(:, [1,2,3,1]).'; | |
6826 | 42 nt = size (tri, 1); |
6823 | 43 ## FIXME We should really use patch instead of plot3, but we don't |
44 ## have a patch function, and probably won't in 3D that works with | |
45 ## gnuplot | |
46 if (nargout > 0) | |
6826 | 47 h = plot3 ([x(idx); NaN*ones(1, nt)](:), |
48 [y(idx); NaN*ones(1, nt)](:), | |
49 [z(idx); NaN*ones(1, nt)](:), varargin{:}); | |
6823 | 50 else |
6826 | 51 plot3 ([x(idx); NaN*ones(1, nt)](:), |
52 [y(idx); NaN*ones(1, nt)](:), | |
53 [z(idx); NaN*ones(1, nt)](:), varargin{:}); | |
6823 | 54 endif |
55 endif | |
56 endfunction | |
57 | |
58 %!demo | |
59 %! rand ('state', 10) | |
60 %! x = 3 - 6 * rand (1, 50); | |
61 %! y = 3 - 6 * rand (1, 50); | |
62 %! z = peaks (x, y); | |
63 %! tri = delaunay (x, y); | |
64 %! trimesh (tri, x, y, z); |