src/Interpolation/BilinearInterpolation.php
public function interpolate($x, $y, array $elevationOnBoundingBox)
    {
        $this->checkArguments($x, $y, $elevationOnBoundingBox);

        return (int) round(
            $elevationOnBoundingBox[0] * (1 - $x) * (1 - $y)
            + $elevationOnBoundingBox[1] * $x * (1 - $y)
            + $elevationOnBoundingBox[2] * $y * (1 - $x)
            + $elevationOnBoundingBox[3] * $x * $y
        );
    }
public function interpolate($x, $y, array $elevationOnBoundingBox)
    {
        $this->checkArguments($x, $y, $elevationOnBoundingBox);

        return (int) round(
            $elevationOnBoundingBox[0] * (1 - $x) * (1 - $y)
            + $elevationOnBoundingBox[1] * $x * (1 - $y)
            + $elevationOnBoundingBox[2] * $y * (1 - $x)
            + $elevationOnBoundingBox[3] * $x * $y
        );
    }
public function interpolate ( $ x , $ y , array $ elevationOnBoundingBox ) { $ this -> checkArguments ( $ x , $ y , $ elevationOnBoundingBox ) ; return ( int ) round ( $ elevationOnBoundingBox [ 0 ] * ( 1 - $ x ) * ( 1 - $ y ) + $ elevationOnBoundingBox [ 1 ] * $ x * ( 1 - $ y ) + $ elevationOnBoundingBox [ 2 ] * $ y * ( 1 - $ x ) + $ elevationOnBoundingBox [ 3 ] * $ x * $ y ) ; }
Interpolate.

p0------------p1
|      |
|      y
|      |
|--x-- Z
|
p2------------p3

@param  float                    $x                      x position of Z within bounding box, required: $x in [0.0, 1.0]
@param  float                    $y                      y position of Z within bounding box, required: $y in [0.0, 1.0]
@param  array                    $elevationOnBoundingBox elevation data on [p0, p1, p2, p3]
@return int                      estimated elevation on point Z
@throws InvalidArgumentException
Interpolate .