A SMALL GEOMETRY LESSON

The gap between
two clear poses

A gate can miss an obstacle when it starts and finishes, yet hit it halfway through. Move the leaf to see what an endpoint check leaves out.

A quarter turn

2 m leaf · 0.2 m wide
A hinged rectangular gate beside a square obstacle The gate rotates from 0 to 90 degrees. Its hinge is at the origin. Use the angle control below.

Solid leaf = current pose. Dashed leaves = start and end. Hatching marks where the current leaf overlaps the square.

0°

Drag, or use the arrow keys in 1° steps. Home goes to 0°; End goes to 90°.

AT THE CURRENT ANGLE

Loading diagram…

Compare two obstacle positions

The square stays 0.3 m × 0.3 m.

Check just the ends

2 poses: 0° and 90°

Check every degree

91 poses: 0°, 1°, …, 90°

Clear sample Overlap or contact

WHY THE EXTRA POSES MATTER

The space between matters too.

The leaf pivots around one fixed end. At 45°, the square at (1, 1) sits on its centre line, even though it is well clear of the horizontal and vertical leaves. Checking the two ends cannot detect that overlap.

Choose Clear obstacle to move the same square beyond the leaf’s reach. The sampled check now finds no overlap. Its result still describes the sampled poses; it is not a general proof about all motion.

Taking the idea back to a game

The Lockkeeper’s Quay kit records intermediate-pose checks of both visible gate geometry and native collision shapes. Those checks examine different representations. Changing a hinge, leaf dimensions or nearby scenery calls for a fresh check in the target engine.

This separate example explains the sampling idea. It does not reproduce those checks or establish how an engine will behave.

Keep the working example

Plain HTML, CSS and JavaScript, independent geometry checks, README and MIT licence. Runs offline; no packages or build step.

Download source ZIP