comparison scripts/geometry/dsearchn.m @ 11587:c792872f8942

all script files: untabify and strip trailing whitespace
author John W. Eaton <jwe@octave.org>
date Thu, 20 Jan 2011 17:35:29 -0500
parents fd0a3ac60b0e
children d0b799dafede
comparison
equal deleted inserted replaced
11586:12df7854fa7c 11587:c792872f8942
21 ## @deftypefnx {Function File} {@var{idx} =} dsearchn (@var{x}, @var{tri}, @var{xi}, @var{outval}) 21 ## @deftypefnx {Function File} {@var{idx} =} dsearchn (@var{x}, @var{tri}, @var{xi}, @var{outval})
22 ## @deftypefnx {Function File} {@var{idx} =} dsearchn (@var{x}, @var{xi}) 22 ## @deftypefnx {Function File} {@var{idx} =} dsearchn (@var{x}, @var{xi})
23 ## @deftypefnx {Function File} {[@var{idx}, @var{d}] =} dsearchn (@dots{}) 23 ## @deftypefnx {Function File} {[@var{idx}, @var{d}] =} dsearchn (@dots{})
24 ## Returns the index @var{idx} or the closest point in @var{x} to the elements 24 ## Returns the index @var{idx} or the closest point in @var{x} to the elements
25 ## @var{xi}. If @var{outval} is supplied, then the values of @var{xi} that are 25 ## @var{xi}. If @var{outval} is supplied, then the values of @var{xi} that are
26 ## not contained within one of the simplices @var{tri} are set to 26 ## not contained within one of the simplices @var{tri} are set to
27 ## @var{outval}. Generally, @var{tri} is returned from @code{delaunayn 27 ## @var{outval}. Generally, @var{tri} is returned from @code{delaunayn
28 ## (@var{x})}. 28 ## (@var{x})}.
29 ## @seealso{dsearch, tsearch} 29 ## @seealso{dsearch, tsearch}
30 ## @end deftypefn 30 ## @end deftypefn
31 31
32 function [idx, d] = dsearchn (x, tri, xi, outval) 32 function [idx, d] = dsearchn (x, tri, xi, outval)
45 endif 45 endif
46 endif 46 endif
47 endfunction 47 endfunction
48 48
49 %!shared x, tri 49 %!shared x, tri
50 %! x = [-1,-1;-1,1;1,-1]; 50 %! x = [-1,-1;-1,1;1,-1];
51 %! tri = [1,2,3]; 51 %! tri = [1,2,3];
52 %!assert (dsearchn(x,tri,[1,1/3]), 3); 52 %!assert (dsearchn(x,tri,[1,1/3]), 3);
53 %!assert (dsearchn(x,tri,[1,1/3],NaN), NaN); 53 %!assert (dsearchn(x,tri,[1,1/3],NaN), NaN);
54 %!assert (dsearchn(x,tri,[1,1/3],NA), NA); 54 %!assert (dsearchn(x,tri,[1,1/3],NA), NA);
55 %!assert (dsearchn(x,tri,[1/3,1]), 2); 55 %!assert (dsearchn(x,tri,[1/3,1]), 2);
56 %!assert (dsearchn(x,tri,[1/3,1],NaN), NaN); 56 %!assert (dsearchn(x,tri,[1/3,1],NaN), NaN);