39
|
1 |
#======================================================================
|
|
2 |
# . I N T E R P . N N B R
|
|
3 |
# doc: Wed Nov 22 21:01:09 2000
|
|
4 |
# dlm: Wed Aug 3 11:48:59 2011
|
|
5 |
# (c) 2000 A.M. Thurnherr
|
|
6 |
# uE-Info: 32 0 NIL 0 0 72 8 2 4 NIL ofnI
|
|
7 |
#======================================================================
|
|
8 |
|
|
9 |
# nearest neighbor resampling
|
|
10 |
|
|
11 |
# HISTORY:
|
|
12 |
# Nov 22, 2000: - adapted from [.interp.linear]
|
|
13 |
# Apr 3, 2004: - added nominal -x
|
|
14 |
# Jan 12, 2006: - renamed from [.interp.subsample]
|
|
15 |
# Jul 28, 2006: - added xf to ISInit() args
|
|
16 |
# Aug 22, 2006: - adapted to work with [match]
|
|
17 |
# Aug 5, 2008: - added idr param to IS_init()
|
|
18 |
# Aug 3, 2011: - removed -x, which is now handled by [resample]
|
|
19 |
|
|
20 |
# see [.interp.linear] for documentation of interface
|
|
21 |
|
|
22 |
$IS_opts = "";
|
|
23 |
$IS_optsUsage = "";
|
|
24 |
|
|
25 |
sub IS_usage() {}
|
|
26 |
sub IS_init($$$$) {}
|
|
27 |
|
|
28 |
sub IS_interpolate($$$$$$)
|
|
29 |
{
|
|
30 |
my($bR,$idR,$xf,$xv,$xi,$f) = @_;
|
|
31 |
|
|
32 |
return $bR->[$xi+1][$f]
|
|
33 |
if ($bR->[$xi+1][$xf] - $xv < $xv - $bR->[$xi][$xf]);
|
|
34 |
return $bR->[$xi][$f];
|
|
35 |
}
|
|
36 |
|
|
37 |
1;
|