A trail marker is the origin. East and north are the positive axes. The point (2, 1) records a displacement of two metres east and one metre north.
Rotate anticlockwise around the origin. The east unit vector moves north and the north unit vector moves west. This gives (x, y) → (−y, x). A point at (2, 1) becomes (−1, 2).
Reflect across the vertical axis using (x, y) → (−x, y). The distance to the axis stays the same. A turn and a reflection can produce different results when their order changes.
Divide by the cell width and take the floor. With four-metre cells, −0.2 belongs to index −1. A bounding-box lookup checks nearby cells before it tests individual points.
Flow separates rotation, bucketing and reporting. The count next to each mean tells you how many readings it represents. A large cell can hide detail and a small cell can leave holes.
A game can use screen pixels and a downward-pointing vertical axis. A map can use longitude and latitude. For distances, document a suitable projected coordinate system or the metric used.