AMCL — likelihood field scoring (no raycast)

Instead of casting a ray per particle, AMCL bakes a distance field once (distance from every cell to the nearest wall), then scores a pose by projecting the observed scan endpoints and reading that field — an O(1) lookup per ray.

L(zk) = exp( − d(endpointk)2 / 2σ2 ) W = ∏k L(zk) d = distance from the endpoint to the nearest wall
Map + likelihood field drag to move the candidate pose
total W = ∏ L(zk) = · endpoints on a wall
faron wall
Real pose (fixed) & its scan
Candidate pose (movable)
Projected endpoint (green = near a wall)
Projected endpoint (red = in open space)
The bright halo hugging every wall is the precomputed likelihood field. A good pose lands the projected scan endpoints right on the walls (green, bright), so W is high; a wrong pose throws them into the dark open space (red) and W collapses. No rays are traced here — only endpoint projection + a field lookup, which is why it runs fast on a CPU.