Guest User

Untitled

a guest
May 21st, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. Function rotate_aabb(xmin, ymin, width, height, angle):
  2. Let c = cos(angle)
  3. Let s = sin(angle)
  4. Let halfw = 0.5*width
  5. Let halfh = 0.5*height
  6. Let xdelta = abs(c*halfw) + abs(s*halfh)
  7. Let ydelta = abs(s*halfw) + abs(c*halfh)
  8.  
  9. Let xmin = xmin + halfw - xdelta
  10. Let ymin = ymin + halfw - ydelta
  11. Let width = 2*xdelta
  12. Let height = 2*ydelta
  13.  
  14. Return (xmin, ymin, width, height)
  15. End Function
Add Comment
Please, Sign In to add comment