6823
|
1 ## Copyright (C) 2000 Kai Habel |
|
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 |
|
7 ## the Free Software Foundation; either version 2, or (at your option) |
|
8 ## any later version. |
|
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 |
|
16 ## along with Octave; see the file COPYING. If not, write to the Free |
|
17 ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
18 ## 02110-1301, USA. |
|
19 |
|
20 ## -*- texinfo -*- |
|
21 ## @deftypefn {Function File} {[@var{C}, @var{F}] =} voronoin (@var{pts}) |
|
22 ## @deftypefnx {Function File} {[@var{C}, @var{F}] =} voronoin (@var{pts}, @var{options}) |
7007
|
23 ## computes n- dimensional voronoi facets. The input matrix @var{pts} |
6823
|
24 ## of size [n, dim] contains n points of dimension dim. |
|
25 ## @var{C} contains the points of the voronoi facets. The list @var{F} |
|
26 ## contains for each facet the indices of the voronoi points. |
|
27 ## |
|
28 ## A second optional argument, which must be a string, contains extra options |
|
29 ## passed to the underlying qhull command. See the documentation for the |
|
30 ## Qhull library for details. |
|
31 ## @seealso{voronoin, delaunay, convhull} |
|
32 ## @end deftypefn |
|
33 |
|
34 ## Author: Kai Habel <kai.habel@gmx.de> |
|
35 ## First Release: 20/08/2000 |
|
36 |
|
37 ## 2003-12-14 Rafael Laboissiere <rafael@laboissiere.net> |
|
38 ## Added optional second argument to pass options to the underlying |
|
39 ## qhull command |
|
40 |
|
41 function [C, F] = voronoin (pts, opt) |
|
42 |
6826
|
43 if (nargin != 1 && nargin != 2) |
6823
|
44 print_usage (); |
|
45 endif |
|
46 |
|
47 [np, dims] = size (pts); |
|
48 if (np > dims) |
|
49 if (nargin == 1) |
|
50 [C, F, infi] = __voronoi__ (pts); |
|
51 elseif ischar(opt) |
|
52 [C, F, infi] = __voronoi__ (pts, opt); |
|
53 else |
6826
|
54 error ("voronoin: second argument must be a string"); |
6823
|
55 endif |
|
56 |
|
57 else |
|
58 error ("voronoin: number of points must be greater than their dimension") |
|
59 endif |
|
60 endfunction |