public static function isSpacingConstant(array $sorted)
    {
        $x       = 0;
        $length  = count($sorted);
        $spacing = ($sorted[$length-1][$x]-$sorted[0][$x])/($length-1);

        for ($i = 1; $i < $length - 1; $i++) {
            if ($sorted[$i+1][$x] - $sorted[$i][$x] !== $spacing) {
                throw new Exception\BadDataException('The size of each subinterval must be the same. Provide points with constant spacing.');
            }
        }
    }