/**
  * Calculates the centers of two points and
  * applies the function to the two points,
  *
  * @param Geometry $point_a The first point.
  * @param Geometry $point_b The second point.
  * @param closure  $f Function to apply.
  * @return float Result of application of $f.
  */
 private static function apply($point_a, $point_b, $f)
 {
     $center_a = $point_a->centroid();
     $center_b = $point_b->centroid();
     $coor_a = new Coordinate($center_a->y(), $center_a->x());
     $coor_b = new Coordinate($center_b->y(), $center_b->x());
     return $f($coor_a, $coor_b);
 }