lib/sphere/positions.js
function midpoint(pos1, pos2) {
  var Bx = Math.cos(pos2.φ) * Math.cos(pos2.λ - pos1.λ);
  var By = Math.cos(pos2.φ) * Math.sin(pos2.λ - pos1.λ);

  return {
    φ: atan2(sin(pos1.φ) + sin(pos2.φ),
      sqrt((cos(pos1.φ) + Bx) * (cos(pos1.φ) + Bx) + By * By)),
    λ: pos1.λ + atan2(By, cos(pos1.φ) + Bx)
  };
}
function midpoint(pos1, pos2) {
  var Bx = Math.cos(pos2.φ) * Math.cos(pos2.λ - pos1.λ);
  var By = Math.cos(pos2.φ) * Math.sin(pos2.λ - pos1.λ);

  return {
    φ: atan2(sin(pos1.φ) + sin(pos2.φ),
      sqrt((cos(pos1.φ) + Bx) * (cos(pos1.φ) + Bx) + By * By)),
    λ: pos1.λ + atan2(By, cos(pos1.φ) + Bx)
  };
}
Returns the position halfway between two positions.
Chiefly used to test `interpolate`.

@param {object} pos1
@param {number} pos1.φ - first latitude in radians
@param {number} pos1.λ - first longitude in radians

@param {object} pos2
@param {number} pos2.φ - second latitude in radians
@param {number} pos2.λ - second longitude in radians

@return {object} pos3 - result
@return {number} pos3.φ - result latitude in radians
@return {number} pos3.λ - result longitude in radians