code: function lineIntersect(a1x, a1y, a2x, a2y, b1x, b1y, b2x, b2y) {
      var delta = determinant(a2x - a1x, b1x - b2x, a2y - a1y, b1y - b2y);
      if (nearZero(delta)) { // parallel
          return false;
      }
      var namenda = determinant(b1x - a1x, b1x - b2x, b1y - a1y, b1y - b2y) / delta;
      if (namenda < 0 || namenda > 1) {
          return false;
      }
      var miu = determinant(a2x - a1x, b1x - a1x, a2y - a1y, b1y - a1y) / delta;
      if (miu < 0 || miu > 1) {
          return false;
      }
      return true;
  }
docs: Code from <http://blog.csdn.net/rickliuxiao/article/details/6259322> with some fix. See <https://en.wikipedia.org/wiki/Line%E2%80%93line_intersection>