Very useful for complex UI or simple games... checking if two arbitrary non-rotated rectangles intersect:
This is the real key, most of the rest of the code here is boilerplate...
rectA.left < rectB.right &&
rectA.right > rectB.left &&
rectA.top < rectB.bottom &&
rectA.bottom > rectB.top
See more stuff like this over @ Snippet Zone
Top comments (0)