Mercurial > octave
annotate scripts/geometry/delaunay3.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 | 16f53d29049f |
rev | line source |
---|---|
8920 | 1 ## Copyright (C) 1999, 2000, 2007, 2008 Kai Habel |
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 -*- | |
6846 | 20 ## @deftypefn {Function File} {@var{T} =} delaunay3 (@var{x}, @var{y}, @var{z}) |
21 ## @deftypefnx {Function File} {@var{T} =} delaunay3 (@var{x}, @var{y}, @var{z}, @var{opt}) | |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
22 ## A matrix of size [n, 4] is returned. Each row contains a |
6823 | 23 ## set of tetrahedron which are |
24 ## described by the indices to the data point vectors (x,y,z). | |
25 ## | |
26 ## A fourth optional argument, which must be a string or cell array of strings, | |
27 ## contains extra options passed to the underlying qhull command. See the | |
28 ## documentation for the Qhull library for details. | |
29 ## @seealso{delaunay,delaunayn} | |
30 ## @end deftypefn | |
31 | |
6826 | 32 ## Author: Kai Habel <kai.habel@gmx.de> |
6823 | 33 |
6826 | 34 function tetr = delaunay3 (x, y, z, opt) |
6823 | 35 |
6826 | 36 if (nargin != 3 && nargin != 4) |
6823 | 37 print_usage (); |
38 endif | |
39 | |
6826 | 40 if (isvector (x) && isvector (y) &&isvector (z) |
41 && length (x) == length (y) && length(x) == length (z)) | |
6823 | 42 if (nargin == 3) |
6826 | 43 tetr = delaunayn ([x(:), y(:), z(:)]); |
44 elseif (ischar (opt) || iscell (opt)) | |
45 tetr = delaunayn ([x(:), y(:), z(:)], opt); | |
6823 | 46 else |
6826 | 47 error ("delaunay3: fourth argument must be a string or cell array of strings"); |
6823 | 48 endif |
49 else | |
6826 | 50 error ("delaunay3: first three input arguments must be vectors of same size"); |
6823 | 51 endif |
52 | |
53 endfunction | |
54 | |
8153
ec0a13863eb7
Only run tests that depend on HDF5 and QHull if Octave was actually
Soren Hauberg <hauberg@gmail.com>
parents:
7017
diff
changeset
|
55 %!testif HAVE_QHULL |
6823 | 56 %! x = [-1, -1, 1, 0, -1]; y = [-1, 1, 1, 0, -1]; z = [0, 0, 0, 1, 1]; |
57 %! assert (sortrows (sort (delaunay3 (x, y, z), 2)), [1,2,3,4;1,2,4,5]) | |
58 |