## 3 Methodology
### Data Processing
#### 3.2.2 Extracting Interactive Vehicle Pairs  
After identifying all merging vehicles, it was necessary to determine the specific interacting vehicle (RSV), which is defined as the vehicle that has the highest conflict possibility with the MSV during its merging process. Firstly, the global frame was used to find all surrounding vehicles that were present at the same moment as the MSV and then identify RSVs among these vehicles. To quantify the potential conflict, the TTC metric was applied in this study. However, the conventional TTC index is not suitable for roundabout safety evaluation due to the particular structure and complexity of roundabouts. Unlike the straightforward one-dimensional method, conflicts at roundabouts are characterized in two dimensions. Conflict between the MSV and NRV was divided into two dimensions of horizontal X and vertical Y directions. The modified two-dimensional TTC (MTTC) was introduced to identify conflicts, and the calculation formulas are as follows:  
\[d_{ij}=\sqrt{\left(p_{i}-p_{j}\right)^{T}\left(p_{i}-p_{j}\right)} \tag{3}\]  
\[\dot{d_{ij}}=\frac{\left(p_{i}-p_{j}\right)^{T}\left(p_{i}-p_{j}\right)}{d_{ ij}} \tag{4}\]  
\[\dot{d_{ij}}=\frac{\left(\frac{\tau_{i}-p_{j}}{\tau}\right)^{T}\left(\tau_{i} -p_{j}\right)-\dot{d_{ij}}^{2}}{d_{ij}} \tag{5}\]  
\[T_{1}=-\frac{d_{ij}}{\dot{d_{ij}}} \tag{6}\]  
\[\Delta=\dot{d_{ij}}^{2}-2\ddot{d_{ij}}d_{ij} \tag{7}\]  
\[MTTC=\left\{\begin{array}{ll}T_{1}&if\ \ddot{d_{ij}}=0\\ +inf&if\ \Delta<0\ \text{\emph{emmin}}\left(\frac{-\dot{d_{ij}}\pm\sqrt{ \Delta}}{d_{ij}}\right)\leq 0\\ min\left(\frac{-\dot{d_{ij}}\pm\sqrt{\Delta}}{d_{ij}}\right)&if\text{\emph{ im}}\left(\frac{-\dot{d_{ij}}\pm\sqrt{\Delta}}{d_{ij}}\right)\geq 0\end{array}\right\} \tag{8}\]  
where \(p_{i}\) and \(p_{j}\) are the coordinate vectors of the two vehicles, while \(v_{i}\) and \(v_{j}\) are the velocity vectors of the two vehicles, respectively. When the acceleration difference between the two vehicles is zero, the MTTC is determined by the relative speed and distance between the two vehicles. Specifically, it is calculated as the difference in distance divided by the difference in speed. Sometimes, the vehicles' motion states make a collision impossible, for example, the leading vehicle is moving faster than the following vehicle, or they are moving apart. To represent this scenario, where no collision is possible, the MTTC is defined as infinity. This indicates that the vehicles will not collide under their current motion states. The last possibility is the scenario where the vehicles are on a trajectory that will result in a collision at some point in the future. The MTTC in this case is defined as the time remaining until the closest approach to collision, assuming the vehicles continue to move in their current states. This represents the minimum time before a potential collision occurs if the vehicles maintain their current trajectories. From the formula, it is evident that the MTTC not only accounts for the longitudinal time to collision but also incorporates lateral dynamics. This two-dimensional approach enables a more precise prediction of potential collision risks, especially in complex traffic scenarios like roundabouts, where both forward and side movements are critical. Thus, the MTTC provides an advantage in assessing safety in such intricate environments. So, we calculated the MTTC of the MSV and all surrounding vehicles throughout the merging process. The moment with the smallest MTTC was identified as the most dangerous moment.