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)
  };
}
function midpoint ( pos1 , pos2 ) { var Bx = Math . cos ( pos2 . φ) ath. c os( p os2. λ  - p s1.λ ) ; var By = Math . cos ( pos2 . φ) ath. s in( p os2. λ  - p s1.λ ) ; return { φ: tan2( s in( p os1. φ )  + s n(p o s2.φ ) , sqrt ( ( cos ( pos1 . φ) x) c os( p os1. φ )  + B )  + B  * B )) , λ: os1. λ  + a an2(B y ,  c s(p o s1.φ )  + x } ; }
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
Returns the position halfway between two positions . Chiefly used to test interpolate .