Advertisement
Guest User

Untitled

a guest
Dec 12th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         let width = 0.5*(A.width + B.width);
  2.         let height = 0.5*(A.height + B.height);
  3.        
  4.         let dx = A.width/2 - B.width/2;
  5.         let dy = A.height/2 - B.height/2;
  6.        
  7.         if(Math.abs(dx) <= width && Math.abs(dx) <= height){
  8.             var wy = width*dy;
  9.             var hx = height*dx;
  10.            
  11.             if(wy>hx){
  12.                 if(wy > -hx){
  13.                     //top
  14.                 }
  15.                 else
  16.                 {
  17.                     //left
  18.                 }
  19.             }
  20.             else{
  21.                 if( IdontKnow > -hx){
  22.                     //right
  23.                 } else {
  24.                     //botto,
  25.                 }
  26.             }
  27.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement