Skip to content

Instantly share code, notes, and snippets.

@OneSadCookie
Created May 7, 2011 19:36
Show Gist options
  • Save OneSadCookie/960764 to your computer and use it in GitHub Desktop.
Save OneSadCookie/960764 to your computer and use it in GitHub Desktop.
Rectangle#intersects
intersects: (other) ->
((other.x >= @x &&
other.x <= @x + @width) ||
(other.x + other.width >= @x &&
other.x + other.width <= @x + @width)) &&
((other.y >= @y &&
other.y <= @y + @height) ||
(other.y + other.height >= @y &&
other.y + other.height <= @y + @height))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment