First you get the distance from the lightsource to the point on the landscape. Then you cast a ray from the light source to the same point. You then compare the length of the ray compared to the distance.
Forgive me for my bad english, but I don't get. Isn't that the same in your explanation?
1. distance form light to landscape
2. ray from light to landscape.
Where/what's the difference?