A collision detection method, device, equipment and storage medium

By combining the axisymmetric bounding box and the ray method, the complexity problem of multi-object collision detection in computational fluid dynamics is solved, the detection efficiency and accuracy are improved, and the collision of objects can be judged and the specific position can be determined.

CN118464367BActive Publication Date: 2024-10-01CALCULATION AERODYNAMICS INST CHINA AERODYNAMICS RES & DEV CENT
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410933077.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-12
Publication Date
2024-10-01
Estimated Expiration
2044-07-12

AI Technical Summary

Technical Problem

In computational fluid dynamics, collision detection of multiple objects is complex and inefficient, and it is difficult for existing technology to effectively solve this problem.

Method used

By establishing an axially symmetric bounding box for global detection, and performing local detection based on the ray method, it is determined whether the object collides, thereby improving the efficiency and accuracy of collision detection.

Benefits of technology

It has improved the efficiency and accuracy of collision detection in computational fluid dynamics, can roughly judge collisions and determine specific locations, and solves the problem of complex collision detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118464367B_ABST
    Figure CN118464367B_ABST
Patent Text Reader

Abstract

The present application discloses a collision detection method, device, equipment and storage medium, which relates to the field of fluid mechanics, including: based on the point and surface information of the target object in the grid, a plurality of axisymmetric bounding boxes are established for the target object, so that the object bounding box formed based on the plurality of axisymmetric bounding boxes completely encloses the target object; if there is a target grid point located in the axisymmetric bounding box corresponding to the second target object among all the grid points contained in the first target object, the number of intersections between a ray in any direction starting from the target grid point and the second target object is determined; if the number of intersections is an odd number, it is determined that the first target object collides with the second target object. The present application performs global detection through an axisymmetric bounding box and performs local detection based on the ray method, thereby determining whether an object collision occurs, so as to solve the collision detection problem in computational fluid dynamics and improve the efficiency and accuracy of collision detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of fluid mechanics, and in particular to a collision detection method, device, equipment and storage medium. Background Art

[0002] There are a lot of contact and collision phenomena in the field of aerospace, such as the docking of spacecraft in the air, the collision between the landing gear and the ground when the aircraft lands, etc. In the field of aerospace, the use of computational fluid dynamics (CFD) to design aircraft and optimize aerodynamic shapes is a very common method. However, in CFD simulation analysis, it becomes a more complicated problem to consider the collision process of multiple objects at the same time. At present, the detection of collision problems has been studied and applied a lot in many industries, such as structural finite element physical simulation, game movie production in the Internet industry, etc. How to detect the collision problems raised by computational fluid dynamics CFD is a problem that needs to be solved. Summary of the invention

[0003] In view of this, the purpose of the present invention is to provide a collision detection method, device, equipment and storage medium, which can perform global detection through an axisymmetric bounding box and perform local detection based on the ray method, so as to determine whether an object collision occurs, so as to solve the collision detection problem in computational fluid dynamics and improve the efficiency and accuracy of collision detection. The specific scheme is as follows:

[0004] In a first aspect, the present application provides a collision detection method, comprising:

[0005] Based on the point and surface information of the target object in the grid, a plurality of axisymmetric bounding boxes are established for the target object, so that the object bounding box formed by the plurality of axisymmetric bounding boxes completely encloses the target object;

[0006] If there is a target grid point located in the axisymmetric bounding box corresponding to the second target object among all the grid points included in the first target object, then determining the number of intersections between a ray in any direction starting from the target grid point and the second target object;

[0007] If the number of intersection points is an odd number, it is determined that the first target object collides with the second target object.

[0008] Optionally, the step of establishing a plurality of axisymmetric bounding boxes for the target object based on point and surface information of the target object in the grid includes:

[0009] Based on the grid point coordinates corresponding to each grid surface included in the target object, a number of corresponding axisymmetric bounding boxes are established for the target object.

[0010] Optionally, the method further includes:

[0011] Determining the spatial ranges corresponding to the axisymmetric bounding boxes respectively, to obtain a plurality of spatial ranges corresponding to the second target object;

[0012] Determining whether there is a to-be-determined grid point that satisfies a spatial range corresponding to the second target object among all the grid points included in the first target object;

[0013] If so, it is determined that there is a grid point located in the axisymmetric bounding box corresponding to the second target object among all the grid points included in the first target object, and the to-be-determined grid point is determined as the target grid point.

[0014] Optionally, determining the spatial ranges corresponding to the axisymmetric bounding boxes respectively includes:

[0015] The projection intervals of the axisymmetric bounding box in three dimensions are determined respectively, and the spatial range corresponding to the axisymmetric bounding box is determined based on each of the projection intervals.

[0016] Optionally, determining the number of intersections between a ray in any direction starting from the target grid point and the second target object includes:

[0017] Determine a unit direction vector of a ray based on a ray in an arbitrary direction starting from the target grid point;

[0018] Based on the coordinates of the target grid point and the unit direction vector of the ray, a target grid surface satisfying a preset intersection relationship is determined from all grid surfaces included in the second target object, and the number of intersections is determined based on the number of the target grid surfaces.

[0019] Optionally, after determining that the first target object collides with the second target object, the method further includes:

[0020] Determine a target axisymmetric bounding box where the target grid point is located from the axisymmetric bounding box corresponding to the second target object, and determine a portion of the object enclosed by the target axisymmetric bounding box;

[0021] Determine the projection distance of the target grid point to the partial object, select the smallest projection distance from the projection distances as the intrusion depth, and use the unit vector of the projection direction corresponding to the intrusion depth as the collision plane normal vector;

[0022] The motion trajectories of the first target object and the second target object after the collision are simulated based on the intrusion depth and the corresponding normal vector of the collision plane.

[0023] Optionally, simulating the motion trajectory of the first target object and the second target object after the collision based on the intrusion depth and the corresponding normal vector of the collision plane includes:

[0024] Selecting the maximum intrusion depth from the intrusion depths corresponding to the target grid points as the target intrusion depth, and determining the target collision plane normal vector corresponding to the target intrusion depth;

[0025] Based on the target intrusion depth and the target collision plane normal vector, the flow field change information and the motion information of the first target object and the second target object that collided in the grid are calculated, and based on the flow field change information and the motion information, the motion trajectories of the first target object and the second target object after the collision are simulated.

[0026] In a second aspect, the present application provides a collision detection device, comprising:

[0027] A bounding box establishment module, used to establish a plurality of axisymmetric bounding boxes for the target object based on point and surface information of the target object in the grid, so that the object bounding box formed by the plurality of axisymmetric bounding boxes completely encloses the target object;

[0028] An intersection number determination module, configured to determine the number of intersections between a ray in any direction starting from the target grid point and the second target object if there is a target grid point located in an axisymmetric bounding box corresponding to the second target object among all grid points included in the first target object;

[0029] A collision detection module is used to determine that the first target object collides with the second target object if the number of the intersection points is an odd number.

[0030] In a third aspect, the present application provides an electronic device, including:

[0031] Memory, used to store computer programs;

[0032] A processor is used to execute the computer program to implement the aforementioned collision detection method.

[0033] In a fourth aspect, the present application provides a computer-readable storage medium for storing a computer program, wherein the computer program implements the aforementioned collision detection method when executed by a processor.

[0034] In the present application, based on the point and surface information of the target object in the grid, a number of axisymmetric bounding boxes are established for the target object, so that the object bounding box formed by the axisymmetric bounding boxes completely wraps the target object; if there is a target grid point located in the axisymmetric bounding box corresponding to the second target object among all the grid points contained in the first target object, the number of intersections between a ray in any direction starting from the target grid point and the second target object is determined; if the number of intersections is an odd number, it is determined that the first target object collides with the second target object. Through the above technical solution, the present application establishes an axisymmetric bounding box for each object to perform global detection based on the axisymmetric bounding box, thereby roughly determining whether an object collision occurs, and then performs local detection based on the ray method to further determine whether an object collision occurs based on the number of intersections, and can also determine the specific location where the collision occurs, thereby solving the collision detection problem in computational fluid dynamics and improving the efficiency and accuracy of collision detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0036] Figure 1 A flow chart of a collision detection method disclosed in this application;

[0037] Figure 2 A schematic diagram of point and surface information in a rectangular parallelepiped disclosed in the present application;

[0038] Figure 3 A schematic diagram of a bounding box disclosed in this application;

[0039] Figure 4 A schematic diagram of the spatial relationship between a grid point and a bounding box disclosed in this application;

[0040] Figure 5 A schematic diagram of a grid point projection disclosed in this application;

[0041] Figure 6 A schematic diagram of the movement of a cube and a cylinder after a collision disclosed in the present application;

[0042] Figure 7 A schematic diagram of the structure of a collision detection device disclosed in this application;

[0043] Figure 8 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION

[0044] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0045] At present, the detection of collision problems has been widely studied and applied in many industries, such as structural finite element physical simulation, game movie production in the Internet industry, etc. How to detect the collision problems raised by computational fluid dynamics CFD is a problem that needs to be solved. To this end, the present application provides a collision detection method, which performs global detection through an axisymmetric bounding box and performs local detection based on a ray method to determine whether an object collision occurs, so as to solve the collision detection problem in computational fluid dynamics and improve the efficiency and accuracy of collision detection.

[0046] See also Figure 1 As shown, an embodiment of the present invention discloses a collision detection method, comprising:

[0047] Step S11: Based on the point and surface information of the target object in the grid, a plurality of axisymmetric bounding boxes are established for the target object, so that the object bounding box formed by the plurality of axisymmetric bounding boxes completely encloses the target object.

[0048] In this embodiment, before performing collision detection, it is necessary to first read the point and surface information corresponding to each target object from the grid file. The point and surface information includes the coordinates of all grid points in the target object, the serial numbers of the grid points contained in each grid surface, and the number of grid points contained in each grid surface; and each information contained in the point and surface information can be stored in an array. For example, for the coordinates of all grid points in the target object, three one-dimensional arrays can be used to store them, that is, the positions of the grid points in the three-dimensional space are stored in three one-dimensional arrays; for the serial numbers of the grid points contained in each grid surface, a two-dimensional array can be used to store them, that is, the two-dimensional array can be used to indicate which grid points the grid surface is composed of; for the number of grid points contained in each grid surface, a one-dimensional array can be used to store them, that is, the one-dimensional array can be used to indicate how many grid points the grid point is composed of.

[0049] Specifically, Figure 2As shown in the figure, if the target object is a cuboid with a length, width and height of 1, 1, and 2 respectively, each grid point in the cuboid corresponds to a unique serial number and a three-dimensional coordinate, and each grid face also corresponds to a unique serial number. For the coordinates of all grid points in the cuboid, three one-dimensional arrays are used to store the coordinates of all grid points in ascending order of serial numbers. The three one-dimensional arrays after storage are x{0,0,1,1,0,1,1,0}, y{0,1,0,1,0,0,1,1}, and z{0,0,0,0,0,2,2,2,2}, that is, the coordinates of the grid points in three directions are stored in three one-dimensional arrays. The numbers of grid points contained in each grid face of the cuboid can be stored using f2nod[face number][point number on the face], i.e. f2nod[0]{0,4,5,2}, f2nod[1]{0,1,7,4}, f2nod[2]{6,5,2,3}, f2nod[3]{7,6,3,1}, f2nod[4]{0,2,3,1}, f2nod[5]{7,4,5,6}. As for the number of grid points contained in each grid face of the cuboid, it can be found that all grid faces in the cuboid are composed of four grid points, so the one-dimensional array can be represented as nNPF{4,4,4,4,4,4}.

[0050] In this embodiment, the establishment of an axisymmetric bounding box is specifically to establish a number of corresponding axisymmetric bounding boxes for the target object based on the coordinates of the grid points corresponding to each grid surface contained in the target object, so that the object bounding box composed of the axisymmetric bounding boxes corresponding to the target object can completely enclose the target object. Among them, the number of axisymmetric bounding boxes corresponding to a target object can be one or more. It should be noted that different axisymmetric bounding boxes can overlap in space. Figure 3 As shown, if the target object includes a sphere composed of a triangular mesh and a cuboid composed of a quadrilateral mesh, eight corresponding axisymmetric bounding boxes are established for the sphere and the cuboid based on the coordinates of the grid points corresponding to the grid faces respectively contained in the sphere and the cuboid, so that the sphere bounding box and the cuboid bounding box composed of the eight axisymmetric bounding boxes corresponding to the sphere and the cuboid can completely enclose the sphere and the cuboid.

[0051] Step S12: If there is a target grid point located in the axisymmetric bounding box corresponding to the second target object among all the grid points included in the first target object, determine the number of intersections between a ray in any direction starting from the target grid point and the second target object.

[0052] In this embodiment, for each axisymmetric bounding box, there is a corresponding spatial range. Specifically, the projection intervals of the axisymmetric bounding box in three dimensions are determined, and the spatial range corresponding to the axisymmetric bounding box is determined based on each projection interval. For example, if the projection interval of an axisymmetric bounding box on the x-axis is (min.x, max.x), the projection interval on the y-axis is (min.y, max.y), and the projection interval on the z-axis is (min.z, max.z); wherein min.x, max.x, min.y, max.y, min.z, and max.z represent the maximum and minimum coordinates of the axisymmetric bounding box in the x, y, and z directions, respectively. Then, based on the three projection intervals, the spatial range N={min.x≤x≤max.x, min.y≤y≤max.y, min.z≤z≤max.z} corresponding to the axisymmetric bounding box is determined. It should be noted that a unique serial number can also be given to each axisymmetric bounding box, and then the spatial range of the axisymmetric bounding box can be stored using a two-dimensional array box[bounding box serial number][spatial range]. For example, the two-dimensional array corresponding to the axisymmetric bounding box with serial number 0 is box[0]{min.x,max.x,min.y,max.y,min.z,max.z}.

[0053] In this embodiment, after determining the spatial ranges corresponding to each axisymmetric bounding box, several spatial ranges corresponding to the second target object are determined based on several axisymmetric bounding boxes corresponding to the second target object. Then, it is determined whether there are any grid points to be determined that satisfy the spatial range corresponding to the second target object among all the grid points contained in the first target object; if there are any grid points to be determined that satisfy the spatial range corresponding to the second target object among all the grid points contained in the first target object, that is, the grid points to be determined satisfy one of the several spatial ranges corresponding to the second target object, then it is determined that there are any grid points in the first target object that are located in the axisymmetric bounding box corresponding to the second target object, and the grid points to be determined are determined as the target grid points, that is, the target grid points are located in one of the several axisymmetric bounding boxes corresponding to the second target object. If there are no grid points to be determined that satisfy the spatial range corresponding to the second target object among all the grid points contained in the first target object, then it indicates that the first target object and the second target object have not collided. Specifically, if Figure 4 As shown, Figure 4 For Figure 3 From the spatial relationship between the corresponding spherical bounding box and the grid points in the cuboid, it can be found that the five hollow grid points on the left are inside the spherical bounding box, which are the target grid points, and the ten solid grid points on the right are outside the spherical bounding box, so there is no need to detect these ten solid grid points.

[0054] Furthermore, for the target grid point, it is necessary to use the ray method to determine the internal and external relationship between the target grid point and the second target object; specifically, a ray is emitted from the target grid point in any direction, and based on the number of intersections between the ray and the second target object, it is determined whether the first target object collides with the second target object.

[0055] Specifically, the number of intersections can be determined by first determining the unit direction vector of a ray in any direction starting from the target grid point; then, based on the coordinates of the target grid point and the unit direction vector of the ray, determining the target grid surface that satisfies the preset intersection relationship from all grid surfaces included in the second target object, and determining the number of intersections based on the number of target grid surfaces. If all grid surfaces included in the second target object are triangles, the preset intersection relationship can be the following equation:

[0056] O+tD=(1-λ1-λ2)P0+λ1P1+λ2P2;

[0057] Among them, O is the coordinate of the target grid point; D is the unit direction vector of the ray; P0, P1, P2 are the coordinates of the three grid points contained in the target grid surface; t, λ1, λ2 are the unknown scalars to be solved in the preset intersection relationship. It should be noted that since any polygon in the grid can be converted into multiple triangles, the above method is applicable to surface grids of any shape, such as quadrilaterals, pentagons, etc.

[0058] Further, as to whether any mesh surface included in the second target object is a target mesh surface that satisfies a preset intersection relationship, the coordinates of the three mesh points included in any mesh surface, the coordinates of the target mesh point, and the unit direction vector of the ray can be substituted into a preset formula to obtain three parameters t, λ1, and λ2. Based on whether the three parameters t, λ1, and λ2 satisfy the first preset condition, it is determined whether any mesh surface is a target mesh surface that satisfies a preset intersection relationship. The preset formula is as follows:

[0059] ;

[0060] E1=P1-P0; E2=P2-P0; S0=O-P0; S1=D×E2; S2=S0×E2;

[0061] Among them, O is the coordinate of the target grid point; D is the unit direction vector of the ray; P0, P1, and P2 are the coordinates of the three grid points contained in any grid surface; E1, E2, S0, S1, and S2 are all unknown vectors required to solve the preset formula, which can be solved in sequence through P0, P1, P2, O, and D. The first preset condition is t>=0, λ1>=0, λ2>=0, and λ1+λ2<=1. If the three parameters t, λ1, and λ2 meet the first preset condition, then the grid surface is the target grid surface that meets the preset intersection relationship, that is, a ray starting from the target grid point O along the D direction intersects with the triangular grid surface formed by P0, P1, and P2. If the three parameters t, λ1, and λ2 do not meet the first preset condition, it means that a ray starting from the target grid point O along the D direction does not intersect with the triangular mesh surface formed by P0, P1, and P2.

[0062] Step S13: If the number of intersection points is an odd number, it is determined that the first target object collides with the second target object.

[0063] In this embodiment, if the number of intersection points is an odd number, it indicates that the first target object collides with the second target object; if the number of intersection points is an even number or 0, it indicates that the first target object collides with the second target object.

[0064] Furthermore, in order to simulate the motion trajectory of the first target object and the second target object after the collision, it is necessary to calculate physical quantities such as the intrusion depth and the collision plane normal vector between the first target object and the second target object. Specifically, the target axisymmetric bounding box where the target grid point is located is determined from a number of axisymmetric bounding boxes corresponding to the second target object, and the partial object wrapped by the target axisymmetric bounding box is determined from the second target object. Then the projection distance of the target grid point projected to the partial object is determined. Since the projection distance may be one or more, the smallest projection distance is selected from each projection distance as the intrusion depth, and the unit vector of the projection direction corresponding to the intrusion depth is used as the collision plane normal vector, so that the motion trajectory of the first target object and the second target object after the collision can be simulated based on the intrusion depth and the corresponding collision plane normal vector. In this way, by only selecting the target axisymmetric bounding box where the target grid point is located to calculate the projection distance, the problem of huge calculation amount caused by using all axisymmetric bounding boxes is avoided, thereby improving the simulation efficiency.

[0065] Among them, in order to determine the projection distance of the target grid point projected to the partial object, it is necessary to first determine the grid surface to which the target grid point can be projected from the partial object. Specifically, by substituting the coordinates P0, P1, P2 of the three grid points contained in any grid surface in the partial object, the unit direction vector D of the normal of the grid surface and the coordinate O of the target grid point into the above preset formula, the three parameters t, λ1, λ2 are obtained. Based on whether the three parameters t, λ1, λ2 meet the second preset condition, it is determined whether any grid surface in the partial object is a grid surface to which the target grid point can be projected. Among them, the second preset condition is t≠0, λ1>=0, λ2>=0, λ1+λ2<=1. If the three parameters t, λ1, λ2 meet the second preset condition, it means that the target grid point can be projected onto the triangular mesh surface composed of P0, P1, P2, so that the projection distance can be obtained. Specifically, if Figure 5 As shown, m i for Figure 3 The cuboid in the figure intrudes into an internal grid point of the sphere, d mi_2 and d mi_1 are two triangular faces on the sphere; m i Can be projected to d mi_2 and d mi_1 On these two triangular faces; with m i Projection to d mi_1 For example, m i The distance to p3 is the projection distance.

[0066] Among them, for simulating the motion trajectory of the first target object and the second target object after the collision based on the intrusion depth and the corresponding collision plane normal vector, it can specifically include: since the target grid point may be one or more, the maximum intrusion depth is selected from the intrusion depths corresponding to each target grid point as the target intrusion depth, and the target collision plane normal vector corresponding to the target intrusion depth is determined. Then, based on the target intrusion depth and the target collision plane normal vector, the flow field change information and the motion information of the first target object and the second target object that collided in the grid are calculated, so as to simulate the motion trajectory of the first target object and the second target object after the collision based on the flow field change information and the motion information.

[0067] It can be seen that the present application establishes an axisymmetric bounding box for each object, performs global detection based on the axisymmetric bounding box, and thus roughly determines whether an object collision occurs, and then performs local detection based on the ray method to further determine whether an object collision occurs based on the number of intersections. It can also determine the specific location where the collision occurs, thereby solving the collision detection problem in computational fluid dynamics and improving the efficiency and accuracy of collision detection.

[0068] See also Figure 6 As shown, assuming that the cube on the left moves horizontally toward the cylinder at a speed of 10m / s and collides with the cylinder, the cylinder will rotate after the collision and then collide with the cube on the right. The specific movement of the cube and cylinder after the collision can be solved by the method proposed in this application, and the influence of aerodynamic force on the cube and cylinder can be considered in the simulation process. Take the collision detection of the cube and cylinder on the left as an example.

[0069] The point and surface information corresponding to the cube and the cylinder are read from the grid file, and several corresponding axisymmetric bounding boxes are established for the cube and the cylinder, so that the cube bounding box and the cylinder bounding box composed of the several axisymmetric bounding boxes corresponding to the cube and the cylinder can completely wrap the cube and the cylinder.

[0070] Determine whether there is a target grid point in the axisymmetric bounding box corresponding to the cylinder among all the grid points contained in the cube. If so, emit a ray from the target grid point in any direction and determine the number of intersections between the ray and the cylinder. If the number of intersections is an even number or 0, it indicates that the cube and the cylinder have not collided.

[0071] If the number of intersections is an odd number, it indicates that the cube and the cylinder collide, and the target axisymmetric bounding box where the target grid point is located is determined from the several axisymmetric bounding boxes corresponding to the cylinder, and then the projection distance from the target grid point to the part of the cylinder enclosed by the target axisymmetric bounding box is determined, and the minimum value of one or more projection distances corresponding to the target grid point is determined as the intrusion depth, and the unit vector of the projection direction corresponding to the intrusion depth is determined as the collision plane normal vector. Further, the maximum intrusion depth is determined from the intrusion depths corresponding to one or more target grid points, and the motion trajectory of the cube and the cylinder after the collision is simulated based on the maximum intrusion depth and the collision plane normal vector corresponding to the maximum intrusion depth.

[0072] It can be seen that the present application establishes an axisymmetric bounding box for each object, performs global detection based on the axisymmetric bounding box, and roughly determines whether an object collision occurs, and then performs local detection based on the ray method to further determine whether an object collision occurs based on the number of intersections, and can also determine the specific location where the collision occurs, thereby solving the collision detection problem in computational fluid dynamics and improving the efficiency and accuracy of collision detection. In addition, the motion trajectory of multiple objects after a collision can be simulated based on physical quantities such as the penetration depth and the normal vector of the collision plane.

[0073] See also Figure 7 As shown, an embodiment of the present invention discloses a collision detection device, comprising:

[0074] A bounding box establishment module 11 is used to establish a plurality of axisymmetric bounding boxes for the target object based on point and surface information of the target object in the grid, so that the object bounding box formed by the plurality of axisymmetric bounding boxes completely encloses the target object;

[0075] The intersection number determination module 12 is used to determine the number of intersections between a ray in any direction starting from the target grid point and the second target object if there is a target grid point located in the axisymmetric bounding box corresponding to the second target object among all the grid points included in the first target object;

[0076] The collision detection module 13 is configured to determine that the first target object collides with the second target object if the number of the intersection points is an odd number.

[0077] It can be seen that the present application establishes an axisymmetric bounding box for each object, performs global detection based on the axisymmetric bounding box, and thus roughly determines whether an object collision occurs, and then performs local detection based on the ray method to further determine whether an object collision occurs based on the number of intersections. It can also determine the specific location where the collision occurs, thereby solving the collision detection problem in computational fluid dynamics and improving the efficiency and accuracy of collision detection.

[0078] In some specific embodiments, the bounding box establishing module 11 includes:

[0079] The bounding box establishing unit is used to establish a number of corresponding axisymmetric bounding boxes for the target object based on the grid point coordinates corresponding to each grid surface included in the target object.

[0080] In some specific embodiments, the collision detection device further includes:

[0081] A spatial range determination submodule, used to determine the spatial ranges corresponding to each of the axisymmetric bounding boxes, so as to obtain a plurality of spatial ranges corresponding to the second target object;

[0082] a grid point determination unit, configured to determine whether there is a to-be-determined grid point that satisfies a spatial range corresponding to the second target object among all the grid points included in the first target object;

[0083] A grid point determination unit is used to determine whether there is a grid point located in the axisymmetric bounding box corresponding to the second target object among all the grid points included in the first target object, and determine the grid point to be determined as the target grid point.

[0084] In some specific embodiments, the spatial range determination submodule includes:

[0085] The projection interval determining unit is used to determine the projection intervals of the axisymmetric bounding box in three dimensions respectively, and determine the spatial range corresponding to the axisymmetric bounding box based on each of the projection intervals.

[0086] In some specific embodiments, the intersection number determination module 12 includes:

[0087] a direction vector determining unit, configured to determine a unit direction vector of a ray based on a ray in any direction starting from the target grid point;

[0088] An intersection number determination unit is used to determine a target mesh surface that satisfies a preset intersection relationship from all mesh surfaces included in the second target object based on the coordinates of the target mesh point and the unit direction vector of the ray, and to determine the number of intersections based on the number of the target mesh surfaces.

[0089] In some specific embodiments, the collision detection device further includes:

[0090] an object determination unit, configured to determine a target axisymmetric bounding box where the target grid point is located from an axisymmetric bounding box corresponding to the second target object, and determine a portion of the object enclosed by the target axisymmetric bounding box;

[0091] A physical quantity determination unit, used to determine a projection distance of the target grid point projected onto the part of the object, select a minimum projection distance from each of the projection distances as an intrusion depth, and use a unit vector of a projection direction corresponding to the intrusion depth as a collision plane normal vector;

[0092] The motion simulation submodule is used to simulate the motion trajectory of the first target object and the second target object after the collision based on the penetration depth and the corresponding normal vector of the collision plane.

[0093] In some specific embodiments, the motion simulation submodule includes:

[0094] A target quantity determination unit, configured to select a maximum intrusion depth from the intrusion depths corresponding to the target grid points as a target intrusion depth, and determine a target collision plane normal vector corresponding to the target intrusion depth;

[0095] A motion simulation unit is used to calculate flow field change information and motion information of the first target object and the second target object that collide in the grid based on the target intrusion depth and the target collision plane normal vector, and simulate the motion trajectory of the first target object and the second target object after the collision based on the flow field change information and the motion information.

[0096] Furthermore, the present application also discloses an electronic device. Figure 8 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content in the diagram cannot be regarded as any limitation on the scope of use of the present application.

[0097] Figure 8 A schematic diagram of the structure of an electronic device 20 provided in an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the collision detection method disclosed in any of the aforementioned embodiments. In addition, the electronic device 20 in this embodiment may specifically be an electronic computer.

[0098] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.

[0099] In addition, the memory 22, as a carrier for storing resources, can be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon can include an operating system 221, a computer program 222, etc., and the storage method can be temporary storage or permanent storage.

[0100] The operating system 221 is used to manage and control the hardware devices on the electronic device 20 and the computer program 222. In addition to the computer program that can be used to complete the collision detection method performed by the electronic device 20 disclosed in any of the above embodiments, the computer program 222 can also further include computer programs that can be used to complete other specific tasks.

[0101] Furthermore, the present application also discloses a computer-readable storage medium for storing a computer program; wherein the computer program, when executed by a processor, implements the aforementioned disclosed collision detection method. The specific steps of the method can refer to the corresponding contents disclosed in the aforementioned embodiments, and will not be repeated here.

[0102] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0103] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0104] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0105] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0106] The technical solution provided by the present application is introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for general technicians in this field, according to the idea of ​​the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A collision detection method, characterized in that: include: Based on the point and surface information of the target object in the grid, a plurality of axisymmetric bounding boxes are established for the target object, so that the object bounding box formed by the plurality of axisymmetric bounding boxes completely encloses the target object; If there is a target grid point located in the axisymmetric bounding box corresponding to the second target object among all the grid points included in the first target object, then determining the number of intersections between a ray in any direction starting from the target grid point and the second target object; If the number of intersection points is an odd number, it is determined that the first target object collides with the second target object; Wherein, the collision detection method further includes: Determining the spatial ranges corresponding to the axisymmetric bounding boxes respectively, to obtain a plurality of spatial ranges corresponding to the second target object; Determining whether there is a to-be-determined grid point that satisfies a spatial range corresponding to the second target object among all the grid points included in the first target object; If so, determining that there is a grid point located in the axisymmetric bounding box corresponding to the second target object among all the grid points included in the first target object, and determining the to-be-determined grid point as the target grid point; Wherein, determining the spatial ranges corresponding to the axisymmetric bounding boxes respectively includes: Determine projection intervals of the axisymmetric bounding box in three dimensions respectively, and determine a spatial range corresponding to the axisymmetric bounding box based on each of the projection intervals; The step of determining the number of intersections between a ray in any direction starting from the target grid point and the second target object includes: Determine a unit direction vector of a ray based on a ray in an arbitrary direction starting from the target grid point; Based on the coordinates of the target grid point and the unit direction vector of the ray, a target grid surface satisfying a preset intersection relationship is determined from all grid surfaces included in the second target object, and the number of intersections is determined based on the number of the target grid surfaces.

2. The collision detection method according to claim 1, characterized in that: The step of establishing a plurality of axisymmetric bounding boxes for the target object based on the point and surface information of the target object in the grid includes: Based on the grid point coordinates corresponding to each grid surface included in the target object, a number of corresponding axisymmetric bounding boxes are established for the target object.

3. The collision detection method according to claim 1 or 2, characterized in that: After determining that the first target object collides with the second target object, the method further includes: Determine a target axisymmetric bounding box where the target grid point is located from the axisymmetric bounding box corresponding to the second target object, and determine a portion of the object enclosed by the target axisymmetric bounding box; Determine the projection distance of the target grid point to the partial object, select the smallest projection distance from the projection distances as the intrusion depth, and use the unit vector of the projection direction corresponding to the intrusion depth as the collision plane normal vector; The motion trajectories of the first target object and the second target object after the collision are simulated based on the intrusion depth and the corresponding normal vector of the collision plane.

4. The collision detection method according to claim 3, characterized in that: The simulating the motion trajectory of the first target object and the second target object after the collision based on the intrusion depth and the corresponding normal vector of the collision plane includes: Selecting the maximum intrusion depth from the intrusion depths corresponding to the target grid points as the target intrusion depth, and determining the target collision plane normal vector corresponding to the target intrusion depth; Based on the target intrusion depth and the target collision plane normal vector, the flow field change information and the motion information of the first target object and the second target object that collided in the grid are calculated, and based on the flow field change information and the motion information, the motion trajectories of the first target object and the second target object after the collision are simulated.

5. A collision detection device, characterized in that: include: A bounding box establishment module, used to establish a plurality of axisymmetric bounding boxes for the target object based on point and surface information of the target object in the grid, so that the object bounding box formed by the plurality of axisymmetric bounding boxes completely encloses the target object; An intersection number determination module, configured to determine the number of intersections between a ray in any direction starting from the target grid point and the second target object if there is a target grid point located in an axisymmetric bounding box corresponding to the second target object among all grid points included in the first target object; a collision detection module, configured to determine that the first target object collides with the second target object if the number of the intersection points is an odd number; Wherein, the collision detection device further includes: A spatial range determination submodule, used to determine the spatial ranges corresponding to each of the axisymmetric bounding boxes, so as to obtain a plurality of spatial ranges corresponding to the second target object; a grid point determination unit, configured to determine whether there is a to-be-determined grid point that satisfies a spatial range corresponding to the second target object among all the grid points included in the first target object; a grid point determination unit, configured to determine, if any, whether there is a grid point located in an axisymmetric bounding box corresponding to the second target object among all the grid points included in the first target object, and determine the grid point to be determined as the target grid point; Wherein, the spatial range determination submodule includes: A projection interval determining unit, used to determine the projection intervals of the axisymmetric bounding box in three dimensions respectively, and determine the spatial range corresponding to the axisymmetric bounding box based on each of the projection intervals; Wherein, the intersection number determination module includes: a direction vector determining unit, configured to determine a unit direction vector of a ray based on a ray in any direction starting from the target grid point; An intersection number determination unit is used to determine a target mesh surface that satisfies a preset intersection relationship from all mesh surfaces included in the second target object based on the coordinates of the target mesh point and the unit direction vector of the ray, and to determine the number of intersections based on the number of the target mesh surfaces.

6. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the collision detection method according to any one of claims 1 to 4.

7. A computer-readable storage medium, characterized in that: Used to store a computer program, which, when executed by a processor, implements the collision detection method according to any one of claims 1 to 4.