Mercurial > hg > octave-nkf
annotate scripts/geometry/triplot.m @ 11117:3cbc0d77db48 ss-3-3-53
update version info for snapshot
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 19 Oct 2010 02:25:32 -0400 |
parents | be55736a0783 |
children | fd0a3ac60b0e |
rev | line source |
---|---|
9245 | 1 ## Copyright (C) 2007, 2008, 2009 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} {} triplot (@var{tri}, @var{x}, @var{y}) |
6823 | 21 ## @deftypefnx {Function File} {} triplot (@var{tri}, @var{x}, @var{y}, @var{linespec}) |
7650 | 22 ## @deftypefnx {Function File} {@var{h} =} triplot (@dots{}) |
10793
be55736a0783
Grammarcheck the documentation from m-files.
Rik <octave@nomad.inbox5.com>
parents:
10549
diff
changeset
|
23 ## Plot a triangular mesh in 2D@. The variable @var{tri} is the triangular |
6823 | 24 ## meshing of the points @code{(@var{x}, @var{y})} which is returned from |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
25 ## @code{delaunay}. If given, the @var{linespec} determines the properties |
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
26 ## to use for the lines. The output argument @var{h} is the graphic handle |
6823 | 27 ## to the plot. |
28 ## @seealso{plot, trimesh, delaunay} | |
29 ## @end deftypefn | |
30 | |
31 function h = triplot (tri, x, y, varargin) | |
32 | |
33 if (nargin < 3) | |
6826 | 34 print_usage (); |
6823 | 35 endif |
36 | |
6826 | 37 idx = tri(:, [1, 2, 3, 1]).'; |
38 nt = size (tri, 1); | |
6823 | 39 if (nargout > 0) |
10540
952d4df5b686
Eliminate NaN*ones and Inf*ones constructs and just use Nan() and Inf()
Rik <code@nomad.inbox5.com>
parents:
9245
diff
changeset
|
40 h = plot ([x(idx); NaN(1, nt)](:), |
10549 | 41 [y(idx); NaN(1, nt)](:), varargin{:}); |
6823 | 42 else |
10540
952d4df5b686
Eliminate NaN*ones and Inf*ones constructs and just use Nan() and Inf()
Rik <code@nomad.inbox5.com>
parents:
9245
diff
changeset
|
43 plot ([x(idx); NaN(1, nt)](:), |
10549 | 44 [y(idx); NaN(1, nt)](:), varargin{:}); |
6823 | 45 endif |
46 endfunction | |
47 | |
48 %!demo | |
49 %! rand ('state', 2) | |
50 %! x = rand (20, 1); | |
51 %! y = rand (20, 1); | |
52 %! tri = delaunay (x, y); | |
53 %! triplot (tri, x, y); |