# HG changeset patch # User Andreas Weber # Date 1375362974 -7200 # Node ID f72ffae1fcc3402b63d1d8c7d68a6f9c9273bdc1 # Parent ea19ea629a09a4969199ab214b4b98b14d8e16cb delaunay.m: Fixed matlab compatibility and input check for single matrix (bug #39644) * scripts/geometry/delaunay.m: check for equal size of X and Y, check for 2 column single matrix input, added 2 tests for these two changes diff -r ea19ea629a09 -r f72ffae1fcc3 scripts/geometry/delaunay.m --- a/scripts/geometry/delaunay.m Thu Aug 01 07:43:59 2013 -0400 +++ b/scripts/geometry/delaunay.m Thu Aug 01 15:16:14 2013 +0200 @@ -75,7 +75,7 @@ switch (nargin) case 1 - if (! ismatrix (varargin{1}) && columns (varargin{1}) != 2) + if (! ismatrix (varargin{1}) || columns (varargin{1}) != 2) error ("delaunay: X must be a matrix with 2 columns"); else x = varargin{1}(:,1); @@ -109,7 +109,7 @@ endswitch - if (! (isvector (x) && isvector (y) && length (x) == length (y))) + if (! (isequal(size(x),size(y)))) error ("delaunay: X and Y must be the same size"); endif @@ -156,5 +156,13 @@ %! y = [0, 1, 0, -1, 0]; %! assert (sortrows (sort (delaunay (x, y), 2)), [1,2,5;1,4,5;2,3,5;3,4,5]); +%!testif HAVE_QHULL +%! x = [-1, 0; 0, 1; 1, 0; 0, -1; 0, 0]; +%! assert (sortrows (sort (delaunay (x), 2)), [1,2,5;1,4,5;2,3,5;3,4,5]); + +%!testif HAVE_QHULL +%! x = [1 5 2; 5 6 7]; +%! y = [5 7 8; 1 2 3]; +%! assert (sortrows (sort (delaunay (x, y), 2)), [1,2,4;1,3,4;1,3,5;3,4,6]); + %% FIXME: Need input validation tests -