function pointsOnLine(p, q, r, accuracy) {

  if (typeof accuracy === 'undefined') {
    accuracy = 5;
  }

  if (!p || !q || !r) {
    return false;
  }

  var val = (q.x - p.x) * (r.y - p.y) - (q.y - p.y) * (r.x - p.x),
      dist = pointDistance(p, q);

  // @see http://stackoverflow.com/a/907491/412190
  return Math.abs(val / dist) <= accuracy;
}
Returns true if the point r is on the line between p and q.

@param {Point} p
@param {Point} q
@param {Point} r
@param {number} [accuracy=5] The accuracy with which to check (lower is better).

@return {boolean}