# Virtual Reality Collision Detection Based on Improved Ant Colony Algorithm
## 5 Experiment and Results  
### Experiment  
In order to test the performance of the algorithm proposed in this study for detecting collisions in virtual reality, simulation experiments were carried out. The experimental environment was a PC (version 2019; Visual Studio, Seattle, WA, USA). The OpenGL graphics library and C++ were implemented on VS2019. The simulation model was a three-dimensional model of the equipment in a veneer production line. The number of models was 90, and the average number of vertices in the object model was 750. Firstly, the performance of the sphere-OBB-MACO algorithm in terms of detecting collisions under different feature pairs was simulated. Secondly, the performance of Sphere-OBB-MACO algorithm in terms of detecting collisions with different ant colony sizes was compared, so that the appropriate ant colony size could be selected. Finally, the performance of the most commonly used virtual reality collision detection algorithms and the proposed algorithm was compared. The number of simulations for detecting collisions was 300. 1. [PERSON] believes that the number of feature pairs is an important factor affecting the performance of collision detection algorithms and has done a series of experiments to verify his conjecture [29]. The performance of the sphere-OBB-MACO algorithm in terms of detecting collisions under different feature pairs was simulated. Five feature pairs were selected to detect collisions using the sphere-OBB-MACO algorithm. The two objects with the longest motion time were selected for detection. Table 1 shows the time of collision detection. From Table 1, it can be seen that for detecting a collision between two objects, the number of different sampling features of the selected two objects was directly related to the number of feature pairs under the same accuracy in detecting collisions. At the same detection rate, a greater number of sampling feature pairs for two objects means that more feature quantities need to be iterated, so the process is more time-consuming. For example, when the number of feature pairs is \(5000^{2}\), it takes more time than when the number of feature pairs is \(1000^{2}\). However, the large quantity of features can better reflect the spatial  
Figure 2: Collision detection algorithm flow chart. position attributes of the two objects, which is more conducive to accurate detection of a collision. With the same number of feature pairs, the longer the iterative optimization time of the sphere-OBB-MACO algorithm is, the more likely it is to achieve higher accuracy in detecting collisions. In the following, the detection collision logarithm \(A\) and the actual collision logarithm \(B\) under different detection rates were compared to verify the influence of the number of feature pairs on the performance of the algorithm for detecting collisions in virtual reality. It can be seen from Table 2 that there is a certain gap between the logarithm of collisions obtained by the prediction of collisions based on the number of sampled features and the logarithm of actual collisions of the object in virtual reality. When the number of features is greater, the features involved in training are closer to the actual features of the object, and the logarithm of detected collisions is closer to the actual value. When the number of feature pairs is \(1000^{2}\), although the sphere-OBB-MACO algorithm could detect 80% of the collisions with 1000 feature pairs, these collisions only accounted for 30.2% of the actual total number of collisions. In the process of evaluating the collisions of the objects, it may cause misjudgment. Therefore, the number of feature pairs sampled by objects in virtual reality has a significant impact on the accuracy of detecting collisions between objects. If we combine the results of Tables 1 and 2, the number of feature pairs of objects sampled in virtual reality had a significant impact on the collision detection time of the sphere-OBB-MACO algorithm and the accuracy of the algorithm in detecting collisions.