Advertisement
Guest User

Untitled

a guest
Oct 26th, 2014
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.21 KB | None | 0 0
  1. relx = x-cx
  2. rely = y-cy
  3. rotx = relx*cos(-theta) - rely*sin(-theta)
  4. roty = relx*sin(-theta) + rely*cos(-theta)
  5. dx = max(abs(rotx) - width / 2, 0);
  6. dy = max(abs(roty) - height / 2, 0);
  7. return dx * dx + dy * dy;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement