code: function liesOnSegment(s, p) {
    if (nearlyEquals(s.p1.x, s.p2.x)) return isBetween(p.y, s.p1.y, s.p2.y);
    return isBetween(p.x, s.p1.x, s.p2.x);
  }
docs: ----------------------------------------------------------------------------- Intersections