A flat surface — a wall, a floor, the edge of the camera's view — is a plane,
and the question a game asks about it constantly is "which side am I on?". Is the
player above the floor or through it? Inside the view, or off-screen? Both answers fall out of
one tidy equation, built from a single point on the plane and the
Pin the plane down with one known point on it,
Step 1 — the in-plane step is perpendicular to the normal. If
That is the plane: the set of all points whose displacement from
Step 2 — expand to the standard form. Distribute the dot product and move
the constant to the right. Writing
(In coordinates with
Step 3 — with a unit normal, the leftover is a signed distance. Take
is the signed distance from
Step 4 — read the sign as the side. Because the normal has unit length,
"Which side am I on?" is the sign of one dot product minus a constant — no square roots, no division.
The view a camera can see is a box — the frustum — bounded by six planes
(left, right, top, bottom, near, far), each with its normal pointing inward. An
object is visible only if it sits on the positive side of all six. So
frustum culling is just six signed-distance tests: compute
Collision against a flat surface is the same test wearing different
clothes. The signed distance of a ball's centre to the floor plane is how far the
ball is from touching: when