lib/sphere/positions.js
function course(pos1, pos2) {

  var f1_φ = pos1[0],
      f1_λ = pos1[1],
      f2_φ = pos2[0],
      f2_λ = pos2[1];

  var d = distance(f1_φ, f1_λ, f2_φ, f2_λ), a, course = {};

  if (sin(f2_λ - f1_λ) < 0) {
    a = acos((sin(f2_φ) - sin(f1_φ) * cos(d)) / (sin(d) * cos(f1_φ)));
  } else {
    a = 2 * π - acos((sin(f2_φ) - sin(f1_φ) * cos(d)) / (sin(d) * cos(f1_φ)));
  }

  course.d = d;
  course.a = a;

  return course;
}
function course(pos1, pos2) {

  var f1_φ = pos1[0],
      f1_λ = pos1[1],
      f2_φ = pos2[0],
      f2_λ = pos2[1];

  var d = distance(f1_φ, f1_λ, f2_φ, f2_λ), a, course = {};

  if (sin(f2_λ - f1_λ) < 0) {
    a = acos((sin(f2_φ) - sin(f1_φ) * cos(d)) / (sin(d) * cos(f1_φ)));
  } else {
    a = 2 * π - acos((sin(f2_φ) - sin(f1_φ) * cos(d)) / (sin(d) * cos(f1_φ)));
  }

  course.d = d;
  course.a = a;

  return course;
}
Returns the course between two positions.

@param {object} pos1

@param {object} pos2

@returns {object} course
@returns {number} course.a - the heading at pos1 in radians clockwise from the local meridian
@returns {number} course.d - the distance traveled