Hit-testing

In computer graphics programming, hit-testing (hit detection, picking, or pick correlation[1]) is the process of determining whether a user-controlled cursor (such as a mouse cursor or touch-point on a touch-screen interface) intersects a given graphical object (such as a shape, line, or curve) drawn on the screen.

Hit-testing may be performed on the movement or activation of a mouse or other pointing device.

Hit-testing is used by GUI environments to respond to user actions, such as selecting a menu item or a target in a game based on its visual location.

In web programming languages such as HTML, SVG, and CSS, this is associated with the concept of pointer-events (e.g. user-initiated cursor movement or object selection).

One common hit-test algorithm for axis aligned bounding boxes.