changelog shortlog tags changeset files revisions annotate raw

scripts/geometry/voronoin.m

changeset 10289: 4b124317dc38
parent:eb63fbe60fab
author: John W. Eaton <jwe@octave.org>
date: Tue Feb 09 20:58:55 2010 -0500 (28 minutes ago)
permissions: -rw-r--r--
description: base_properties::set_children: account for hidden children
1## Copyright (C) 2000, 2007, 2009 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 3 of the License, or (at
8## your option) 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, see
17## <http://www.gnu.org/licenses/>.
18
19## -*- texinfo -*-
20## @deftypefn {Function File} {[@var{C}, @var{F}] =} voronoin (@var{pts})
21## @deftypefnx {Function File} {[@var{C}, @var{F}] =} voronoin (@var{pts}, @var{options})
22## computes n- dimensional voronoi facets. The input matrix @var{pts}
23## of size [n, dim] contains n points of dimension dim.
24## @var{C} contains the points of the voronoi facets. The list @var{F}
25## contains for each facet the indices of the voronoi points.
26##
27## A second optional argument, which must be a string, contains extra options
28## passed to the underlying qhull command. See the documentation for the
29## Qhull library for details.
30## @seealso{voronoin, delaunay, convhull}
31## @end deftypefn
32
33## Author: Kai Habel <kai.habel@gmx.de>
34## First Release: 20/08/2000
35
36## 2003-12-14 Rafael Laboissiere <rafael@laboissiere.net>
37## Added optional second argument to pass options to the underlying
38## qhull command
39
40function [C, F] = voronoin (pts, opt)
41
42 if (nargin != 1 && nargin != 2)
43 print_usage ();
44 endif
45
46 [np, dims] = size (pts);
47 if (np > dims)
48 if (nargin == 1)
49 [C, F, infi] = __voronoi__ (pts);
50 elseif ischar(opt)
51 [C, F, infi] = __voronoi__ (pts, opt);
52 else
53 error ("voronoin: second argument must be a string");
54 endif
55
56 else
57 error ("voronoin: number of points must be greater than their dimension");
58 endif
59endfunction