Small feature overlay optimization

Compute `getSquaredTolerance` once, out of the loops.