## 2 Materials and Methods
### DEM-Based Shadow Coarse Detection Method
#### 2.3.2. Shade Analysis Radius  
When calculating the maximum terrain height angle of the origin in the direction of the solar azimuth, it is necessary to determine what points on the ray are to be counted. Each of these terrain height angles, formed by the potential points and the origin, may be greater than the origin's solar elevation angle at that time. We can set a shade analysis radius and then locate the points centered on the origin in the ray toward the Sun within the radius. The presence or absence of light at the origin can be determined by simply calculating these points. Figure 6 illustrates the diagram for determining whether the origin is illuminated or not. The significance of the shade analysis radius is that for the origin, as long as the points on the line within the radius do not block the light, then there will be no point outside the radius that can block the light; if there is a blocking point within the radius, that is, the terrain height angle between the point and the origin is greater than the solar elevation angle, then the origin is in shadow. The shade analysis radius is different for different moments and different points. Calculating the shade analysis radius is a two-step process: firstly, calculate the global shade radius \(r_{g}\), and then calculate the local shade radius \(r_{l}\) within \(r_{g}\). The global shade radius is the range covered by the highest point of the earth relative to the origin at this time. Find the highest elevation among all the points located within the range \(r_{g}\) along the ray towards the Sun, and then calculate the range covered by this elevation relative to the origin at this time, which is the local shade radius. In Figure 7, \(A\) is the location of the point where we want to calculate the shade analysis radius, and point \(B\) is the virtual location of the highest point in the world (Mt Everest 8848.86 m), which is determined based on the global shade radius of \(A\). That is, the furthest point of the shade caused by \(B\) at this time is \(A\). We can calculate the solar elevation angle of \(A\)\(\theta_{e}\) according to its latitude and longitude at this time. Whether \(A\) is shaded is only related to the relationship between the terrain height angle and the solar elevation angle, while the terrain height angle is only related to the elevation difference. So, we only need to consider the difference between the elevation of the highest point \(h_{p}\), and the elevation of \(A\)\(h_{i}\). Therefore, the elevation of \(B\) can be set to \(h_{p}-h_{i}\) and the elevation of \(A\) is zero. Figure 6: Diagram for determining whether the origin is illuminated or not. Knowing the mean radius of the earth \(R_{e}=6.371\times 10^{6}\) m, the global shade radius of \(A\ r_{g}\) and the dip angle of the line connecting AB with respect to the horizon at \(A\ \theta_{d1}\) can be obtained by making a system of equations as follows:  
\[ \begin{cases}r_{g}\cdot\tan\theta_{e}+r_{g}\cdot\tan\theta_{d1}=h_{p}-h_{i}\\ R_{e}\cdot\tan(2\theta_{d1})=r_{g}\end{cases}  \tag{2}\]  
The global shade radius is the longest and most specific type of shade analysis radius. In practice, the local shade radius may not be equal to the global shade radius unless the sampling area is located near the highest point. The global shade radius only provides a pre-defined reference range within which to find and compute a realistic local shade radius for the point without considering a longer range. Find the highest point \(C\) on the ray of \(A\) towards the Sun within \(r_{g}\), the elevation of which is \(h_{j}\), and then make the same set of equations to obtain \(r_{l}\):  
\[ \begin{cases}r_{l}\cdot\tan\theta_{e}+r_{l}\cdot\tan\theta_{d2}=h_{j}-h_{i}\\ R_{e}\cdot\tan(2\theta_{d2})=r_{l}\end{cases}  \tag{3}\]  
For the origin, the maximum terrain height angle formed by the points on the line within the local shade radius is calculated and compared to the solar elevation angle to find out if there is light or not.