Half of all collision queries are about a single point. Is the mouse cursor over this button?
Is the player standing in the lava trigger? Did this particle land inside the goal zone? The
Step 1 — point in an AABB: between min and max on every axis. A point
Six comparisons, no arithmetic. The instant a coordinate falls outside its interval, the point is out and you stop — the same early-out as the box overlap test.
Step 2 — point in a sphere: compare the squared distance. A point is inside
the sphere
One subtraction, three squares, a sum, one comparison against a precomputed
Boxes and spheres are easy because they are defined by inequalities already. A triangle takes one more idea — the same one a ray tracer uses to hit a mesh face.
Step 3 — write the point in barycentric coordinates. Given a triangle
Step 4 — inside means all three weights are non-negative. Each weight is "how much of that corner" is in the mix. A negative weight means the point has stepped past the edge opposite that corner, out of the triangle. So:
Step 5 — the equivalent same-side test, with cross products. There is a
dual view that needs no division. The point is inside iff it lies on the same side of
all three directed edges. Walking the triangle
Each sign says "
Every click in a user interface is a point-in-shape test. A rectangular button is an AABB in
screen space: the cursor
In the world, designers paint invisible trigger volumes — a box around a doorway, a sphere around a campfire, a polygon outlining a capture zone — and the engine asks, each frame, "is the player's position inside?". A box trigger is Step 1, a proximity trigger is Step 2, and an irregular region is tessellated into triangles tested by Step 4. The same three inequalities decide whether a cutscene fires, whether you take fire damage, and whether the level even loads the next room. Hit-testing isn't a UI nicety — it is the same point math everywhere.