Jump to content

Hit-testing

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Shepazu (talk | contribs) at 17:35, 26 March 2011 (explicated pointer-events). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

In computer graphics programming, hit-testing 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 shape, line, or curve drawn on the screen. This may be done for movements of the pointer or the underlying shape, or restricted to user-initiated selection, such as a mouse-click.

Hit-testing is important for user interfaces and interactivity.

In some graphics languages and graphics textbooks, hit-testing is known as "hit detection" or "picking" [1]. In Web programming languages such as SVG and CSS, this is associated with the concept of pointer-events (e.g. user-initiated cursor movement or object selection).

There are many different algorithms that may be used to perform hit-testing, with different performance or accuracy outcomes.

Collision detection is a related concept for detecting intersections of two or more different shapes, points, or lines, rather than intersection of one or more shapes with a cursor.

See also

References

  1. ^ Computer Graphics: Principles and Practice 2nd Edition in C, Foley et al, Addison-Wesley, 1997.