Looking at the image, we have the following distances, creating a right triangle:
x: horizontal distance, leg of a right triangle
y: vertical distance, leg of a right triangle
r: length of the bridge, hypotenuse of a right triangle.
So the horizontal distance the bridge needs to cover is equal to x.