Mercurial > octave
diff scripts/geometry/delaunayn.m @ 6826:8618f29520c6
[project @ 2007-08-24 16:02:07 by jwe]
author | jwe |
---|---|
date | Fri, 24 Aug 2007 16:02:07 +0000 |
parents | 9fddcc586065 |
children | 7911a62a300d |
line wrap: on
line diff
--- a/scripts/geometry/delaunayn.m Fri Aug 24 15:36:50 2007 +0000 +++ b/scripts/geometry/delaunayn.m Fri Aug 24 16:02:07 2007 +0000 @@ -23,34 +23,34 @@ ## Form the Delaunay triangulation for a set of points. ## The Delaunay triangulation is a tessellation of the convex hull of the ## points such that no n-sphere defined by the n-triangles contains -## any other points from the set.\n -## The input matrix @var{P} of size [n, dim] contains n points in a space -## of dimension dim. The return matrix @var{T} has the size [m, dim+1]. It -## contains for each row a set of indices to the points, which describes a -## simplex of dimension dim. For example, a 2d simplex is a triangle and 3d -## simplex is a tetrahedron. +## any other points from the set. +## The input matrix @var{P} of size @code{[n, dim]} contains @var{n} +## points in a space of dimension dim. The return matrix @var{T} has the +## size @code{[m, dim+1]}. It contains for each row a set of indices to +## the points, which describes a simplex of dimension dim. For example, +## a 2d simplex is a triangle and 3d simplex is a tetrahedron. ## ## Extra options for the underlying Qhull command can be specified by the ## second argument. This argument is a cell array of strings. The default ## options depend on the dimension of the input: ## ## @itemize -## @item 2D and 3D: @var{opt} = @{'Qt','Qbb','Qc'@} -## @item 4D and higher: @var{opt} = @{'Qt','Qbb','Qc','Qz'@} -## @end itemize +## @item 2D and 3D: @var{opt} = @code{@{"Qt", "Qbb", "Qc"@}} +## @item 4D and higher: @var{opt} = @code{@{"Qt", "Qbb", "Qc", "Qz"@}} +## @end itemize ## ## If @var{opt} is [], then the default arguments are used. If @var{opt} -## is @{'@w{}'@}, then none of the default arguments are used by Qhull. +## is @code{@{"@w{}"@}}, then none of the default arguments are used by Qhull. ## See the Qhull documentation for the available options. ## ## All options can also be specified as single string, for example -## 'Qt Qbb Qc Qz'. +## @code{"Qt Qbb Qc Qz"}. ## ## @end deftypefn function t = delaunayn (x, varargin) if (nargin < 1) - print_usage() + print_usage (); endif t = __delaunayn__ (x, varargin {:}); @@ -65,8 +65,8 @@ ## is rejected. Note division of the two volumes means that the factor ## prod(1:n) is dropped. idx = []; - [nt, n] = size(t); - for i = 1 : nt + [nt, n] = size (t); + for i = 1:nt X = x(t(i,1:end-1),:) - x(t(i,2:end),:); if (abs (det (X)) / sqrt (sum (X .^ 2, 2)) < 1e3 * eps) idx = [idx, i];