annotate scripts/geometry/delaunayn.m @ 28714:d8dcb36bb904 stable

maint: spellcheck documentation ahead of 6.1 release. * aspell-octave.en.pws: Add new words to Octave-specific dictionary. * diffeq.txi, data.cc, delaunay.m, delaunayn.m, ode23s.m, pkg.m: spellcheck documentation ahead of 6.1 release.
author Rik <rik@octave.org>
date Thu, 10 Sep 2020 14:54:42 -0700
parents 2e6dc7e2b191
children 90fea9cc9caa 0a5b15007766
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ########################################################################
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 ##
27919
1891570abac8 update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 27918
diff changeset
3 ## Copyright (C) 2007-2020 The Octave Project Developers
27918
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
4 ##
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 ## See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 ## distribution or <https://octave.org/copyright/>.
6823
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
7 ##
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
8 ## This file is part of Octave.
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
9 ##
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23220
diff changeset
10 ## Octave is free software: you can redistribute it and/or modify it
6823
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
11 ## under the terms of the GNU General Public License as published by
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23220
diff changeset
12 ## the Free Software Foundation, either version 3 of the License, or
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
13 ## (at your option) any later version.
6823
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
14 ##
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
15 ## Octave is distributed in the hope that it will be useful, but
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22323
diff changeset
18 ## GNU General Public License for more details.
6823
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
19 ##
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
20 ## You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6846
diff changeset
21 ## along with Octave; see the file COPYING. If not, see
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23220
diff changeset
22 ## <https://www.gnu.org/licenses/>.
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 ##
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ########################################################################
6823
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
25
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
26 ## -*- texinfo -*-
20852
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 20158
diff changeset
27 ## @deftypefn {} {@var{T} =} delaunayn (@var{pts})
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 20158
diff changeset
28 ## @deftypefnx {} {@var{T} =} delaunayn (@var{pts}, @var{options})
13746
7ff0bdc3dc4c Revamp geometry functions dependent on Qhull (Bug #34604, Bug #33346)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
29 ## Compute the Delaunay triangulation for an N-dimensional set of points.
20158
7503499a252b doc: Update docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19833
diff changeset
30 ##
7503499a252b doc: Update docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19833
diff changeset
31 ## The Delaunay triangulation is a tessellation of the convex hull of a set of
7503499a252b doc: Update docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19833
diff changeset
32 ## points such that no N-sphere defined by the N-triangles contains any other
7503499a252b doc: Update docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19833
diff changeset
33 ## points from the set.
19593
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
34 ##
13746
7ff0bdc3dc4c Revamp geometry functions dependent on Qhull (Bug #34604, Bug #33346)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
35 ## The input matrix @var{pts} of size [n, dim] contains n points in a space of
20158
7503499a252b doc: Update docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19833
diff changeset
36 ## dimension dim. The return matrix @var{T} has size [m, dim+1]. Each row of
7503499a252b doc: Update docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents: 19833
diff changeset
37 ## @var{T} contains a set of indices back into the original set of points
13746
7ff0bdc3dc4c Revamp geometry functions dependent on Qhull (Bug #34604, Bug #33346)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
38 ## @var{pts} which describes a simplex of dimension dim. For example, a 2-D
7ff0bdc3dc4c Revamp geometry functions dependent on Qhull (Bug #34604, Bug #33346)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
39 ## simplex is a triangle and 3-D simplex is a tetrahedron.
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11563
diff changeset
40 ##
21546
f7f97d7e9294 doc: Wrap m-file docstrings to 79 characters + newline (80 total).
Rik <rik@octave.org>
parents: 20852
diff changeset
41 ## An optional second argument, which must be a string or cell array of
f7f97d7e9294 doc: Wrap m-file docstrings to 79 characters + newline (80 total).
Rik <rik@octave.org>
parents: 20852
diff changeset
42 ## strings, contains options passed to the underlying qhull command. See the
f7f97d7e9294 doc: Wrap m-file docstrings to 79 characters + newline (80 total).
Rik <rik@octave.org>
parents: 20852
diff changeset
43 ## documentation for the Qhull library for details
13746
7ff0bdc3dc4c Revamp geometry functions dependent on Qhull (Bug #34604, Bug #33346)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
44 ## @url{http://www.qhull.org/html/qh-quick.htm#options}.
7ff0bdc3dc4c Revamp geometry functions dependent on Qhull (Bug #34604, Bug #33346)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
45 ## The default options depend on the dimension of the input:
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11563
diff changeset
46 ##
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11563
diff changeset
47 ## @itemize
28027
2e6dc7e2b191 Use appropriate Qhull options as necessary to obtain triangulation (bug #50494).
Rik <rik@octave.org>
parents: 27923
diff changeset
48 ## @item 2-D and 3-D: @var{options} = @code{@{"Qt", "Qbb", "Qc"@}}
10821
693e22af08ae Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents: 10793
diff changeset
49 ##
13746
7ff0bdc3dc4c Revamp geometry functions dependent on Qhull (Bug #34604, Bug #33346)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
50 ## @item 4-D and higher: @var{options} = @code{@{"Qt", "Qbb", "Qc", "Qx"@}}
6826
8618f29520c6 [project @ 2007-08-24 16:02:07 by jwe]
jwe
parents: 6823
diff changeset
51 ## @end itemize
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11563
diff changeset
52 ##
28714
d8dcb36bb904 maint: spellcheck documentation ahead of 6.1 release.
Rik <rik@octave.org>
parents: 28027
diff changeset
53 ## If Qhull fails for 2-D input the triangulation is attempted again with
28027
2e6dc7e2b191 Use appropriate Qhull options as necessary to obtain triangulation (bug #50494).
Rik <rik@octave.org>
parents: 27923
diff changeset
54 ## the options @code{@{"Qt", "Qbb", "Qc", "Qz"@}} which may result in
2e6dc7e2b191 Use appropriate Qhull options as necessary to obtain triangulation (bug #50494).
Rik <rik@octave.org>
parents: 27923
diff changeset
55 ## reduced accuracy.
2e6dc7e2b191 Use appropriate Qhull options as necessary to obtain triangulation (bug #50494).
Rik <rik@octave.org>
parents: 27923
diff changeset
56 ##
13746
7ff0bdc3dc4c Revamp geometry functions dependent on Qhull (Bug #34604, Bug #33346)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
57 ## If @var{options} is not present or @code{[]} then the default arguments are
19593
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
58 ## used. Otherwise, @var{options} replaces the default argument list.
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
59 ## To append user options to the defaults it is necessary to repeat the
13746
7ff0bdc3dc4c Revamp geometry functions dependent on Qhull (Bug #34604, Bug #33346)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
60 ## default arguments in @var{options}. Use a null string to pass no arguments.
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11563
diff changeset
61 ##
19164
ba167badef9f Deprecate delaunay3 and extend delaunay to 3-D inputs.
Rik <rik@octave.org>
parents: 17744
diff changeset
62 ## @seealso{delaunay, convhulln, voronoin, trimesh, tetramesh}
6823
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
63 ## @end deftypefn
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
64
13746
7ff0bdc3dc4c Revamp geometry functions dependent on Qhull (Bug #34604, Bug #33346)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
65 function T = delaunayn (pts, varargin)
7ff0bdc3dc4c Revamp geometry functions dependent on Qhull (Bug #34604, Bug #33346)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
66
6823
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
67 if (nargin < 1)
6826
8618f29520c6 [project @ 2007-08-24 16:02:07 by jwe]
jwe
parents: 6823
diff changeset
68 print_usage ();
6823
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
69 endif
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
70
28027
2e6dc7e2b191 Use appropriate Qhull options as necessary to obtain triangulation (bug #50494).
Rik <rik@octave.org>
parents: 27923
diff changeset
71 if (isempty (varargin) || isempty (varargin{1}))
2e6dc7e2b191 Use appropriate Qhull options as necessary to obtain triangulation (bug #50494).
Rik <rik@octave.org>
parents: 27923
diff changeset
72 try
2e6dc7e2b191 Use appropriate Qhull options as necessary to obtain triangulation (bug #50494).
Rik <rik@octave.org>
parents: 27923
diff changeset
73 T = __delaunayn__ (pts);
2e6dc7e2b191 Use appropriate Qhull options as necessary to obtain triangulation (bug #50494).
Rik <rik@octave.org>
parents: 27923
diff changeset
74 catch
2e6dc7e2b191 Use appropriate Qhull options as necessary to obtain triangulation (bug #50494).
Rik <rik@octave.org>
parents: 27923
diff changeset
75 if (columns (pts) <= 2)
2e6dc7e2b191 Use appropriate Qhull options as necessary to obtain triangulation (bug #50494).
Rik <rik@octave.org>
parents: 27923
diff changeset
76 T = __delaunayn__ (pts, "Qt Qbb Qc Qz");
2e6dc7e2b191 Use appropriate Qhull options as necessary to obtain triangulation (bug #50494).
Rik <rik@octave.org>
parents: 27923
diff changeset
77 endif
2e6dc7e2b191 Use appropriate Qhull options as necessary to obtain triangulation (bug #50494).
Rik <rik@octave.org>
parents: 27923
diff changeset
78 end_try_catch
2e6dc7e2b191 Use appropriate Qhull options as necessary to obtain triangulation (bug #50494).
Rik <rik@octave.org>
parents: 27923
diff changeset
79 else
2e6dc7e2b191 Use appropriate Qhull options as necessary to obtain triangulation (bug #50494).
Rik <rik@octave.org>
parents: 27923
diff changeset
80 T = __delaunayn__ (pts, varargin{:});
2e6dc7e2b191 Use appropriate Qhull options as necessary to obtain triangulation (bug #50494).
Rik <rik@octave.org>
parents: 27923
diff changeset
81 endif
6823
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
82
13746
7ff0bdc3dc4c Revamp geometry functions dependent on Qhull (Bug #34604, Bug #33346)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
83 if (isa (pts, "single"))
19172
4318cb91deac delaunayn.m: Slight performance increase and addition of BIST tests.
Rik <rik@octave.org>
parents: 19164
diff changeset
84 tol = 1e3 * eps ("single");
7795
df9519e9990c Handle single precision eps values
David Bateman <dbateman@free.fr>
parents: 7208
diff changeset
85 else
19172
4318cb91deac delaunayn.m: Slight performance increase and addition of BIST tests.
Rik <rik@octave.org>
parents: 19164
diff changeset
86 tol = 1e3 * eps;
7795
df9519e9990c Handle single precision eps values
David Bateman <dbateman@free.fr>
parents: 7208
diff changeset
87 endif
df9519e9990c Handle single precision eps values
David Bateman <dbateman@free.fr>
parents: 7208
diff changeset
88
13746
7ff0bdc3dc4c Revamp geometry functions dependent on Qhull (Bug #34604, Bug #33346)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
89 ## Try to remove the zero volume simplices. The volume of the i-th simplex is
25328
3b96348d5ccd delaunayn.m: Vectorize test for 2-D zero volume simplexes (bug #53689)
Rik <rik@octave.org>
parents: 25054
diff changeset
90 ## given by abs(det(pts(T(i,1:end-1),:)-pts(T(i,2:end),:)))/factorial(ndim+1)
13746
7ff0bdc3dc4c Revamp geometry functions dependent on Qhull (Bug #34604, Bug #33346)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
91 ## (reference http://en.wikipedia.org/wiki/Simplex). Any simplex with a
7ff0bdc3dc4c Revamp geometry functions dependent on Qhull (Bug #34604, Bug #33346)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
92 ## relative volume less than some arbitrary criteria is rejected. The
11587
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11563
diff changeset
93 ## criteria we use is the volume of the simplex corresponding to an
c792872f8942 all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents: 11563
diff changeset
94 ## orthogonal simplex is equal edge length all equal to the edge length of
13746
7ff0bdc3dc4c Revamp geometry functions dependent on Qhull (Bug #34604, Bug #33346)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
95 ## the original simplex. If the relative volume is 1e3*eps then the simplex
7ff0bdc3dc4c Revamp geometry functions dependent on Qhull (Bug #34604, Bug #33346)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
96 ## is rejected. Note division of the two volumes means that the factor
25328
3b96348d5ccd delaunayn.m: Vectorize test for 2-D zero volume simplexes (bug #53689)
Rik <rik@octave.org>
parents: 25054
diff changeset
97 ## factorial(ndim+1) is dropped.
3b96348d5ccd delaunayn.m: Vectorize test for 2-D zero volume simplexes (bug #53689)
Rik <rik@octave.org>
parents: 25054
diff changeset
98 [nt, nd] = size (T);
3b96348d5ccd delaunayn.m: Vectorize test for 2-D zero volume simplexes (bug #53689)
Rik <rik@octave.org>
parents: 25054
diff changeset
99 if (nd == 3)
3b96348d5ccd delaunayn.m: Vectorize test for 2-D zero volume simplexes (bug #53689)
Rik <rik@octave.org>
parents: 25054
diff changeset
100 ## 2-D case
3b96348d5ccd delaunayn.m: Vectorize test for 2-D zero volume simplexes (bug #53689)
Rik <rik@octave.org>
parents: 25054
diff changeset
101 np = rows (pts);
3b96348d5ccd delaunayn.m: Vectorize test for 2-D zero volume simplexes (bug #53689)
Rik <rik@octave.org>
parents: 25054
diff changeset
102 ptsz = [pts, zeros(np, 1)];
3b96348d5ccd delaunayn.m: Vectorize test for 2-D zero volume simplexes (bug #53689)
Rik <rik@octave.org>
parents: 25054
diff changeset
103 p1 = ptsz(T(:,1), :);
3b96348d5ccd delaunayn.m: Vectorize test for 2-D zero volume simplexes (bug #53689)
Rik <rik@octave.org>
parents: 25054
diff changeset
104 p2 = ptsz(T(:,2), :);
3b96348d5ccd delaunayn.m: Vectorize test for 2-D zero volume simplexes (bug #53689)
Rik <rik@octave.org>
parents: 25054
diff changeset
105 p3 = ptsz(T(:,3), :);
3b96348d5ccd delaunayn.m: Vectorize test for 2-D zero volume simplexes (bug #53689)
Rik <rik@octave.org>
parents: 25054
diff changeset
106 p12 = p1 - p2;
3b96348d5ccd delaunayn.m: Vectorize test for 2-D zero volume simplexes (bug #53689)
Rik <rik@octave.org>
parents: 25054
diff changeset
107 p23 = p2 - p3;
3b96348d5ccd delaunayn.m: Vectorize test for 2-D zero volume simplexes (bug #53689)
Rik <rik@octave.org>
parents: 25054
diff changeset
108 det = cross (p12, p23, 2);
3b96348d5ccd delaunayn.m: Vectorize test for 2-D zero volume simplexes (bug #53689)
Rik <rik@octave.org>
parents: 25054
diff changeset
109 idx = abs (det(:,3) ./ sqrt (sumsq (p12, 2))) < tol & ...
3b96348d5ccd delaunayn.m: Vectorize test for 2-D zero volume simplexes (bug #53689)
Rik <rik@octave.org>
parents: 25054
diff changeset
110 abs (det(:,3) ./ sqrt (sumsq (p23, 2))) < tol;
3b96348d5ccd delaunayn.m: Vectorize test for 2-D zero volume simplexes (bug #53689)
Rik <rik@octave.org>
parents: 25054
diff changeset
111 else
3b96348d5ccd delaunayn.m: Vectorize test for 2-D zero volume simplexes (bug #53689)
Rik <rik@octave.org>
parents: 25054
diff changeset
112 ## FIXME: Vectorize this for loop or convert delaunayn to .oct function
3b96348d5ccd delaunayn.m: Vectorize test for 2-D zero volume simplexes (bug #53689)
Rik <rik@octave.org>
parents: 25054
diff changeset
113 idx = [];
3b96348d5ccd delaunayn.m: Vectorize test for 2-D zero volume simplexes (bug #53689)
Rik <rik@octave.org>
parents: 25054
diff changeset
114 for i = 1:nt
3b96348d5ccd delaunayn.m: Vectorize test for 2-D zero volume simplexes (bug #53689)
Rik <rik@octave.org>
parents: 25054
diff changeset
115 X = pts(T(i,1:end-1),:) - pts(T(i,2:end),:);
3b96348d5ccd delaunayn.m: Vectorize test for 2-D zero volume simplexes (bug #53689)
Rik <rik@octave.org>
parents: 25054
diff changeset
116 if (abs (det (X)) / sqrt (sumsq (X, 2)) < tol)
3b96348d5ccd delaunayn.m: Vectorize test for 2-D zero volume simplexes (bug #53689)
Rik <rik@octave.org>
parents: 25054
diff changeset
117 idx(end+1) = i;
3b96348d5ccd delaunayn.m: Vectorize test for 2-D zero volume simplexes (bug #53689)
Rik <rik@octave.org>
parents: 25054
diff changeset
118 endif
3b96348d5ccd delaunayn.m: Vectorize test for 2-D zero volume simplexes (bug #53689)
Rik <rik@octave.org>
parents: 25054
diff changeset
119 endfor
3b96348d5ccd delaunayn.m: Vectorize test for 2-D zero volume simplexes (bug #53689)
Rik <rik@octave.org>
parents: 25054
diff changeset
120 endif
13746
7ff0bdc3dc4c Revamp geometry functions dependent on Qhull (Bug #34604, Bug #33346)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
121 T(idx,:) = [];
7ff0bdc3dc4c Revamp geometry functions dependent on Qhull (Bug #34604, Bug #33346)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
122
6823
9fddcc586065 [project @ 2007-08-24 08:27:27 by dbateman]
dbateman
parents:
diff changeset
123 endfunction
13746
7ff0bdc3dc4c Revamp geometry functions dependent on Qhull (Bug #34604, Bug #33346)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
124
7ff0bdc3dc4c Revamp geometry functions dependent on Qhull (Bug #34604, Bug #33346)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
125
19172
4318cb91deac delaunayn.m: Slight performance increase and addition of BIST tests.
Rik <rik@octave.org>
parents: 19164
diff changeset
126 %!testif HAVE_QHULL
4318cb91deac delaunayn.m: Slight performance increase and addition of BIST tests.
Rik <rik@octave.org>
parents: 19164
diff changeset
127 %! x = [-1, 0; 0, 1; 1, 0; 0, -1; 0, 0];
4318cb91deac delaunayn.m: Slight performance increase and addition of BIST tests.
Rik <rik@octave.org>
parents: 19164
diff changeset
128 %! assert (sortrows (sort (delaunayn (x), 2)), [1,2,5;1,4,5;2,3,5;3,4,5]);
4318cb91deac delaunayn.m: Slight performance increase and addition of BIST tests.
Rik <rik@octave.org>
parents: 19164
diff changeset
129
4318cb91deac delaunayn.m: Slight performance increase and addition of BIST tests.
Rik <rik@octave.org>
parents: 19164
diff changeset
130 ## Test 3-D input
4318cb91deac delaunayn.m: Slight performance increase and addition of BIST tests.
Rik <rik@octave.org>
parents: 19164
diff changeset
131 %!testif HAVE_QHULL
4318cb91deac delaunayn.m: Slight performance increase and addition of BIST tests.
Rik <rik@octave.org>
parents: 19164
diff changeset
132 %! x = [-1, -1, 1, 0, -1]; y = [-1, 1, 1, 0, -1]; z = [0, 0, 0, 1, 1];
21580
ecce63c99c3f maint: Add semicolons to terminate code in %! blocks.
Rik <rik@octave.org>
parents: 21546
diff changeset
133 %! assert (sortrows (sort (delaunayn ([x(:) y(:) z(:)]), 2)), [1,2,3,4;1,2,4,5]);
19172
4318cb91deac delaunayn.m: Slight performance increase and addition of BIST tests.
Rik <rik@octave.org>
parents: 19164
diff changeset
134
19833
9fc020886ae9 maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19697
diff changeset
135 ## FIXME: Need tests for delaunayn
13746
7ff0bdc3dc4c Revamp geometry functions dependent on Qhull (Bug #34604, Bug #33346)
Rik <octave@nomad.inbox5.com>
parents: 11587
diff changeset
136
19833
9fc020886ae9 maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19697
diff changeset
137 ## Input validation tests
19172
4318cb91deac delaunayn.m: Slight performance increase and addition of BIST tests.
Rik <rik@octave.org>
parents: 19164
diff changeset
138 %!error delaunayn ()