User:Alberto Orlandini/sandbox

We want to find the shadow of a gnomon on a vertical wall. We consider a cartesian space where x points to the east, y to the north, and z towards the zenith.

Let $$n = (\cos a, \sin a, 0)$$ be the normal to the wall, where a is the azimuth counterclockwise starting from east.

Let $$g = L (\cos a \cos e, \sin a \cos e, \sin e)$$ be the gnomon, where e is the angle between the gnomon and the normal n.

Let $$r = (\cos A \cos E, \sin A \cos E, \sin E)$$ be the ray of the sun where E is the sun elevation and A is the sun azimuth counterclockwise starting from east.

The wall W can be found as a linear combination of any vector normal to n, we can take $$(0,0,1)$$ and $$(-\sin a, \cos a, 0)$$ so

$$W = (- \lambda_1 \sin a, \lambda_1 \cos a, \lambda_2)$$ where $$\lambda_1$$ and $$\lambda_2$$ are two free parameters.

Now let $$s = g - \lambda_3 r$$ be the shadow of g on the wall, where $$\lambda_3$$ is a free parameter to give r the correct length to intersect the wall.

Since s must lay on the wall, we can solve $$s=W$$ in the three free parameters and we find that

$$s = g - \frac{L \cos e}{\cos E (\cos a \cos A + \sin a \sin A)} \; r$$

Hence the length of the shadow is $$\|s\|$$

The angle H formed by the shadow with the vertical on the wall can be found since

$$\cos H = \frac{s}{\|s\|} \cdot (0,0,1)$$