fixed relative distance calculation