Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let width = 0.5*(A.width + B.width);
- let height = 0.5*(A.height + B.height);
- let dx = A.width/2 - B.width/2;
- let dy = A.height/2 - B.height/2;
- if(Math.abs(dx) <= width && Math.abs(dx) <= height){
- var wy = width*dy;
- var hx = height*dx;
- if(wy>hx){
- if(wy > -hx){
- //top
- }
- else
- {
- //left
- }
- }
- else{
- if( IdontKnow > -hx){
- //right
- } else {
- //botto,
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement