If the image is taken with a telephoto lens with axis piercing the beam source so that foreshortening and off-axis effects are trivial, the situation is best viewed from the right side as you have drawn it. Then you have two similar right triangles with common vertex at the light source.
|^--..._
rA | rB| ^^__
|_____|______o (Pardon my ascii art skills.)
<--d-->
<--------x-->
You seem to know or can easily find rA, and rB the in-plane distances from beam source image to elipse center and also d the inter-plane distance. And you want to know x.
For this just set up the proportion
x / rA = (x-d) / rB.
Now you can easily solve for x.
If the image is taken with a normal lens from relatively close to the beam source, you need to know the camera geometry so that you can account for perspective effects. Even then, lens distortion can cause errors unless you know a lot about the camera and do some fancy corrections.