SHARE
TWEET

Untitled

a guest Jun 25th, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const den = (x1 - x2) * (y3 - y4) - (y1 - y2) * (x3 - x4);
  2.                 if(den != 0) {
  3.                     const t = ((x1 - x3) * (y3 - y4) - (y1 - y3) * (x3 - x4)) / den;
  4.                     const u = - ((x1 - x2) * (y1 - y3) - (y1 - y2) * (x1 - x3)) / den;
  5.  
  6.                     if(t > 0 && t < 1 && u > 0) {
  7.                         const new_x = x1 + t * (x2 - x1);
  8.                         const new_y = y1 + t * (y2 - y1);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top