bool intersect (vec2 a, vec2 b, vec2 c, vec2 d) { return intersect_1 (a.x, b.x, c.x, d.x) && intersect_1 (a.y, b.y, c.y, d.y) && area(a,b,c) * area(a,b,d) <= 0 && area(c,d,a) * area(c,d,b) <= 0; }
bool intersect (float ax, float ay, float bx, float by, float cx, float cy, float dx, float dy) { return intersect_1 (ax, bx, cx, dx) && intersect_1 (ay, by, cy, dy) && area(ax, ay, bx, by, cx, cy) * area(ax, ay, bx, by,dx, dy) <= 0 && area(cx, cy, dx, dy, ax, ay) * area(cx, cy, dx, dy, bx, by) <= 0; }
bool intersect (pt a, pt b, pt c, pt d) { int s11 = square (a, b, c); int s12 = square (a, b, d); int s21 = square (c, d, a); int s22 = square (c, d, b); if (s11 == 0 && s12 == 0 && s21 == 0 && s22 == 0) return intersect_1 (a.x, b.x, c.x, d.x) && intersect_1 (a.y, b.y, c.y, d.y); else return (s11 * s12 <= 0) && (s21 * s22 <= 0); }