# Star Identification Algorithm Based on Dynamic Distance Ratio Matching
## 3 Star Identification Algorithm
### Matching Calculation  
The angles and distance features of the neighboring stars of the reference star \(R\) are defined as \(ref=\{(\theta_{1},r_{1}),(\theta_{2},r_{2}),\ldots,(\theta_{m},r_{m})\}\), while the angles and distance features of the neighboring stars of the candidate star \(star_{id}\) are defined as \(pat_{id}=\{(\psi_{1},d_{1}),(\psi_{2},d_{2}),\ldots,(\psi_{n},d_{n})\}\). Here, \(m\) and \(n\) represent the number of neighboring stars generated for the reference star and the candidate star, respectively. Through the initial identification process, it can be seen that the \(k\)-th adjacent star feature of the reference star is matched with the \(k\)-th adjacent star feature of the candidate star. Based on this cumulative angle, the number of feature matches \(num_{match}\) between the reference star \(R\) to be identified and the selected candidate star \(star_{id}\) is calculated. First, the features \(ref\) and \(pat_{id}\) are cyclically shifted \(k\) times and \(l\) times, respectively, to obtain \(shift\_ref=\{(\alpha_{1},\beta_{1}),(\alpha_{2},\beta_{2}),\ldots,(\alpha_{m}, \beta_{m})\}\), \(shift\_pat_{id}=\{(a_{1},b_{1}),(a_{2},b_{2}),\ldots,(a_{n},b_{n})\}\), and it is easy to know that the starting neighbor features in \(shift\_ref\) and \(shift\_pat_{id}\) have been matched by \(\{\theta_{k},r_{k}\}\) and \(\{\psi_{l},d_{l}\}\), respectively. This satisfies Equation (9):  
\[\left\{ \begin{array}{l}(\alpha_{1},\beta_{1})\equiv(\theta_{k},r_{k})\\ (a_{1},b_{1})\equiv(\psi_{l},d_{l})\end{array} \right. \tag{9}\]  
Based on the cyclic shift features \(shift\_ref\) and \(shift\_pat_{id}\), and using the angle of them, the cumulative angle features \(angle_{ref}=\{\omega_{1},\omega_{2},\ldots,\omega_{m}\}\) and \(angle\_pat_{id}=\{\mu_{1},\mu_{2},\ldots,\mu_{n}\}\) are constructed, and each element is defined as follows:  
\[\left\{ \begin{array}{l}\omega_{l}=\sum_{t=1}^{i}\alpha_{t}\quad i\in\{1,2, \ldots,m\}\\ \mu_{j}=\sum_{t=1}^{j}a_{t}\quad j\in\{1,2,\ldots,n\}\end{array} \right. \tag{10}\]  
The \(angle_{ref}\) and \(angle\_pat_{id}\) could be used for the purpose of match calculations. The closest cumulative angles \(\omega_{i}\) and \(\mu_{j}\) are taken as the matching candidates pair by traversing through the \(angle_{ref}\) and \(angle\_pat_{id}\), which satisfies  
\[|\omega_{i}-\mu_{j}|\leq\varepsilon_{angle} \tag{11}\]  
where \(i\) and \(j\) are the \(i\)-th element in \(angle_{ref}\) and the \(j\)-th element in \(angle\_pat_{id}\), respectively, and \(\varepsilon_{angle}\) is the threshold for cumulative angle matching. When \(\omega_{i}\) and \(\mu_{j}\) satisfy Equation (11), only angle information is used. To reduce redundancy in matching, it is also necessary to calculate the current distance ratio as an additional feature for verification. The calculation of distance ratios is closely related to the selection of comparison objects. To enhance the robustness of the identification algorithm, it is essential not to fix any specific neighboring star as the comparison object. Instead, a dynamic selection method should be used to reduce mutual interference between neighboring stars. In dynamically calculating the distance ratio, the distance between the current neighboring star and the previously successfully matched neighboring star is selected each time to compute the ratio. This method effectively reduces interference from factors such as false stars and missing stars. Based on the matching results of \(\omega_{i}\) and \(\mu_{j}\), the corresponding distances \(\beta_{i}\) and \(b_{j}\) of the current matching candidate can be obtained. To calculate the distance ratio for the current valid angle, the previously saved distances \(\beta_{last\_i}\) and \(b_{last\_j}\) from the prior match are required.