# Algorithmic Coverage Quantification and Visualization in Range-Free Sensor Networks
## 2 Materials and Methods
### Creating Sensor Objects  
After creating the map, we employed object-oriented programming (OOP) to create SR objects. A \"Sensor\" class encapsulates each \(SR_{i}\)'s attributes (e.g., location, range) and functionalities, see Figure 2. The SR objects created by this class simplify both the setup of all SRs and the visualization of their coverage areas on the map.  
To instantiate an SR object, the createSensor( ) function within the \"Sensor\" class undertakes several steps. Firstly, it positions each \(SR_{i},i=1,\dots,n\) on the map, assigns an icon to it, and adds a marker at the specified location. Subsequently, the createSensor( ) function computes the angles \(\theta^{ij}\) between \(SR_{i}\) and each known \(TR_{j},j=1,\dots,m_{i}\) that lies within the sensing range of \(SR_{i}\) (so that \(m_{i}\leq M\), where \(M\) is the total number of TRs). For this calculation, geopy is utilized, together with the Haversine formula [22], as outlined in the flowchart depicted in Figure 3.  
Figure 2: Class diagram of the “Sensor” class.  
Following the calculations, the angles \(\theta^{i,j}\) are sorted in a clockwise direction. The createSensor( ) function then proceeds to identify the \(B_{i}\) blind zones caused to the \(SR_{i}\) by the presence of each \(TR_{j}\), where \(j=1,\ldots,m_{i}\). Under the condition where \(\theta^{i,j+1}-\theta^{i,j}>\delta_{before}+\delta_{after}\), for \(j=1,\ldots,(m_{i}-1)\), there is \(B_{i}=m_{i}\). These blind zones represent angular intervals \(b^{i,j}\) within which the view of \(SR_{i}\) is obstructed due to the presence of \(TR_{j}\), (refer to Figure 4a). These angular intervals \(b^{i,j}\) are calculated taking into account the given detection error, which ranges from \(\delta_{before}\) to \(\delta_{after}\) degrees from the actual direction of \(TR_{j}\) (please refer to the \"Definitions\" sub-section), and are defined as follows:  
\[\left\{b^{i,j}=\left[\theta^{i,j}-\delta_{before},\theta^{i,j}+\delta_{after} \right],j=1,\ldots,m_{i},\ i=1,\ldots,n\right\}\]  
Otherwise, if \(\theta^{i,j+1}-\theta^{i,j}\leq\delta_{before}+\delta_{after}\), \(j=1,\ldots,(m_{i}-1)\), the blind zones caused by nearby TRs overlap (see Figure 4b); hence, there is \(B_{i}<m_{i}\).  
Figure 4: Illustration of how the presence of two nearby transmitters \(TR_{j}\)(represented in light green) and \(TR_{j+1}\) (represented in light red) creates blind zone openings for a sensor \(SR_{i}\). The angle \(\theta^{i,j}\) denotes the bearing between \(SR_{i}\) and \(TR_{j}\), with detection error ranging from \(\delta_{before}\) to \(\delta_{after}\) degrees from the actual direction of \(TR_{j}\). (**a**) When \(\theta^{i,j+1}-\theta^{i,j}>\delta_{before}+\delta_{after}\), two separate blind zones are formed for \(SR_{i}\) due to transmitters \(TR_{j}\) and \(TR_{j+1}\). (**b**) If \(\theta^{i,j+1}-\theta^{i,j}<\delta_{before}+\delta_{after}\), the blind zones caused by \(TR_{j}\) and \(TR_{j+1}\) overlap, resulting in one combined blind zone for \(SR_{i}\).  
Figure 3: Flowchart describing the process of calculating the bearing angle between two given points.  
After identifying the \(B_{i}\) blind zones, the createSensor( ) function removes them from \(SR_{i}\)'s total detection area. Upon this removal, \(Q_{i}\) circular sector coverage zones remain, centered on \(SR_{i}\), each with a radius equal to \(R_{i}\), These circular sectors are then approximated as polygons by discretizing each sector with an angular step error (resolution) of \(\varepsilon_{\theta}\). For further details, please refer to the flowchart in Figure 5. Each q-th circular sector of \(SR_{i}\) (where \(q=1,\ldots,Q_{i}\)) is represented as a list \(L_{i,q}\) which contains the geographic coordinates of the polygon vertices that define the circular sector. This completes the calculations of createSensor( ) function.