Advertisement
Guest User

Untitled

a guest
Feb 28th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. public static boolean linesIntersected(float x1, float y1, float x2, float y2, float x3, float y3, float x4,
  2. float y4) {
  3. if ((x1 * y2 + x3 * y1 + x2 * y3 - x3 * y2 - x1 * y3 - x2 * y1)
  4. * (x1 * y2 + x4 * y1 + x2 * y4 - x4 * y2 - x1 * y4 - x2 * y1) <= 0
  5. && (x3 * y4 + x1 * y3 + x4 * y1 - x1 * y4 - x3 * y1 - x4 * y3)
  6. * (x3 * y4 + x2 * y3 + x4 * y2 - x2 * y4 - x3 * y2 - x4 * y3) <= 0)
  7. return true;
  8. return false;
  9. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement