Hybrid collision detection method in virtual operation simulation system
By combining GPU-accelerated spatial segmentation algorithm and hierarchical bounding box algorithm in the virtual surgical simulation system, efficient and accurate collision detection is achieved, solving the problem of limited real-time performance of surgical simulation in the prior art.
Patent Information
- Application Number
- CN202411059504.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-04
- Publication Date
- 2025-03-11
AI Technical Summary
The prior art is difficult to achieve efficient and accurate collision detection in virtual surgical simulation systems, especially in soft tissue deformation simulation, resulting in limited real-time performance of surgical simulation.
A hybrid collision detection method is adopted, combined with GPU-accelerated spatial segmentation algorithm and hierarchical bounding box algorithm, which is divided into two stages: rough detection and detailed detection. The hash table optimizes the spatial reduction and the construction of hierarchical bounding box tree to achieve efficient collision detection.
Improves the efficiency and accuracy of collision detection, reduces unnecessary calculations, and accelerates the entire detection process, making it more suitable for real-time applications and soft tissue deformation simulation in complex environments.
Smart Images

Figure CN119600227A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of virtual reality medical technology, and in particular relates to a collision detection problem between a soft tissue model and a surgical instrument in a virtual surgery simulation system. Background Art
[0002] Collision detection technology, as a key technology for determining whether objects are in contact or collision, plays a vital role in the core architecture of virtual surgical simulation systems. Especially when virtual surgical instruments interact delicately with highly simulated soft tissues, the accuracy and efficiency of the collision detection algorithm become the core elements to ensure the fidelity and smoothness of surgical simulation. In the complex process of soft tissue deformation simulation modeling, collision detection is an indispensable part, because even a slight collision may cause distortion of the entire model. However, the huge amount of computation associated with the collision detection algorithm often becomes a major challenge that limits the real-time performance of the simulation system.
[0003] Collision detection algorithms can be finely divided into two major areas: static detection algorithms and dynamic detection algorithms, depending on how they respond to the motion states of objects. Static detection algorithms focus on predicting potential collisions between stationary objects and are widely praised for their efficient computing and low real-time requirements. In contrast, dynamic detection algorithms are dedicated to tracking and predicting the possibility of collisions between objects in dynamic changes, and the increase in their processing complexity also requires higher computing resources accordingly. Within the dynamic detection algorithm, it can be further refined into two methods, discrete detection and continuous detection, depending on the detection method. The former detects the collision state of an object by setting a fixed time interval, while the latter continuously tracks the object's motion trajectory to achieve more accurate and immediate collision prediction.
[0004] In the field of collision detection technology, domestic and foreign scholars have conducted extensive and in-depth research and proposed a variety of efficient collision detection algorithms. Among them, Chazelle et al. (Chazelle B. An optimal algorithm for intersection three-dimensional convex polyhedral [J]. In Proceedings of 30th anniversary IEEE symposium on foundation computer science, 1989: 586-591.) developed a series of widely used static collision detection algorithms. In order to enhance the accuracy of collision detection algorithms, Canny et al. (Canny JF. Collision detection for moving polyhedral [J]. IEEE Transactions on PAMI, 1986, 8 (2): 200-209.) conducted in-depth research on continuous collision detection of dynamic polygons and successfully developed a series of new algorithms, which effectively overcame the accuracy limitations of static detection algorithms. However, due to the challenges of continuous collision detection in terms of computing speed, researchers began to pay more attention to the research of discrete detection algorithms. In the field of object space collision detection, space partitioning method and hierarchical bounding box algorithm have become research hotspots. Spatial partitioning methods, including octree, BSP tree (Binary Space Partitioning Tree) and uniform grid partitioning, are widely used to improve the efficiency and accuracy of collision detection. For example, Turk et al. (Turk G. Interactive Collision Detection for Molecular Graphics [J]. University of North Carolina at Chapel Hill, 1989.) significantly accelerated the collision query process by combining uniform grid partitioning and spatial hash table methods, thereby improving the real-time performance of collision detection. Luque et al. (Luque RG, Comba JLD, Freitas CMD S. Broad-phase collision detection using semi-adjusting BSP-trees [C]. Interactive 3D Graphics and Games. ACM, 2005.) proposed a BSP tree method that can efficiently handle intersection tests of two or more objects. Hierarchical bounding box algorithms are widely used.For example, Wei Yingmei et al. from the National University of Defense Technology (Wei Yingmei, Wang Yong, Wu Quanyuan, et al. Research on collision detection in virtual surgery simulation [D]. Journal of System Simulation, 2000, 5(12): 572-575.) proposed a hierarchical bounding box method based on discrete directional polyhedrons (K-Dops) in 2000, which is specifically used for virtual surgery simulation. It has a compact structure and simple construction, which effectively improves the collision detection performance. With the rapid development of GPU technology, more and more researchers have begun to explore the application of GPU in collision detection. Ye Liming et al. from Jilin Agricultural University (Ye Liming. A fast collision detection algorithm based on GPU acceleration [D]. Jilin Agricultural University, 2016.) successfully proposed a fast collision detection algorithm based on GPU acceleration. This innovative research has injected new vitality into the development of collision detection technology and is expected to promote further breakthroughs in related fields in the future.
[0005] In summary, although the existing methods have shown certain results in virtual surgical simulation systems, how to develop a collision detection algorithm with excellent performance is still a major challenge. An efficient collision detection algorithm is crucial to ensure the real-time and authenticity of surgical simulation. The efficiency and real-time performance of collision detection directly determine the realism of surgical simulation, because any slight collision may cause model distortion. Therefore, collision detection plays a vital role in virtual surgical simulation systems. Given the core position of collision detection in virtual surgical simulation systems and the huge computational burden it brings to the real-time performance of simulation. Therefore, designing a collision detection algorithm with good performance for virtual surgical systems is an urgent problem to be solved today. Summary of the invention
[0006] The purpose of the present invention is to address the problems existing in the prior art and propose a hybrid collision detection method in a virtual surgery simulation system. This method is a hybrid collision detection method based on a combination of a GPU-accelerated spatial segmentation algorithm and a hierarchical bounding box algorithm. While ensuring the detection accuracy, it improves the efficiency of collision detection, making it more suitable for real-time applications and soft tissue deformation simulation in complex environments. The present invention is applicable to a variety of surgical instruments and various soft tissue model interaction scenarios.
[0007] The present invention is achieved through the following technical solutions.
[0008] The present invention discloses a hybrid collision detection algorithm in a virtual surgery simulation system, which divides the collision detection into two stages: rough detection and detailed detection.
[0009] A hybrid collision detection method in a virtual surgery simulation system according to the present invention comprises the following steps:
[0010] Step 1: Construct surgical instrument and soft tissue models: First, the soft tissue model and surgical instrument model were constructed with the help of 3D object modeling software. Both models are based on basic triangular meshes, which have different sizes but together constitute the core skeleton of the model.
[0011] Step 2: Divide the virtual space into grids of the same size, index the object models, use GPU multithreading to accelerate the construction and update of the spatial information hash table, and map the grids occupied by all primitive bounding boxes into the hash table based on the results of the spatial hash storage function calculation, and determine the objects in the same space based on the spatial hash table. Specifically, it includes:
[0012] (1) Finely divide the three-dimensional space into grids, and select the appropriate size of grid units according to the size of the experimental object model. If the grid is too large, there will be too many primitives in a single grid, and if it is too small, the primitives may span multiple grids.
[0013] (2) Through the hash function, the grids occupied by all primitive bounding boxes are mapped to the hash table. The established spatial hash storage function is as follows:
[0014] hash(l,m,n)=l+m×d x +n×d y ×d z
[0015] The hash function is based on the spatial index value (l, m, n) and the number of grid divisions (d x ,d y ,d z ) is calculated. The hash table not only stores valid data cells, but also can realize the rapid allocation of primitives and the precise positioning of potential intersecting cells according to the hash table principle. The information of primitives stored in the grid in the hash table is shown in the attached figure. Figure 1 shown.
[0016] The 3D model constructed by the triangle mesh is the main object of collision detection. Each triangle face is composed of three 3D vertices, which may be distributed in different mesh units. To cope with this complexity, the hash table is specially designed to store multi-key and multi-value data types.
[0017] When updating the hash table, the updating of primitive information in the uniform grid involves a lot of calculations. With the computing power of the GPU, an efficient hash table was successfully constructed. This table not only stores data cells efficiently, but also enables fast allocation of primitives and accurate identification of potentially intersecting cells. The hash table uses key-value pairs for data storage, where the key is used to quickly locate the position of the triangle in the grid, and the value contains valid data about the triangle.
[0018] Step 3: Before solving the intersection between objects, perform spatial reduction and optimize the hash table: by eliminating the subspace cells that only contain triangles of a single object, only cells that contain both surgical instruments and soft tissue triangles are retained. After spatial reduction, a batch of potentially intersecting spatial subcells are obtained, which contain primitive triangles of both surgical instruments and soft tissues. This is ready for subsequent intersection tests. This optimization significantly improves the efficiency and accuracy of collision detection, reduces unnecessary calculations, and speeds up the entire detection process.
[0019] Step 4: construct hierarchical bounding boxes for objects that may collide, and perform intersection detection; if a node or its subnodes are detected to be intersecting, execute the next step, otherwise exit the detection. The specific steps are as follows:
[0020] The top-down method is used to construct the hierarchical bounding box. At the same time, the minimum-maximum form is selected to represent the geometric expression of the AABB bounding box. The boundary of the AABB bounding box is defined according to the following formula:
[0021] R={(x,y,z)|x min ≤x≤x max ,y min ≤y≤y max , z min ≤z≤z max}
[0022] In the virtual scene, hierarchical bounding box trees are constructed for surgical instruments and soft tissues respectively. By recursively traversing these tree structures, potential collision areas are accurately locked. Multi-threaded parallel processing can be used to allow the GPU to execute the same code at the same time, but process different data, thereby greatly reducing the calculation time. When constructing a hierarchical tree, first use an AABB bounding box to wrap the entire soft tissue as the root node of the binary tree. Subsequently, the root node is divided into two, and each sub-part is wrapped with a new bounding box, and the subdivision is recursively repeated until the soft tissue object is completely subdivided to form the bottom leaf node.
[0023] When making intersection judgments, the breadth-first traversal strategy is adopted to efficiently traverse the two bounding box trees, thereby determining whether the two objects collide at the current position and state. The specific process of traversal is: first, starting from the root node of the bounding box tree of one object, traverse the bounding box tree of the other object. If its leaf node can be reached, the bounding box tree of the first object is traversed in reverse using this leaf node until its leaf node is reached. After reaching the leaf node, the basic geometric element intersection test is performed. If it is detected that the bounding boxes do not intersect during this process, the possibility of the bounding objects intersecting can be quickly ruled out, which greatly saves time and space costs.
[0024] Step 5. After the above steps, it can be determined that the potential intersecting primitives have been obtained. Next, the intersection detection between the two triangles is completed: a determinant consisting of four points is defined in three-dimensional space, and then whether the two triangles intersect is determined based on the sign of the determinant.
[0025] The determinant [a,b,c,d] is composed of four points a,b,c,d in three-dimensional space, and the calculation formula is as follows:
[0026]
[0027] Among them, x, y, z are coordinates.
[0028] Assume that points a, b, and c are not collinear and form triangle T counterclockwise. Triangle T is on the supporting plane π. If the sign of the determinant [a, b, c, d] is positive, then point d is above plane π; if the sign is negative, it means that the point is below the plane; 0 means that the four points are coplanar.
[0029] As attached Figure 3 , assume that there are two triangular units T1 and T2 in the space, which are composed of points p1, q1, r1 and points p2, q2, r2 on two supporting planes π1 and π2 respectively.
[0030] The relative positions of the two triangles are detected by calculating the signs of the three determinants [p2, q2, r2, p1], [p2, q2, r2, q1], and [p2, q2, r2, r1]. There are four possible results:
[0031] a) All three determinants have the same sign and they are non-zero;
[0032] b) All three determinants are zero;
[0033] c) one or both determinants are zero;
[0034] d) The determinants have different signs, for example, one positive and two negatives or one negative and two positives.
[0035] Case (a) means the two triangles do not intersect. Case (b) means the two triangles are coplanar, which requires special handling in 2D. Case (c) A point or edge of one triangle is on the supporting plane of the other triangle, so further checks are needed to see if the point or edge is inside or intersects the other triangle. Case (d) is handled specially in a further step: if [p1, q1, p2, q2] ≤ 0 and [p1, q1, r2, p2] ≤ 0, then T1 and T2 intersect.
[0036] The present invention provides a novel hybrid collision detection algorithm, which effectively solves the problem of "missed detection and false detection" in the existing discrete collision detection algorithm. In addition, the experimental results of comparison with the existing methods show that the novel hybrid collision detection algorithm proposed by the present invention has excellent accuracy and computational efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 This is a diagram of the mapping relationship between primitive information and hash table.
[0038] Figure 2 This is the flow chart of the intersection detection of hierarchical bounding box trees.
[0039] Figure 3 Intersection detection for triangle basic units.
[0040] Figure 4 This is an experimental simulation diagram of surgical instruments contacting liver soft tissue.
[0041] Figure 5 It is a flow chart of the present invention. DETAILED DESCRIPTION
[0042] The present invention will be further described by the following examples so that those skilled in the art can implement the invention with reference to the description.
[0043] A collision detection method in virtual surgery according to the present invention comprises the following steps:
[0044] Step 1: The virtual surgery simulation system consists of a liver soft tissue model and a surgical instrument model. The liver soft tissue model consists of 3127 triangular basic units, and the surgical instrument consists of 80 triangular basic units. First, the required model is built using the modeling software. The models are all composed of primitive triangles. Assume that ΔA1B1C1 and ΔA2B2C2 are two triangular basic units on the liver soft tissue model and the surgical instrument, respectively. Determine the coordinate positions of A1, B1, C1 and A2, B2, C2. The coordinates of A1, B1, and C1 are (0.5, 1.3, 10.6), (1.8, 1.5, 10.3), and (1.1, 1.9, 11.0), respectively; the coordinates of A2, B2, and C2 are (0.5, 1.5, 13.0), (0.8, 1.4, 12.0), and (1.0, 1.6, 12.5), respectively.
[0045] Step 2: Divide the three-dimensional space into uniform grids, select an appropriate grid size, set the grid side length to 1.2 times the longest side of the AABB bounding box, and ensure that each primitive occupies a maximum of eight grids. Calculate whether ΔA1B1C1 and ΔA2B2C2 are in the same cell space:
[0046] ΔA1B1C1hash(l,m,n)=ΔA2B2C2hash(l,m,n)
[0047] The calculation shows that ΔA1B1C1 and ΔA2B2C2 are in the same cell space, so the next step is to proceed to intersection detection.
[0048] Step 3: Perform spatial reduction and optimize the hash table data structure. Specifically, the subspace cells that only contain single object triangles are deleted, and the focus is on retaining those cells that contain both surgical instruments and soft tissue triangles. After such spatial reduction, a group of potential intersecting spatial subcells are obtained, which contain primitive triangles of both surgical instruments and soft tissues, ready for subsequent intersection tests. This optimization significantly improves the efficiency and accuracy of collision detection, reduces unnecessary calculations, and speeds up the entire detection process.
[0049] Step 4: Construct bounding boxes for the trajectory models of ΔA1B1C1 and ΔA2B2C2 and perform intersection detection. Use the top-down hierarchical bounding box construction method and select the minimum-maximum form to represent the AABB bounding box geometry. The boundary of the AABB bounding box is defined according to the following formula:
[0050] R = {(x, y, z)|x min ≤x≤x max ,y min ≤y≤y max , z min ≤z≤z max}
[0051] ΔA1B1C1 and ΔA2B2C2 respectively construct hierarchical bounding box trees, and by recursively traversing these tree structures, potential collision areas are accurately locked. Multi-threaded parallel processing can be used to allow the GPU to execute the same code at the same time, but process different data, thereby greatly reducing the calculation time. When constructing a hierarchical tree, first use an AABB bounding box to wrap the entire soft tissue as the root node of the binary tree. Subsequently, the root node is divided into two, and each sub-part is wrapped with a new bounding box, and the subdivision is recursively repeated until the soft tissue object is completely subdivided to form the bottom-level leaf node.
[0052] When making intersection judgments, the breadth-first traversal strategy is adopted to efficiently traverse the two bounding box trees, thereby determining whether the two objects collide at the current position and state. The specific process of traversal is: first, starting from the root node of the bounding box tree of one object, traverse the bounding box tree of the other object. If its leaf node can be reached, the bounding box tree of the first object is traversed in reverse using this leaf node until its leaf node is reached. After reaching the leaf node, the basic geometric element intersection test is performed. If it is detected that the bounding boxes do not intersect during this process, the possibility of the bounding objects intersecting can be quickly ruled out, which greatly saves time and space costs.
[0053] Step 5: Accurately detect whether ΔA1B1C1 and ΔA2B2C2 intersect.
[0054] Combined with Figure 3 , ΔA1B1C1 and ΔA2B2C2 are now formed in the space on two supporting planes π1 and π2.
[0055] The determinant [a,b,c,d] is composed of four points a,b,c,d in three-dimensional space, and the calculation formula is as follows:
[0056]
[0057] Among them, x, y, z are coordinates.
[0058] Calculate the determinants [A2,B2,C2,A1], [A2,B2,C2,B1], and [A2,B2,C2,C1] respectively:
[0059]
[0060]
[0061]
[0062] As a result of the calculation, all three determinants have the same sign and they are all non-zero; therefore, this means that the two triangles ΔA1B1C1 and ΔA2B2C2 do not intersect.
[0063] Table 1 shows the average time consumption of collision detection of the present invention and different existing algorithms in scenarios of different complexity.
[0064] Table 1
[0065]
Claims
1. A hybrid collision detection method in a virtual surgery simulation system, characterized in that The following steps are involved: Step 1, using 3D object modeling software, a soft tissue model and a surgical instrument model were constructed; Step 2: Divide the virtual space into grids of the same size and index the object models. Use GPU multithreading to accelerate the construction and update of the spatial information hash table. Map the grids occupied by all primitive bounding boxes to the hash table based on the results of the spatial hash storage function calculation. Determine the objects in the same space based on the spatial hash table, including: (1) Finely divide the three-dimensional space into grids and select grid units of appropriate size according to the size of the experimental object model; (2) Through the hash function, the grids occupied by all primitive bounding boxes are mapped to the hash table; the established spatial hash storage function is as follows: hash(l,m,n)=l+m×d x +n×d y ×d z The hash function is based on the spatial index value (l, m, n) and the number of grid divisions (d x ,d y ,d z ) is calculated; The hash table uses key-value pairs to store data, where the key is used to quickly locate the position of the triangle in the mesh, and the value contains valid data about the triangle; Step 3: Before solving the intersection between objects, perform space reduction and optimize the hash table; by eliminating those subspace cells that only contain triangles of a single object, only cells that contain both surgical instruments and soft tissue triangles are retained; after space reduction, a batch of potentially intersecting space subcells are obtained, which contain primitive triangles of both surgical instruments and soft tissues; Step 4: construct a hierarchical bounding box for objects that may collide, and perform intersection detection; if a node or its subnodes are detected to be intersecting, execute the next step, otherwise exit the detection. The steps are as follows: The top-down method is used to construct the hierarchical bounding box. The minimum-maximum form is used to represent the geometric expression of the AABB bounding box. The boundary of the AABB bounding box is defined according to the following formula: R={(x,y,z)|x min ≤x≤x max ,y min ≤y≤y max ,z min ≤z≤z max } In the virtual scene, hierarchical bounding box trees are constructed for surgical instruments and soft tissues respectively. By recursively traversing these tree structures, potential collision areas are accurately locked. Multi-threaded parallel processing is adopted to allow the GPU to execute the same code at the same time, but process different data, thus reducing computing time. When constructing the hierarchical tree, the soft tissue is first wrapped with an AABB bounding box as the root node of the binary tree. Then, the root node is divided into two, and each sub-part is wrapped with a new bounding box, and the subdivision is recursively repeated until the soft tissue object is completely subdivided to form the bottom leaf node. When making intersection judgments, a breadth-first traversal strategy is used to traverse the two bounding box trees, so as to determine whether the two objects collide at the current position and state: first, starting from the root node of the bounding box tree of one object, traverse the bounding box tree of the other object. If its leaf node can be reached, the bounding box tree of the first object is traversed in reverse using this leaf node until its leaf node is reached. After reaching the leaf node, the basic geometric element intersection test is performed. If it is detected that the bounding boxes do not intersect during this process, the possibility of the bounding boxes intersecting can be quickly ruled out. Step 5: After the above steps, it can be determined that the potential intersecting primitives have been obtained, and then the intersection detection between the two triangles is completed; a determinant composed of four points is defined in the three-dimensional space, and then whether the two triangles intersect is determined according to the sign of the determinant; The determinant [a,b,c,d] is composed of four points a,b,c,d in three-dimensional space, and the calculation formula is as follows: Among them, x, y, z are coordinates; Assume that points a, b, and c are not collinear, and form a triangle T in counterclockwise direction. Triangle T is on the supporting plane π. If the sign of the determinant [a, b, c, d] is positive, then point d is above plane π; if the sign is negative, it means that the point is below the plane; 0 means that the four points are coplanar; Assume that there are two triangular units T1 and T2 in the space, which are respectively composed of points p1, q1, r1 and points p2, q2, r2 on two supporting planes π1 and π2; The relative positions of the two triangles are detected by calculating the signs of the three determinants [p2,q2,r2,p1], [p2,q2,r2,q1], [p2,q2,r2,r1]. The calculation results may be in four situations: a) All three determinants have the same sign and they are non-zero; b) All three determinants are zero; c) one or both determinants are zero; d) The determinants have different signs, for example, one positive and two negatives or one negative and two positives; Case (a) means that the two triangles do not intersect; case (b) means that the two triangles are coplanar, which requires special treatment in two-dimensional space; case (c) a point or edge of one triangle is on the supporting plane of the other triangle, so whether the point or edge is inside the other triangle or intersects with it requires further inspection; case (d) is specially handled in a further step: if [p1, q1, p2, q2] ≤ 0 and [p1, q1, r2, p2] ≤ 0, then T1 and T2 intersect.
Citation Information
Cited By
Method and system for detecting collision between soft tissue and instrument in virtual operation
CN120411359A
Digital twinning virtual-real interaction method and system for deep-sea mining
CN120783003A
Digital Twin Virtual-Real Interaction Method and System for Deep-Sea Mining
CN120783003B
Grid ray intersection method based on multi-dimensional Hash acceleration
CN121053306A
A grid ray intersection method accelerated by multi-dimensional hashing
CN121053306B