# Virtual Reality Collision Detection Based on Improved Ant Colony Algorithm
## 5 Experiment and Results
### Experiment
Too high a sampling number will inevitably lead to a decrease in real-time detection, and too low a sampling number will lead to a decrease in the rate of detection. Therefore, in actual operation, in order to ensure the accurate detection of collisions, an appropriate number of sampling feature pairs should be selected. 1. In order to verify the impact of the ant colony's size on the performance of the collision algorithm, different ant colony sizes were selected, and the sphere-OBB-MACO algorithm was used for training on collisions of the equipment of a veneer production line. It can be seen from Figure 3 that different sizes of the ant colony had a great influence on the detection rate of the algorithm, and the detection rate maintained the law of decreasing first and then increasing. When the number of feature pairs was \(1000^{2}\), the  
\begin{table}
\begin{tabular}{c c c c c} \hline \hline  & \multicolumn{4}{c}{**Duration/ms**} \\ \hline
**Number of** & & & & \\
**Characteristic Pairs** & & & & \\
**Detection Rate 20\%** & & & & \\
**Detection Rate 60\%** & & & & \\
**Detection Rate 80\%** & & & & \\
highest detection rate could be obtained if the number of ant colonies was 40. When the number of feature pairs was 2000\({}^{2}\) and 3000\({}^{2}\), the highest detection rate could be obtained if the number of ant colonies was 50. The highest detection rate could be obtained when the number of feature pairs was 4000\({}^{2}\) and 5000\({}^{2}\) if the number of ant colonies was 60. 3. We selected the equipment of a veneer production line for the problem of detecting collisions. The number of feature pairs was 5000\({}^{2}\), the ant colony size \(m\) = 60, the initial pheromone influence factor and the expected heuristic factor \(\alpha=\beta=1\), the maximum number of iterations \(N\) = 100 and the set value \(n\) = 50. Three algorithms, namely sphere-OBB (the hierarchical bounding box algorithm), sphere-OBB-ACO and sphere-OBB-MACO, were compared and analyzed, and the final results are shown in Figure 4.  
From Figure 4, it can be seen that all three algorithms achieved stable results after 30 ms. Among them, the detection rate of the sphere-OBB-MACO algorithm was the highest (about 0.85) and sphere-OBB was the worst (about 0.65). The experimental results showed that the optimized sphere-OBB-MACO collision detection algorithm was better than the traditional bounding box algorithm and the traditional random collision detection algorithm. 1. In the fourth experiment, [PERSON]'s BOX-LSTM algorithm [30], [PERSON]'s BOX-PSO algorithm [31], [PERSON]'s BOX-DNN algorithm [32] were selected for comparison with the algorithm designed in this paper so as to judge whether the algorithm designed in this paper was superior to the algorithms designed by other researchers. According to Figure 5, the four collision detection algorithms all obtained stable detection results within 55 ms. Among them, the detection rate of the sphere-OBB-MACO algorithm was the highest (about 0.85), followed by the BOX-DNN algorithm (about 0.82) and the BOX-PSO algorithm (about 0.8); BOX-LSTM was the worst (about 0.76). From  
Figure 3: Collision detection rate of different ant colony size. the perspective of the convergence time of detection, the BOX-LSTM algorithm had the shortest detection time of about 42 ms, while the BOX-DNN was the most time-consuming (about 50 ms), and the BOX-PSO and sphere-OBB-MACO algorithms were in the middle (about 45 ms).