1 | <?php |
||
16 | class LambdaInterpolation implements InterpolationInterface |
||
17 | { |
||
18 | use ArgumentsCheckTrait; |
||
19 | |||
20 | /** @var \Closure */ |
||
21 | protected $Lambda; |
||
22 | |||
23 | /** |
||
24 | * LambdaInterpolation constructor. |
||
25 | * @param \Closure $interpolationFunction |
||
26 | * @throws InvalidArgumentException |
||
27 | */ |
||
28 | public function __construct(\Closure $interpolationFunction) |
||
36 | |||
37 | /** |
||
38 | * @param \Closure $function |
||
39 | * @return bool |
||
40 | */ |
||
41 | protected function isValidClosure(\Closure $function) |
||
47 | |||
48 | /** |
||
49 | * Interpolate. |
||
50 | * |
||
51 | * p0------------p1 |
||
52 | * | | |
||
53 | * | y |
||
54 | * | | |
||
55 | * |--x-- Z |
||
56 | * | |
||
57 | * p2------------p3 |
||
58 | * |
||
59 | * @param float $x x position of Z within bounding box, required: $x in [0.0, 1.0] |
||
60 | * @param float $y y position of Z within bounding box, required: $y in [0.0, 1.0] |
||
61 | * @param array $elevationOnBoundingBox elevation data on [p0, p1, p2, p3] |
||
62 | * @return int estimated elevation on point Z |
||
63 | * @throws InvalidArgumentException |
||
64 | */ |
||
65 | public function interpolate($x, $y, array $elevationOnBoundingBox) |
||
71 | } |
||
72 |