A fast collision detection algorithm based on magic ruler structure
Through the fast collision detection algorithm based on the magic ruler structure, the separation of static and dynamic detection is simplified into two-dimensional detection, which solves the problem of complex and long-term calculation of three-dimensional collision detection, and realizes rapid collision detection, which is suitable for multiple structures chain structure folding process.
Patent Information
- Application Number
- CN202111608080.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-24
- Publication Date
- 2025-01-14
- Estimated Expiration
- 2041-12-24
AI Technical Summary
The existing three-dimensional collision detection is complex and time-consuming, so fast collision detection cannot be achieved.
The fast collision detection algorithm based on the magic ruler structure is adopted, and the separation of static and dynamic detection is simplified into two-dimensional detection. The intersection and projection surface detection of the module are used to realize rapid collision detection.
It effectively simplifies three-dimensional collision detection, reduces computational complexity and time-consuming, and realizes rapid collision detection, which is suitable for the folding process of chain structures in various configurations.
Smart Images

Figure CN114329662B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of collision detection of three-dimensional rotatable chain structures, and in particular relates to a fast collision detection algorithm based on a magic ruler structure. Background Art
[0002] In recent years, with the maturity of various chain model deformation algorithms, chain model collision detection technology has been more and more widely used. The existing three-dimensional collision detection calculation is analyzed through three-dimensional models, which has a large amount of data and is complex and time-consuming, and cannot achieve rapid collision detection. Summary of the invention
[0003] The purpose of the present invention is to provide a fast collision detection algorithm based on a magic ruler structure, which can solve the problem of complex and time-consuming calculation of three-dimensional collision detection and realize fast collision detection. The specific technical solution is as follows:
[0004] A fast collision detection algorithm based on a magic ruler structure comprises the following steps:
[0005] Step S1: Perform static collision detection on the model to determine whether a collision will occur after the rotation is in place, with the intersection between modules in the chain as the judgment standard;
[0006] Step S2: Perform dynamic collision detection on the model; determine by calculating whether there is a stationary module in the space swept by each moving module during the rotation process.
[0007] Furthermore, the step S1 includes the following specific steps:
[0008] Step S11, determining whether there are modules that may collide after being rotated into place;
[0009] Step S12, determining whether the modules intersect.
[0010] Furthermore, in step S11, the modules in the same part will not collide with each other due to being relatively still, and the sum of the modules in these two parts is taken as the module to be detected.
[0011] Furthermore, in step S12, it is detected whether the modules are located in the same unit cube space, that is, whether the three-dimensional coordinate values are equal. If they are not equal, there is no collision. Otherwise, it is continued to determine whether the two modules are in complementary positions in the cube space. If they are complementary, there is no collision. Otherwise, a collision will inevitably occur.
[0012] Furthermore, step S2 includes the following specific steps:
[0013] Step S21, check whether the modules are on the same layer:
[0014] Check whether the two modules are on the same layer in the direction perpendicular to the rotation axis; if they are not on the same layer, there will be no collision; otherwise, project the module being rotated into the rotation plane and proceed to step S22;
[0015] Step S22, detecting whether the motion modules on the same layer intersect:
[0016] In the projection plane, detect whether the circular range crossed by the projection of the moving module intersects with the projection of the stationary module. If not, no collision occurs; otherwise, continue to judge and proceed to step S23;
[0017] Step S23, determine whether the two modules are mismatched:
[0018] In the projection plane, it is determined whether the two modules to be detected are staggered with each other. If so, no collision occurs; otherwise, a collision occurs.
[0019] The present invention can flexibly realize a variety of configurations of magic ruler as the basic structure, and quickly perform collision detection based on the characteristics of the current movement mode during the chain folding calculation process. Since in most cases, the collision can be detected after the module is rotated into place, that is, in a static state, the collision detection is divided into two parts: static detection and dynamic detection. The three-dimensional collision detection is simplified to two-dimensional detection, and a layered detection method is proposed, which solves the problem of complex calculation and long time consumption of three-dimensional collision detection, and realizes rapid collision detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 It is a flow chart of the fast collision detection algorithm in the present invention.
[0021] Figure 2a and Figure 2b It is a schematic diagram of judging whether two triangular prism modules are complementary in an embodiment of the present invention.
[0022] Figure 3a and Figure 3b It is a schematic diagram of determining whether two triangular prism modules are in the same layer in an embodiment of the present invention.
[0023] Figure 4 Schematic diagram of the rotation of the projection module in the embodiment of the present invention.
[0024] Figure 5 It is a schematic diagram of motion module projection detection in an embodiment of the present invention.
[0025] Figure 6 It is a schematic diagram of motion module projection detection in an embodiment of the present invention.
[0026] Figure 7 It is a schematic diagram of the staggered inclined surfaces in an embodiment of the present invention.
[0027] Figure 8Schematic diagram of the phase mismatch condition in the embodiment of the present invention. DETAILED DESCRIPTION
[0028] In order to better understand the purpose, structure and function of the present invention, a fast collision detection algorithm based on a magic ruler structure of the present invention is further described in detail below with reference to the accompanying drawings.
[0029] like Figure 1 As shown, a fast collision detection algorithm based on a magic ruler structure of the present invention comprises the following steps:
[0030] Step S1: Perform static collision detection on the model;
[0031] Step S2: Perform dynamic collision detection on the model.
[0032] The step S1 is to determine whether a collision will occur after the rotation is in place, and whether there is an intersection between modules in the chain is used as the judgment standard. The details are as follows:
[0033] Step S11, determine whether there are modules that may collide after being rotated into place, such as Figure 2b , since there is only one module k at each detection i Rotational motion occurs, so only at k i The front and back parts of the boundary and There will be collision between the modules, and the modules belonging to the same part will not collide because they are relatively stationary. Therefore, the modules of these two parts k u (u∈(0,i-1)) and k v (v∈(i,n-1)) judges whether there is a collision pair by pair.
[0034] Step S12: determine whether the modules intersect, and check module k u , k v Whether they are in the same unit cube space, that is, whether the three-dimensional coordinate values are equal, if they are not equal, there is no collision:
[0035] x u ≠x v
[0036] y u ≠y v (1)
[0037] z u ≠z v
[0038] Otherwise, continue to determine whether the two modules are in complementary positions in the cube space. If so, Figure 2a , no collision occurs, otherwise a collision will inevitably occur, such as Figure 2b .
[0039] Step S2: Perform dynamic collision detection on the model, specifically including the following steps:
[0040] Step S21, detection module k u , k v Whether they are on the same layer in the direction of the vertical rotation axis. If they are not on the same layer, such as Figure 3a , then there will be no collision; otherwise, if Figure 3b , k u , k v and the module k that is undergoing the rotation operation i Projected onto the rotation plane, Figure 4 The xy plane in the image, remember the module k rotated into place u for Continue to step S22.
[0041] Step S22: Detect whether the motion modules on the same layer intersect; module k u , k v , k i The center points of the projection surface are points U, V, I, first determine whether U is located in the area swept by the ray with I as the endpoint and passing through V, such as Figure 5 As shown, the following two conditions are met at the same time:
[0042] (UI)·(VI)>0
[0043]
[0044] Among them, UI, VI, are the vectors between corresponding points.
[0045] If not, no collision will occur; otherwise, continue to judge k v Is the quarter-circle area B that the projection passes through consistent with k u Projection intersection, such as Figure 6 . Remember R max is the outer radius of the annular area, R min is the radius of the circle in the annular region, k u Projection distance k i The farthest distance from the center point is r max , the closest distance is r min .Right now:
[0046] R max ≤r min ||R min ≥r max (3)
[0047] If the conditions are met, no collision will occur; otherwise, continue judging and execute step S23.
[0048] Step S23, in the projection plane, determine k u , k v If they are in the wrong direction, no collision will occur, otherwise a collision will occur. Figure 7 , k u Projection and k v The trajectory projections intersect, but due to k u , k v The inclined planes staggered without colliding.
[0049] Phase mismatch occurs only under the following conditions:
[0050] ①k u , k v The edge u , l v parallel to the rotation plane and located at different vertical heights, e.g. Figure 7 ;
[0051] ② Take k u , k v Inner center distance k i The closest one is the inner module (such as Figure 8 Medium k v ), the farthest one is the outer module (such as Figure 8 Medium k u ), remember the inner module and its edge (such as Figure 8 Middle v ), the inner distance k between the midpoints of two adjacent edges i The farthest point p in The circle is the inner transition circle with a radius of r in , the outer module and its edges (such as Figure 8 Middle u ) The inner distance k between the two midpoints of two adjacent edges i The closest point out The circle is the outer transition circle, with a radius of r out ,satisfy:
[0052] r in <r out (4)
[0053] ③The edge of the inner module ( Figure 8 Middle v ) Both end points are located outside the module at a distance k i The endpoint p closest to the center 1 、p 2 Circle r near Inside.
[0054] It is to be understood that the present invention is described by some embodiments, and it is known to those skilled in the art that various changes or equivalent substitutions may be made to these features and embodiments without departing from the spirit and scope of the present invention. In addition, under the teachings of the present invention, these features and embodiments may be modified to adapt to specific circumstances and materials without departing from the spirit and scope of the present invention. Therefore, the present invention is not limited by the specific embodiments disclosed herein, and all embodiments falling within the scope of the claims of this application are within the scope of protection of the present invention.
Claims
1. A fast collision detection method based on a magic ruler structure, characterized in that: The steps include: Step S1: Perform static collision detection on the model to determine whether a collision will occur after the rotation is in place, with whether there is an intersection between modules in the chain as the judgment standard; Step S2: Perform dynamic collision detection on the model; determine by calculating whether there is a stationary module in the space swept by each moving module during the rotation process; The step S1 comprises the following specific steps: Step S11, determining whether there are modules that may collide after being rotated into place; Step S12, determining whether the modules intersect; In step S11, the modules in the same part will not collide with each other because they are relatively still, and the sum of the modules in these two parts is taken as the module to be detected; In step S12, it is detected whether the modules are located in the same unit cube space, that is, whether the three-dimensional coordinate values are equal. If they are not equal, there is no collision. Otherwise, it is further determined whether the two modules are in complementary positions in the cube space. If they are complementary, there is no collision. Otherwise, there will definitely be a collision. Step S2 includes the following specific steps: S21, check whether the modules are on the same layer: Check whether the two modules are on the same layer in the direction perpendicular to the rotation axis; if they are not on the same layer, there will be no collision; otherwise, project the module being rotated into the rotation plane and proceed to step S22; S22, detect whether the motion modules on the same layer intersect: In the projection plane, detect whether the circular range crossed by the projection of the moving module intersects with the projection of the stationary module. If not, no collision occurs; otherwise, continue to judge and proceed to step S23; S23, determine whether the two modules are mismatched: In the projection plane, it is determined whether the two modules to be detected are staggered with each other. If so, no collision occurs; otherwise, a collision occurs.
Citation Information
Patent Citations
Mechanical arm collision detection method and system, storage medium and mechanical arm
CN113211495A