double alpha = (x1 + beta * (x2 - x1) - x3) / (x4 - x3); return alpha >= 0.0 && alpha <= 1.0;
} } } else if ((a2 = area2(x1, y1, x2, y2, x4, y4)) == 0.0) {   return between(x1, y1, x2, y2, x4, y4); }  if ((a3 = area2(x3, y3, x4, y4, x1, y1)) == 0.0) {   if (between(x3, y3, x4, y4, x1, y1)) { return true; } else { if (area2(x3, y3, x4, y4, x2, y2) == 0.0) { return between(x1, y1, x2, y2, x3, y3) || between (x1, y1, x2, y2, x4, y4); } else { return false; } } } else if ((a4 = area2(x3, y3, x4, y4, x2, y2)) == 0.0) {   return between(x3, y3, x4, y4, x2, y2); } else { return ((a1 > 0.0) ^ (a2 > 0.0)) && ((a3 > 0.0) ^ (a4 > 0.0)); }
  public static boolean linesIntersect(double x1, double y1,                                       double x2, double y2,                                       double x3, double y3,                                       double x4, double y4)  {    double beta = (((y1 - y3) * (x4 - x3) + (x1 - x3) * (y4 - y3))                   / ((y2 - y1) * (x4 - x3) + (x2 - x1) * (y4 - y3)));		if (beta < 0.0 || beta > 1.0)			return false;		double alpha = (x1 + beta * (x2 - x1) - x3) / (x4 - x3);		return alpha >= 0.0 && alpha <= 1.0;	}