Method and electronic device for detecting collision relationship of components in three-dimensional building

By constructing a hierarchical enclosure of the box tree and using a one-dimensional array to save node information, combining state switches and tolerance settings, the problem of low component collision detection efficiency in the construction industry is solved, and fast and accurate collision detection is achieved.

CN116563468BActive Publication Date: 2025-02-07ZHEJIANG UNIV +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310598391.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-24
Publication Date
2025-02-07
Estimated Expiration
2043-05-24

AI Technical Summary

Technical Problem

In the construction industry, it is difficult for the existing technology to quickly and accurately detect the collision relationship between components in three-dimensional buildings, resulting in difficult design conflicts being discovered in a timely manner.

Method used

By constructing a hierarchical enclosing box tree and using a one-dimensional array to save node information, combining state switches and tolerance settings, hard collision and soft collision detection are achieved.

Benefits of technology

It greatly improves the efficiency of collision detection, reduces the time to traverse the surrounding box tree, and can give collision detection results faster to meet the needs of designers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116563468B_ABST
    Figure CN116563468B_ABST
Patent Text Reader

Abstract

The present invention belongs to the field of computer graphics technology, and specifically discloses a method for detecting collision relations of components in a three-dimensional building. The method comprises: constructing a hierarchical bounding box tree for the three-dimensional building, and using a one-dimensional array to store all nodes in the hierarchical bounding box tree, wherein the child nodes under the same parent node are stored as continuous array elements. The advantage of the present invention is that the speed of traversing the hierarchical bounding box tree is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of computer graphics, and in particular to a method and electronic equipment for detecting collision relations of components in a three-dimensional building. Background Art

[0002] In the construction industry, since designing a building, such as a building, requires the collaboration of multiple disciplines, conflicts may sometimes arise at a certain location in the building. For example, a structural engineer may design a support column at location A, while an architect may design a door at location A, which is obviously a contradictory design.

[0003] In order to avoid similar conflicts, it is necessary to merge the design drawings of various disciplines into a general building plan, and analyze whether there are conflicting designs based on the general building plan. In the industry, this is called Collision Detection.

[0004] At present, there are many methods for collision detection. In the field of construction, since a building can be composed of thousands or tens of thousands of components, each component needs to be analyzed and judged separately to see whether there is a component that conflicts (collides) with it, so the amount of data will be very large. In order to increase the speed of collision detection, it is necessary to improve the existing collision detection methods. Summary of the invention

[0005] In order to solve the above defects and facilitate designers to quickly and accurately find conflicts / collisions between components, the present invention proposes a method for detecting collision relationships between components in a three-dimensional building, including: constructing a hierarchical bounding box tree for the three-dimensional building, and using a one-dimensional array to save all nodes in the hierarchical bounding box tree, wherein child nodes under the same parent node are saved as continuous array elements.

[0006] The above method further includes: setting a tolerance, wherein the tolerance is used to indicate whether to perform hard collision detection or soft collision detection. When the tolerance is 0, hard collision detection is performed, and when the tolerance is a non-zero value, soft collision detection is performed.

[0007] The above method further includes: traversing each node in the hierarchical bounding box tree to determine bounding box pairs that have a collision relationship, which further includes:

[0008] A stack is established, the top of the stack is used to temporarily store nodes waiting to be processed, and the status of the nodes waiting to be processed is marked;

[0009] The node to be processed at the top of the stack is read, and starting from the state of the node, a bounding box pair having a collision relationship is determined through a state transition machine.

[0010] In the above method, the state transition machine includes three states: state 0, state 1 and state 2. The switching of the three states is as follows:

[0011] State 0 is used to process nodes. If the node to be processed is a leaf node, it will go to state 2 to continue processing. If the node to be processed is not a leaf node, the child node under the node to be processed will be marked as state 0, and the child node will be pushed to the top of the stack. The node to be processed will go to state 1 to continue processing and be marked as processing self-intersection.

[0012] State 1, based on the bounding box tree, obtain the two child nodes under the node to be processed, and determine whether the node pair formed by the two child nodes has a collision, if so, turn to state 2 to continue processing;

[0013] State 2, processing node pairs, if the node is a single leaf node marked as processing self-intersection, then determine whether any set of bounding box pairs under the node are colliding, otherwise determine whether the nodes in the node pair are all leaf nodes, if they are all leaf nodes, then determine whether the bounding box pairs in the node pair are colliding, if they are not all leaf nodes, then for the node that is not a leaf node, obtain its two child nodes, and determine whether the bounding box pairs in the two child nodes collide, if so, turn to state 2.

[0014] In the above method, the method further includes: traversing the bounding box pair having a collision relationship to determine whether there is a hard collision or a soft collision between the first component and the second component enclosed by the bounding box pair having a collision relationship.

[0015] In the above method, when hard collision detection is performed, the method further comprises:

[0016] Respectively obtain vertex information of a plurality of triangular facets constituting the first component and the second component;

[0017] Determine whether a first triangular face patch in the first component intersects with a second triangular face patch in the second component;

[0018] If so, it is determined that the first component and the second component intersect, otherwise it is determined that they do not intersect.

[0019] In the above method, when soft collision detection is performed, the method further comprises:

[0020] Respectively obtain vertex information of a plurality of triangular facets constituting the first component and the second component;

[0021] Check whether a first triangular patch in the first component intersects with a second triangular patch in the second component,

[0022] If they intersect, it is determined that the first component and the second component intersect,

[0023] If they do not intersect, determine whether the first triangular face patch and the second triangular face patch are coplanar or parallel. If they are coplanar or parallel, calculate the distance between the edge of the first triangular face patch and the edge of the second triangular face patch, and take the smallest distance as the first shortest distance.

[0024] If they are not coplanar or parallel, then calculate the distance between the edge of the first triangular face patch and the vertex of the second triangular face patch, and the distance between the vertex of the first triangular face patch and the second triangular face patch, and take the shortest distance as the first shortest distance;

[0025] If the first shortest distance is smaller than a preset tolerance, it is determined that the first component collides with the second component.

[0026] In the above method, before traversing the bounding box pairs having a collision relationship, a filtering step is also included, wherein:

[0027] In the case of soft collision detection, triangles are filtered out from at least one of the following three levels:

[0028] At the bounding box level, filtering out the triangular face patches constituting the first component and the triangular face patches constituting the second component except for the overlapping portion of the bounding box pair;

[0029] At the component level, a container is constructed for each convex component, and it is determined whether the containers intersect. If they intersect, the corresponding component is filtered out. For non-convex components, they are decomposed into several convex parts, and containers are constructed for the convex parts.

[0030] At the facet level, when the density of the triangular facets is greater than a preset density threshold, bounding spheres are generated for the triangular facets constituting the first component and the triangular facets constituting the second component respectively, and the second shortest distance between the bounding sphere of the first component and the bounding sphere of the second component is calculated. If the second shortest distance is greater than a preset tolerance, the corresponding facets are filtered out.

[0031] In the above method, constructing a container for each convex member includes quantifying a refinement level L of the container and constructing the container according to the refinement level L.

[0032] In the above method, the calculation formula of the refinement level L is as follows:

[0033] L = μlog(ΦN(V+S+λ));

[0034] in,

[0035] λ(x,y,z)=(xy) 2 +(yz) 2 +(xz) 2 ;

[0036] Where ρ is the density of the component, is the average number of triangular facets of the component;

[0037] V is the volume of the component;

[0038] N is the number of triangles of the component;

[0039] S is the surface area of ​​the component;

[0040] λ is the standard coefficient of the component;

[0041] μ is a mapping constant;

[0042] Φ is the a priori component complexity, which is the product of the a priori component density and the average number of component triangles.

[0043] In the above method, the soft collision detection includes extending each edge of the bounding box in the hierarchical bounding box tree by a specified constant before traversing the hierarchical bounding box tree.

[0044] Based on the same inventive concept, the present invention also provides an electronic device, including:

[0045] at least one memory for storing computer instructions;

[0046] At least one processor implements the above method when the at least one processor executes the computer instructions.

[0047] Based on the same inventive concept, the present invention also provides a computer-readable storage medium, in which at least one computer instruction is stored. The at least one instruction is loaded and executed by a processor to implement the above method.

[0048] Based on the same inventive concept, the present invention also provides a computer program product, which includes a computer program / instructions. When the computer program / instructions are executed by a processor, the above method is implemented.

[0049] Compared with the prior art, the technical solution proposed in the present application performs multi-level bounding box segmentation on the building, thereby gradually segmenting the giant building into bounding boxes containing at least one component and forming a bounding box tree. In order to quickly traverse the bounding box tree, the present application improves the data structure of the bounding box tree. Usually, the bounding box tree adopts chain storage, that is, a pointer to the next node is stored in the previous node, and the information of the next node is obtained by pointer addressing. The present application stores all node information in a one-dimensional array, and the information of the corresponding node can be quickly obtained through the array subscript, which can save a lot of addressing time and greatly reduce the time required to traverse the bounding box tree, so that the collision detection result can be given faster.

[0050] In addition, through the traversal method of pre-order traversal, when a pair of child nodes do not intersect, the parallel processing capability of the CPU can be used to process the subtrees under the two child nodes in parallel, thereby further saving the time of traversing the bounding box tree. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] Figure 1 A schematic diagram of the division of a two-dimensional multi-level bounding box is shown;

[0052] Figure 2 A one-dimensional array storage structure proposed according to some embodiments of the present application is shown;

[0053] Figure 3 A flow chart of a method for detecting collision relations of components in a three-dimensional building according to some embodiments of the present application is shown;

[0054] Figure 4 A schematic diagram of a state transition machine proposed according to some embodiments of the present application is shown;

[0055] Figure 5 A flowchart of state 0 in a state machine according to some embodiments of the present application is shown;

[0056] Figure 6 A flowchart of state 1 in a state machine according to some embodiments of the present application is shown;

[0057] Figure 7 A flowchart of state 2 in a state machine according to some embodiments of the present application is shown;

[0058] Figure 8 A schematic diagram of the basic hardware structure of an electronic device proposed according to some embodiments of the present application is shown. DETAILED DESCRIPTION

[0059] The following specific embodiments illustrate the implementation of the present invention, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. Although the description of the present invention will be introduced in conjunction with the preferred embodiment, this does not mean that the features of this invention are limited to this implementation. On the contrary, the purpose of introducing the invention in conjunction with the implementation is to cover other options or modifications that may extend based on the claims of the present invention. In order to provide a deep understanding of the present invention, the following description will include many specific details. The present invention can also be implemented without using these details. In addition, in order to avoid confusion or blurring the focus of the present invention, some specific details will be omitted in the description. It should be noted that the embodiments of the present invention and the features in the embodiments can be combined with each other without conflict.

[0060] It should be noted that in this specification, similar numbers and letters represent similar items in the following drawings. Therefore, once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings and is assumed to be the same definition.

[0061] As explained in the background art, in the field of construction, computer-aided design is needed to assist architects, structural engineers, plumbing engineers and other multi-professional workers to verify whether their respective independent designs have unexpected conflicts or collisions.

[0062] Although there are some auxiliary tools now, with the development of virtual reality and people's higher requirements for experience, the requirements for real-time and accuracy of collision detection algorithms are also increasing. The hierarchical bounding box collision detection algorithm divides objects into bounding boxes of different granularity for testing, which has high accuracy but poor real-time performance. This application optimizes the traditional hierarchical bounding box collision detection algorithm and uses GPU parallel computing to further speed up the speed of the collision detection algorithm.

[0063] In order to make the objectives, technical solutions and advantages of the present invention more clear, the embodiments of the present invention will be further described in detail below with reference to the accompanying drawings.

[0064] Figure 1The diagram of the division of two-dimensional multi-level bounding boxes is shown. As shown in the figure, there are 4 components in the building 1, and four bounding boxes can be set to surround the 4 components: A1, A2, B1, and B2. If multi-level division is not performed, it is necessary to compare the 4 bounding boxes in pairs to obtain the conclusion whether there is a collision conflict between the 4 components. If a multi-level bounding box division is performed, a multi-level bounding box tree can be obtained. By judging the first-level bounding boxes A and B, the conclusion that there is no collision conflict between the bounding boxes A and B can be obtained, so there is no need to compare the bounding boxes A1, A2, B1, and B2 in pairs. It is only necessary to judge whether there is a collision conflict between the bounding boxes A1 and A2 and between the bounding boxes B1 and B2 in the bounding boxes A and B. Obviously, the division of multi-level bounding boxes can significantly reduce the number of judgments, thereby improving the efficiency of collision detection.

[0065] In addition, when a pair of bounding boxes at the same level do not collide, for example Figure 1 The bounding boxes A and B shown, the subtree contained under the bounding box A and the subtree contained under the bounding box B can be regarded as two independent trees. There will be no intersection between the two trees. Therefore, the parallel processing capability of the CPU / GPU can be used to synchronously perform collision detection on the two subtrees, thereby reducing the time for traversing the entire bounding box tree.

[0066] Figure 2 A one-dimensional array storage structure proposed according to some embodiments of the present application is shown. After establishing a bounding box tree, the present application improves how to save each node in the tree. Since the present application needs to find the storage location of the sibling node of the current node in the storage device in the process of traversing the bounding box tree to obtain the data in the sibling node, and then judge whether there is a collision between the current node (bounding box) and the sibling node (bounding box), the storage structure of the data, or the difference in the storage method of the data in the storage device will affect the speed of obtaining the content in the sibling node, that is, it can affect the speed of CPU addressing. Usually, the data of each node in the tree is scattered and discontinuous in the storage device, and the distance between the sibling nodes at the same level is related to the height of the binary tree. In this way, when the storage address of a sibling node is known and it is necessary to find the storage address of another sibling node through it, it needs to be obtained through complex calculations, which is not conducive to the demand for fast addressing of three-dimensional collision detection.

[0067] like Figure 2 As shown, the present application saves all nodes (data in the nodes) in the bounding box tree as a one-dimensional array. Figure 2The binary tree in includes a root node P, child nodes C1 and C2 of the root node P, and child nodes G1 and G2 of child node C1. The nodes at the same level are stored in sequence in the one-dimensional array. For example, C1 and C2, which are both first-level child nodes, are the first and second elements in the one-dimensional array, respectively, while G1 and G2, which are both second-level child nodes, are the third and fourth elements in the one-dimensional array, respectively. Since the one-dimensional array is stored in order by subscript in the storage device, the storage address of any element (i.e., node) in the array can be easily found by subscript, thus saving a lot of addressing time.

[0068] Furthermore, the present application also stores sibling nodes in adjacent locations, that is, two child nodes under the same parent node, for example Figure 2 The child nodes C1 and C2 under the parent node P shown in are saved as two consecutive elements (i.e., the subscripts are continuous) in a one-dimensional array, such as Figure 2 . When it is necessary to find the sibling node C2 of the child node C1 (whose address is index=1), the subscript of the sibling node C2 can be calculated by the following judgment statement: index%2==1?index+1:index-1, so that the storage address of the child node C2 can be directly obtained. Therefore, the speed of finding the sibling node is greatly improved by the method shown in this embodiment.

[0069] In addition, since the is_leaf and sibing functions are used extensively in the self-intersection judgment in this application, Figure 2 The storage optimization shown can significantly reduce the time spent on addressing.

[0070] Figure 3 A flowchart of a method for detecting collision relationships of components in a three-dimensional building according to some embodiments of the present application is shown. The method for detecting collision relationships of components in a three-dimensional building proposed in the present application includes three major steps: ① constructing a hierarchical bounding box tree; ② traversing the hierarchical bounding box tree to obtain bounding box pairs with collisions (preliminary collision detection); ③ making a detailed judgment on the components enclosed in the bounding box pairs to determine the components that collide.

[0071] Among them, collision includes hard collision and soft collision. Hard collision refers to the situation that the components inside the bounding box collide, while soft collision means that although the components inside the bounding box do not touch each other, the distance between them is too small and does not meet the relevant design rules or requirements. When doing soft collision detection, it is also necessary to expand the bounding box tree outward by a specified constant before the preliminary collision detection, that is, expand the bounding box by one circle, and then do preliminary collision detection based on the expanded bounding box.

[0072] The following combination Figure 3A process for detecting collision relationships between components in a three-dimensional building is described in detail.

[0073] S11, construct a hierarchical bounding box (Bounding Volume Hierarchy, BVH) tree for the selected three-dimensional building. A three-dimensional building is constructed in an orderly manner from many different components. As mentioned above, the ultimate goal of this application is to determine whether there is an unexpected collision between the components. The root of the hierarchical bounding box tree can be the three-dimensional building itself, that is, the three-dimensional building is the largest bounding box, and then the building (bounding box) is continuously segmented through a predetermined segmentation method. The newly segmented areas are the second, third...level bounding boxes, until the bottom-level bounding box (leaf node of the tree) encloses the actual component.

[0074] Each bounding box in the model can be generated by an axis-aligned bounding box (AABB) algorithm, and each bounding box is represented by two three-dimensional vectors, which together form a bounding box array. The two three-dimensional vectors can be two vertices on the diagonal of the bounding box. When determining whether the bounding boxes collide, it is only necessary to determine whether the vertices of the two bounding boxes intersect. In other embodiments, each bounding box can also be represented by the coordinates of the center point and the distance from the center point to the three sides of the bounding box.

[0075] In this embodiment, the BVH tree built from top to bottom is preferably a binary tree. It has two types of nodes: non-leaf nodes (Interior Node) and leaf nodes (Leaf Node). That is, if a Node is not a Leaf Node, it must be an Interior Node. For a leaf node, a bounding box information is stored thereunder, and the bounding box information at least includes the ID, coordinates, and component information in the bounding box. There can be more than one component in a bounding box (that is, multiple densely distributed components are divided into the same bounding box). For a non-leaf node, more than one child node information is stored thereunder, and the child node information at least includes the child node ID (for example, the subscript in a one-dimensional array) and the node status. If the number of child nodes under a node is 0, it means that this node is a leaf node. Since the leaf node is the place where the component information is finally stored, that is to say, the component ID is stored in this node (the detailed information of the component can be found through the ID); if the number of child nodes under this node is 1 or 2, it means that this node is a non-leaf node, that is to say, the ID of the child node is stored in this node (for example, the subscript in a one-dimensional array). That is to say, there is at least one subtree to be traversed under this node. When establishing a BVH tree, each time the current node is traversed along the three axes x, y, and z, the optimal axis is selected for cutting and two child nodes are formed. The above steps are recursively repeated until it cannot be cut, and finally a binary tree (BVH tree) is formed.

[0076] In this application, the use of Figure 2 The one-dimensional array shown is used to store all nodes in the hierarchical bounding box tree.

[0077] After the hierarchical bounding box tree is established and the node information is saved as a one-dimensional array, each node in the hierarchical bounding box tree can be traversed (ie, each element in the one-dimensional array is traversed in sequence) to determine the bounding box pairs that have a collision relationship.

[0078] As mentioned above, collisions include hard collisions and soft collisions. Hard collisions refer to situations where the physical components mentioned above actually collide with each other. Soft collisions refer to situations where the physical components do not actually collide with each other, but the space between the components is insufficient for users to stand or pass through, which does not meet the design requirements. Therefore, in addition to determining whether the components within the bounding box actually collide, it is also necessary to determine soft collisions for components that are closer.

[0079] Since there are some differences in the process between soft collision detection and hard collision detection, the following judgment and selection are made before starting to traverse the BVH tree.

[0080] S12, determining whether the current execution is a soft collision detection or a hard collision detection. For example, a tolerance may be preset, the tolerance being used to indicate whether a hard collision detection or a soft collision detection is to be performed, and when the tolerance is 0, a hard collision detection is performed, and when the tolerance is a non-zero value, a soft collision detection is performed.

[0081] S13, if soft collision detection is performed, the bounding box in the BVH tree is expanded. The expansion refers to expanding the bounding box in the hierarchical bounding box tree outward (i.e., extending the edges of the bounding box to make the bounding box larger) by a certain constant. For example, the preset tolerance is 1m, which means that soft collision detection is currently being performed, and the bounding box needs to be expanded. Based on the tolerance of 1m, each edge of the bounding box can be extended by 1×0.71=0.71m, where 0.71 is a preset coefficient used to adjust the specific value of the outward expansion of the bounding box. Then, based on the expanded bounding box, the BVH tree is traversed (i.e., S14) to find the bounding box pairs (expanded bounding box pairs) that may collide. Preferably, in the case where hard collision detection has been performed, the bounding box pairs that have been determined to have a hard collision can be ignored, that is, when traversing the BVH tree to detect soft collisions, the nodes of the bounding box pairs with hard collisions can no longer be traversed, thereby improving the efficiency of soft collision detection. Similarly, in order to further improve the efficiency of soft collision detection, it is also possible to pre-specify several or several types of components / bounding boxes for soft collision detection in combination with specific usage scenarios, thereby saving detection time.

[0082] S14, if hard collision detection is performed, or after performing the above S13, traverse the BVH tree to perform preliminary collision detection. The result of the preliminary collision detection is to output bounding box pairs with collision.

[0083] Specifically, a stack may be used to assist the traversal process, and the stack may be used to temporarily store information of nodes waiting to be processed, such as the array index of the node and the status of the node.

[0084] Since the present application adopts a pre-order traversal method, the root node P can be pushed into the stack when the stack is initialized, and the state of the root node is state 0 by default.

[0085] After the traversal begins, the top content of the stack (i.e., the information of a node) is read, and subsequent operations are determined based on the information stored therein, including whether the node data needs to be pushed into the stack for temporary storage. Figure 2 Assume that the 0th element in the array is currently read, which stores the information of node P. For example, the information of node P includes: the node state is state 0, and there are two child nodes C1 and C2 under node P, which are stored in the 1st and 2nd elements of the array respectively. According to the processing rules (for detailed description, please refer to the following relevant Figure 3), set the state of child nodes C1 and C2 to state 0, and then push the relevant information (including array label and current state) to the top of the stack, set the state of node P to state 1, and then push the relevant information to the top of the stack.

[0086] Then the top of the stack is read again, and the node is processed according to the current state of the node. For example, in the previous example, the information of node P is popped out from the top of the stack, including that the current state of node P is state 1, and node P includes two child nodes C1 and C2.

[0087] What operations each node performs in different states and how the states are switched can be determined by the state transition machine, and the final output of the state transition machine is a pair of bounding boxes that have a collision relationship.

[0088] Figure 4 A schematic diagram of a state transition machine proposed according to some embodiments of the present application is shown.

[0089] The state transition machine includes three states: state 0, state 1 and state 2. The switching of the three states is as follows:

[0090] State 0 is used to process nodes. If the node to be processed is a leaf node, the state of the node is marked as state 2, and the node is pushed to the top of the stack, waiting for further processing. If the node to be processed is not a leaf node, the child nodes under the node to be processed are marked as state 0, and the child nodes are pushed to the top of the stack. The state of the node to be processed is marked as state 2, and marked as processing self-intersection, and then the node to be processed is pushed to the top of the stack, waiting for further processing.

[0091] State 1, based on the bounding box tree, obtain the two child nodes under the node to be processed, and determine whether the node pair composed of the two child nodes has a collision. If so, mark the state of the node pair as state 2, and push the node pair information to the top of the stack, waiting for further processing.

[0092] State 2, processing node pairs, if the node is a single leaf node marked as processing self-intersection, then determine whether any two bounding boxes under the node have a collision, otherwise determine whether the nodes in the node pair are all leaf nodes, if they are all leaf nodes, then determine whether the bounding box pairs in the node pair have a collision, that is, component collision, if not all are leaf nodes, then for the node that is not a leaf node, obtain its two child nodes, and determine whether the node pair composed of the two child nodes has a collision (bounding box collision), if so, mark the state of the node pair as state 2, and push the node pair information to the top of the stack, waiting for further processing.

[0093] from Figure 4It can be seen from the state machine shown that the processing of each node finally enters state 2, in which it is determined whether the bounding box has a collision. In addition, state 2 is a recursive process. The recursive process ends when traversing to a leaf node.

[0094] Figure 5-7 A simple flow chart showing state 0, state 1 and state 2.

[0095] Figure 5 A flowchart of state 0 in a state machine proposed according to some embodiments of the present application is shown.

[0096] S41, obtaining a node A from the top of the stack;

[0097] S42, determining whether node A is a leaf node;

[0098] S43, if yes, the state of the node is marked as state 2, and the node is pushed into the stack and the processing of state 0 is ended; and after pushing node A into the stack, the next step is to continue reading the stack, so that node A continues to enter the processing of state 2 in the state machine;

[0099] S44, if not, further determine whether node A includes a child node, if not, end the processing of state 0 and re-read the data at the top of the stack;

[0100] S45, if included, process the child node. Specifically, the child node can be marked as state 0 and pushed to the top of the stack, while node A is marked as processing self-intersection and the state is marked as state 1, and then node A is pushed to the top of the stack to wait for further processing.

[0101] Figure 6 A flowchart of state 1 in a state machine proposed according to some embodiments of the present application is shown.

[0102] S46, if node A does not include a child node, the processing of node A is terminated directly, and the stack will continue to be read in the next step;

[0103] S47, if node A contains two child nodes, the two child nodes are processed to determine whether the node pair formed by the two child nodes has a collision. And return to S46, and again determine whether node A contains two child nodes. If there are no unprocessed child nodes under node A, the processing of state 1 can be exited, and then the next step of processing will be to read the data at the top of the stack, and decide which state of the state machine to enter according to the node state of the data at the top of the stack, so as to start a new round of processing.

[0104] Figure 7 A flowchart of state 2 in a state machine proposed according to some embodiments of the present application is shown.

[0105] S51, based on the processing of state 0, state 1 and state 2, a pair of nodes B and C can be obtained. Among them, nodes B and C may be a self-intersecting node pair, that is, they may be node A selected in step S43. In this case, node A has been determined to be a leaf node. According to the characteristics of the BVH tree split bounding box, the bounding box cannot be decomposed any further, so it is considered that all bounding boxes have collided.

[0106] S52: If the nodes are not self-intersecting, that is, nodes B and C are two different nodes, determine whether nodes B and C are both leaf nodes.

[0107] S53, if both are true, then determine them as a bounding box pair that has collided, and obtain the specific information of the triangle facets included in the original nodes B and C, so as to prepare for further detailed judgment (ie, whether the components actually collide).

[0108] S54, if not all of them, further determine whether node B has a child node, if not, exit, that is, nodes B and C do not collide.

[0109] S55, if node B has child nodes, further determine whether node C has child nodes, if not, return to S52.

[0110] S56, if node C has child nodes, then further process the child nodes of nodes B and C to determine whether there is a collision between the child nodes (4) of nodes B and C, that is, at most 2x2 bounding box pairs can be obtained to determine whether these bounding boxes collide. If there is a collision, recursively call the process of state 2 to further determine whether there is a collision between the child nodes of the next level.

[0111] It can be seen that step S56 initiates a recursive call, that is, in actual operation, the CPU first performs collision detection on the leaf nodes, that is, the most basic components, and then gradually returns to the previous level to determine whether there is a collision in the bounding box of the previous level, thereby traversing the entire BVH tree. During the detection process, the larger the BVH tree, the more nodes it has. Therefore, there will be a large number of operations based on a node looking for its sibling nodes, that is, there will be a large number of addressing processes. This application saves the data of all nodes in Figure 2 In the one-dimensional array shown, it is ensured that the two brother nodes under the same parent node are two adjacent array elements. Therefore, the calculation process of finding the storage location of the brother node is simplified to a ternary judgment sentence, which can save a lot of addressing time, and the time to traverse the entire BVH tree is greatly reduced. The time that designers wait for the output of collision detection results is greatly reduced, which meets the needs of designers.

[0112] Back to Figure 3After S14 is executed, further fine detection can be performed. Since the bounding box is not completely close to the building component, there may be a collision between the bounding boxes, but the components enclosed by the bounding boxes are not actually likely to collide. Therefore, a fine judgment can be made on the components enclosed by the bounding boxes to determine the components that actually collide, that is, it can be further judged whether the actual components collide when the bounding boxes collide.

[0113] Because in the three-dimensional software commonly used in the construction industry, a component is usually composed of triangular facets. When it is necessary to further determine whether the components actually collide, what is actually detected is whether the triangular facets intersect (in the case of soft collision, the shortest distance between the triangular facets of the two components is calculated). If the component is complex or there are many bounding boxes, the number of triangular facets will be large. If the triangular facets of the two components are calculated one by one to see whether they collide, it will be a lot of calculation, which will obviously affect the speed of collision detection. Therefore, before doing a detailed detection, you can first filter it, that is, screen the triangular facets, and exclude the facets that are impossible to intersect (in the case of soft collision, it is impossible to be the shortest distance), so as to reduce meaningless calculations. This embodiment proposes S15.

[0114] S15, filtering the triangular facets in a pair of bounding box pairs. Specifically, the overlapping portion of the bounding box pair is calculated, and all the triangular facets outside the overlapping portion are filtered out, and only the triangular facets in the overlapping portion are retained.

[0115] Obviously, in the case of hard collision detection, the actual collision occurs only in the part where the bounding box overlaps (i.e. intersects), so only the triangles in the overlapping part of the bounding box can be retained to participate in further fine collision detection. In practical applications, most of the triangles can be filtered out in this way, thereby greatly reducing the CPU's computing workload.

[0116] For soft collision detection, it is not enough to just perform filtering at the bounding box level. The judgment method of soft collision detection is different from that of hard collision and requires a lot of calculations. If you can filter out as many triangles that are impossible to intersect (cannot be the closest) as possible in the early stage through other means, you can greatly reduce the amount of calculation in the later fine detection. Therefore, in addition to filtering once at the bounding box level, you can also filter once at the component level.

[0117] The basic filtering method is to build a container for different components with a fine level not lower than the bounding box and not higher than the triangle face tree. If the container pair does not intersect, filter out the container pair (that is, filter out the corresponding component pair), otherwise keep the container pair, so that the retained components can be finely collided later.

[0118] There are two opportunities to create a container. The first is to initialize a null pointer array of a component container, and when the code runs to the filtering step (S15), the component container is polymorphically initialized at runtime; the second is to asynchronously pre-calculate the container of the corresponding level for each component at the beginning of the program, or to pre-calculate the container. The advantage of the first solution is that it can minimize the calculation of redundant bounding boxes; the advantage of the second solution is that after pre-processing, the container of the corresponding component can be quickly obtained, reducing runtime time consumption.

[0119] Furthermore, if the component is convex, it can fit the constructed container as closely as possible. For complex components with recessed positions or holes, algorithms such as V-HACD can be used to quickly approximate convex hull decomposition and simplification of non-convex hull models, and the construction can be pre-divided into multiple nearly convex parts to improve collision detection efficiency.

[0120] For a component, it is necessary to quantify the level of its container. We can make an assumption that the component density is uniformly distributed in space, then for the container fineness level of a component we have the following formula (1).

[0121] L=μlog(ΦN(V+S+λ)); Formula (1)

[0122] in,

[0123] λ(x,y,z)=(xy) 2 +(yz) 2 +(xz) 2 , where x, y, z are Cartesian coordinates;

[0124] Where ρ is the density of the component, is the average number of triangular faces of the component;

[0125] V is the volume of the component;

[0126] N is the number of triangles of the component;

[0127] S is the surface area of ​​the component;

[0128] λ is the standard coefficient of the component, which implies that the more the bounding box of a component resembles a regular hexahedron, the better;

[0129] μ is a mapping constant;

[0130] Φ is the a priori component complexity, which is the product of the a priori component density and the average number of component triangles.

[0131] The purpose of adding V is that the larger a component is, the greater the possibility of other components colliding with it.

[0132] The purpose of adding S is that for a real component involved in a collision, its surface area can affect the collision result.

[0133] The purpose of adding the λ factor is that for a component like a column, it may pass through many boxes on the BVH but not many components actually collide with it. For such components, a high-level container is required to avoid generating a large number of triangle pairs that may collide.

[0134] A more accurate way to calculate Φ is to create two 3D textures on the GPU and write the triangle and component information atomically into the corresponding textures and create a SAT (Summed Area Table) in parallel for accurate query of ρ and Considering that we will only generate the container once, in order to achieve better results in places with precise triangle patches, the container level calculation can also sample SAT multiple times and calculate according to the highest density. In other words, formula (1) can be optimized to the following formula (2)

[0135] L=μlog(max(Φ i )N(V+S+λ)); Formula (2)

[0136] According to formula (2), containers of different levels (i.e., L level) can be generated for different components. Common containers include AABB, OBB, and convex hull. The generation of OBB can use the method of generating a covariance matrix. The specific steps are to calculate the covariance matrix and take the eigenvector to obtain the principal axis of the model, and then obtain the rotation matrix. Then, the AABB is obtained in the principal axis space and rotated back to the original coordinates to obtain the OBB. The generation method of the convex hull depends on whether you want to prioritize quality or speed. If you want to quickly calculate the convex hull, you can use Quickhull or Chan's algorithm; if you want to calculate the optimal convex hull, you can use algorithms such as Graham scanning or Jarvis stepping.

[0137] In this example, the convex hull of non-AABB pairs is subjected to the three-dimensional GJK (Gilbert-Johnson-Keerthi) algorithm. The GJK algorithm can also calculate the shortest distance between two convex hulls in three-dimensional space, so that it can adapt to different situations of soft and hard collisions. In addition, each component AABB pair is still meaningful here, which can help us preliminarily eliminate component pairs to avoid redundantly running the more expensive GJK algorithm.

[0138] Furthermore, filtering can be performed once at the facet level. Specifically, when the density of the triangular facets in the overlapping area of ​​the bounding box is greater than a preset density threshold, bounding spheres can be generated for the triangular facets respectively, thereby calculating the second shortest distance between the bounding sphere of the first component and the bounding sphere of the second component. If the second shortest distance is less than the preset tolerance, the corresponding triangular facets are retained, otherwise the triangular facets are filtered out (not involved in fine detection). In order to improve the efficiency of the calculation, several components or even several triangular facets in the components can be specified to calculate the second shortest distance. Among them, the density of the triangular facets can be calculated by dividing the number of triangular facets constituting the component by the volume of the bounding box surrounding the component.

[0139] In the above-mentioned embodiments of multi-level filtering of components or patches, when the number of components is huge, the above-mentioned soft collision detection will become a performance bottleneck, greatly affecting the detection speed. It can be optimized by multi-threading and SIMD (Single Instruction Multiple Data) based on the CPU situation, and the general parallel computing architecture CUDA (Compute Unified Device Architecture) based on GPU (Graphic Process Unit) can be used to further accelerate the computing speed.

[0140] After filtering ( S15 ) is completed, fine collision detection may be continued.

[0141] S16, determining again whether the current detection is a hard collision detection or a soft collision detection.

[0142] S17, if it is a soft collision detection, the shortest distance between the first triangular facet of the first component in the bounding box pair and the second triangular facet of the second component in the bounding box pair is calculated for the triangular facets retained after filtering. Then S18 is executed to determine whether the shortest distance is less than the tolerance. If so, it is determined to be a soft collision (S19), otherwise it is determined to be a non-collision (S20).

[0143] Specifically, calculating the shortest distance includes:

[0144] The vertex information of the plurality of triangular facets constituting the first component (ie, the component included under the leaf node) and the second component is respectively obtained. After performing the filtering step as described in step S15, only the vertex information of the triangular facets retained after filtering can be obtained.

[0145] Check whether the first triangular patch in the first component intersects with the second triangular patch in the second component,

[0146] If they intersect, it is determined that the first component and the second component intersect.

[0147] If they do not intersect, determine whether the first triangle patch and the second triangle patch are coplanar or parallel.

[0148] If they are coplanar or parallel, calculate the distance between the edge of the first triangle patch and the edge of the second triangle patch, and take the smallest distance as the first shortest distance.

[0149] If they are not coplanar or parallel, calculate the distance between the edge of the first triangular patch and the vertex of the second triangular patch, and the distance between the vertex of the first triangular patch and the second triangular patch, and take the smallest distance as the first shortest distance;

[0150] If the first shortest distance is less than the preset tolerance, it is determined that the first component collides with the second component (soft collision).

[0151] S21, if it is a hard collision detection, then for the triangular facets retained after filtering, it is determined whether the first triangular facet of the first component in the bounding box pair and the second triangular facet of the second component in the bounding box pair intersect. If they intersect, it is determined to be a hard collision (S22), otherwise it is determined to be a non-collision (S20).

[0152] Specifically, the specific process of determining whether the faces intersect includes:

[0153] The vertex information of the plurality of triangular facets constituting the first component (ie, the component included under the leaf node) and the second component is respectively obtained. After performing the filtering step as described in step S15, only the vertex information of the triangular facets retained after filtering can be obtained.

[0154] Determine whether the first triangular patch in the first component intersects with the second triangular patch in the second component. Here, the intersection detection of spatial triangles can be performed using the Devillers & Guigue algorithm. The algorithm determines the relative position relationship between the points, lines, and planes in the triangle by the positive and negative geometric meanings of the determinants formed by the vertices of the triangle. First, determine whether the first triangular patch and the second triangular patch intersect in the same plane. Then calculate whether the first triangular patch and the second triangular patch intersect in different planes. If they intersect, according to the Moller algorithm, the two sides of one triangle must have an intersection with the plane where the other triangle is located, and this intersection must be on the line formed by the intersection of the two planes where the two triangles are located. Let the plane where the first triangular patch is located be the first plane, and the plane where the second triangular patch is located be the second plane. First, calculate the two intersections of the edge of the first triangular patch and the second plane, and the two intersections of the edge of the second triangular patch and the first plane. The intersection line of the first plane and the second plane is the straight line L. If both intersections do not exist, the first triangular patch and the second triangular patch do not intersect, otherwise the four intersections obtained must be on the straight line L. This algorithm calculates the positional relationship between the intersection point and the straight line L, and then obtains the result. Avoid using division operations in the calculation to speed up the operation.

[0155] If the first triangular face patch and the second triangular face patch intersect, it is determined that the first component and the second component intersect (ie, hard collision); otherwise, it is determined that they do not intersect (ie, no collision).

[0156] The above process eliminates the situation where the actual components in the bounding box pairs calculated in the previous steps do not collide, and finally obtains the component pairs with real and fine collision. Although the time complexity of traversing each set of triangular facets to see if they intersect is theoretically O(n^2), the present application can calculate when a pair of them intersects, saving a lot of expenses; and the above process can be run using multiple threads to maximize the parallel processing capabilities of the computer as much as possible, and the calculation speed is increased many times; in addition, due to the characteristics of the building structure, the number of triangular facets that make up a single component is relatively small, so even if it is O(n^2) times of calculation, the speed is acceptable.

[0157] The present invention also provides an electronic device, comprising: at least one memory for storing computer instructions; and at least one processor, which implements the above method when the at least one processor executes the computer instructions.

[0158] The present invention also provides a computer-readable storage medium, wherein at least one computer instruction is stored in the computer-readable storage medium, and the at least one instruction is loaded and executed by a processor to implement the above method.

[0159] The present invention also provides a computer program product, which includes a computer program / instruction. When the computer program / instruction is executed by a processor, the above method is implemented.

[0160] The embodiment of the method for collision detection provided by the present invention can be run in a variety of terminals. For example, the terminal can be an electronic device such as a mobile phone, a computer, or a PAD. Figure 8 A schematic diagram of the basic hardware structure of the electronic device 100 is given.

[0161] like Figure 8 As shown, the electronic device 100 at least includes a main processor 101 and a storage medium 103. According to different actual use requirements, the electronic device 100 may also include a coprocessor 102, an I / O unit 104, a network communication unit 105, and some other expansion units 106. The selectivity of the coprocessor 102, the I / O unit 104, the network communication unit 105, and other expansion units 106 is shown in the figure by dotted lines.

[0162] The main processor 101 and / or the coprocessor 102 are used to execute computer instructions stored in the storage medium 103 to implement the method proposed in the present invention. The main processor 101 is the control center of the electronic device 100, which is usually a general-purpose processor (for example, Intel's CPU series), which can achieve logical processing and arithmetic calculations in a relatively balanced manner. The main processor 101 uses various interfaces to connect various parts of the entire electronic device 100, and realizes various functions of the electronic device 100 by running or executing software programs stored in the storage medium 103, and calling data stored in the storage medium 103, thereby monitoring the electronic device 100 as a whole.

[0163] The coprocessor 102 is usually a dedicated processor (e.g., a user-programmable embedded microprocessor) used to implement a single function. For example, the coprocessor 102 may be a graphics processor (GPU) dedicated to processing graphics and images. The main processor 101 does not directly process information about graphics and images at this time, but provides data from other units to the coprocessor 102 or sends management instructions to the coprocessor 102 to instruct the coprocessor 102 to obtain data from other units, and after the coprocessor 102 processes the data, the main processor 101 receives the processing result from the coprocessor 102 so that other decisions can be made based on the processing result. For different professional fields, the coprocessor 102 can also be a signal processor, a network communication processor, a complex computing processor, etc. Usually, the hardware implementation basis of the coprocessor 102 is a digital signal processing (DSP) chip, or a complex programmable logic device (CPLD), a field programmable gate array (FPGA), and other application-specific integrated circuits (ASIC, Application Specific Integrated Circuit).

[0164] The storage medium 103 may include an internal memory and an external memory, or may also include a volatile memory and a non-volatile memory, or may also include a magnetic storage device, a solid-state memory, a flash memory, a floppy disk, and a hard disk. The storage medium 103 may be used to store an operating system (e.g., it may be executed by the main processor 101) and data generated during the operation of the operating system, a software program of an application software and data generated during the operation of the application software, and a software program of a dedicated module (e.g., it may be executed by a certain coprocessor 102) and data generated during the operation of the program. For example, in one embodiment of the present invention, the main processor 101 executes various functional applications and data processing by running a monitoring program stored in the storage medium 103. In some embodiments, the storage medium 103 may also be a remote memory (relative to a memory in the usual sense) remotely arranged relative to the main processor 101, and these remote memories may be connected to the main processor 101 or a certain coprocessor 102 via a network connection (e.g., via a network communication device 105). Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0165] The I / O (Input / Output) unit 104 includes an information input device and an information output device, which enables a user to interact with the electronic device 100. The input device can be used to receive input digital or character information, and specifically can include: a keyboard, a mouse, a joystick, a touch input device or a trackball, etc. The output device can be used to output / display a processing result processed by the electronic device 100, and the processing result can be made based on the information input by the input device. Specifically, the output device can include: a liquid crystal display (Liquid Crystal Display, LCD), an organic light-emitting diode (Organic Light-Emitting Diode, OLED), etc.

[0166] The network communication unit 105 realizes communication between the electronic device 100 and various remote devices through the connection of the wired / wireless network, so that the electronic device 100 can also exchange data with the remote device (for example, the remote storage described above). Alternatively, the electronic device 100 can also realize connection with the server through the network communication unit 105, so that the electronic device 100 can interact with the server as part of a large system.

[0167] Other expansion units 106 include a variety of peripheral components and interfaces thereof, so that the electronic device 100 can interact with a variety of devices. For example, through a Bluetooth interface, it can be connected to a Bluetooth headset, so that the audio played by the electronic device 100 can be received by the Bluetooth headset. For another example, through a bus interface (such as an RS-485 bus), the electronic device 100 can be connected to some sensors to obtain some monitoring data to assist the electronic device 100 in implementing specific functions. In various embodiments, other expansion interfaces 106 can exist alone or be integrated with other components of the electronic device 100. At the same time, other expansion interfaces 106 are optional, and their optional nature is represented in the figure by dotted lines.

[0168] In summary, the present invention simplifies the addressing process of the storage location of the node by improving the storage structure of the node in the bounding box tree, greatly improves the efficiency of traversing the bounding box tree, and improves the user experience of designers.

[0169] In the description provided herein, a large number of specific details are described. However, it is understood that embodiments of the present invention can be practiced without these specific details. In some instances, well-known methods, structures and techniques are not shown in detail so as not to obscure the understanding of this description.

[0170] It should be noted that the sequence of the above embodiments of the present invention is only for description and does not represent the advantages and disadvantages of the embodiments. The above describes specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0171] It should be understood that in order to streamline the present invention and aid in understanding one or more of the various inventive aspects, in the above description of exemplary embodiments of the present invention, various features of the present invention are sometimes grouped together into a single embodiment, figure, or description thereof. However, this disclosed method should not be interpreted as reflecting the intention that the claimed invention requires more features than those expressly recited in each claim. Rather, as reflected in the claims, inventive aspects lie in less than all of the features of the individual embodiments previously disclosed. Therefore, the claims that follow the detailed description are hereby expressly incorporated into the detailed description, with each claim itself serving as a separate embodiment of the present invention.

[0172] Those skilled in the art will appreciate that the modules in the devices in the embodiments may be adaptively changed and arranged in one or more devices different from the embodiments. The modules or units or components in the embodiments may be combined into one module or unit or component, and in addition they may be divided into a plurality of submodules or subunits or subcomponents. Except that at least some of such features and / or processes or units are mutually exclusive, all features disclosed in this specification (including the accompanying claims, abstracts and drawings) and all processes or units of any method or device disclosed in this manner may be combined in any combination. Unless otherwise expressly stated, each feature disclosed in this specification (including the accompanying claims, abstracts and drawings) may be replaced by an alternative feature providing the same, equivalent or similar purpose.

[0173] In addition, those skilled in the art will appreciate that, although some embodiments described herein include certain features included in other embodiments but not other features, the combination of features of different embodiments is meant to be within the scope of the present invention and form different embodiments. For example, in the claims, any one of the claimed embodiments may be used in any combination.

Claims

1. A method for detecting collision relationships of components in a three-dimensional building, characterized in that: include: A hierarchical bounding box tree is constructed for the three-dimensional building, and a one-dimensional array is used to store all nodes in the hierarchical bounding box tree, wherein child nodes under the same parent node are stored as continuous array elements, and when a child node under the same parent node is known, other child nodes are addressed by the array index of the child node, and each node in the hierarchical bounding box tree is traversed to determine bounding box pairs with a collision relationship, which further includes: A stack is established, the top of the stack is used to temporarily store nodes waiting to be processed, and the status of the nodes waiting to be processed is marked; The node to be processed at the top of the stack is read, and starting from the state of the node, a bounding box pair with a collision relationship is determined through a state transition machine, wherein the state transition machine includes three states: state 0, state 1, and state 2, and the switching of the three states is as follows: State 0 is used to process nodes. If the node to be processed is a leaf node, it will go to state 2 to continue processing. If the node to be processed is not a leaf node, the child node under the node to be processed will be marked as state 0, and the child node will be pushed to the top of the stack. The node to be processed will go to state 1 to continue processing and be marked as processing self-intersection. State 1, based on the bounding box tree, obtain the two child nodes under the node to be processed, and determine whether the node pair formed by the two child nodes has a collision, if so, turn to state 2 to continue processing; State 2, processing node pairs, if the node is a single leaf node marked as processing self-intersection, then determine whether any set of bounding box pairs under the node are colliding, otherwise determine whether the nodes in the node pair are all leaf nodes, if they are all leaf nodes, then determine whether the bounding box pairs in the node pair are colliding, if they are not all leaf nodes, then for the node that is not a leaf node, obtain its two child nodes, and determine whether the bounding box pairs in the two child nodes collide, if so, turn to state 2.

2. The method according to claim 1, characterized in that Also includes: A tolerance is set, where the tolerance is used to indicate whether to perform hard collision detection or soft collision detection. When the tolerance is 0, hard collision detection is performed, and when the tolerance is a non-zero value, soft collision detection is performed.

3. The method according to claim 1, characterized in that The method further includes: traversing the bounding box pairs having a collision relationship to determine whether a hard collision or a soft collision occurs between the first component and the second component enclosed by the bounding box pairs having a collision relationship.

4. The method according to claim 3, characterized in that In the case of hard collision detection, the method further comprises: Respectively obtain vertex information of a plurality of triangular facets constituting the first component and the second component; Determine whether a first triangular face patch in the first component intersects with a second triangular face patch in the second component; If so, it is determined that the first component and the second component intersect, otherwise it is determined that they do not intersect.

5. The method according to claim 3, characterized in that In the case of soft collision detection, the method further comprises: Respectively obtain vertex information of a plurality of triangular facets constituting the first component and the second component; Check whether a first triangular patch in the first component intersects with a second triangular patch in the second component, If they intersect, it is determined that the first component and the second component intersect, If they do not intersect, determine whether the first triangular face patch and the second triangular face patch are coplanar or parallel. If they are coplanar or parallel, calculate the distance between the edge of the first triangular face patch and the edge of the second triangular face patch, and take the smallest distance as the first shortest distance. If they are not coplanar or parallel, then calculate the distance between the edge of the first triangular face patch and the vertex of the second triangular face patch, and the distance between the vertex of the first triangular face patch and the second triangular face patch, and take the shortest distance as the first shortest distance; If the first shortest distance is smaller than a preset tolerance, it is determined that the first component collides with the second component.

6. The method according to claim 3, characterized in that Before traversing the bounding box pairs having a collision relationship, a filtering step is also included, wherein: In the case of hard collision detection, filtering out the triangular face patches constituting the first component and the triangular face patches constituting the second component except for the overlapping portion of the bounding box pair; In the case of soft collision detection, triangles are filtered out from at least one of the following three levels: At the bounding box level, filtering out the triangular face patches constituting the first component and the triangular face patches constituting the second component except for the overlapping portion of the bounding box pair; At the component level, a container is constructed for each convex component, and it is determined whether the containers intersect. If they intersect, the corresponding component is filtered out. For non-convex components, they are decomposed into several convex parts, and containers are constructed for the convex parts. At the facet level, when the density of the triangular facets is greater than a preset density threshold, bounding spheres are generated for the triangular facets constituting the first component and the triangular facets constituting the second component respectively, and the second shortest distance between the bounding sphere of the first component and the bounding sphere of the second component is calculated. If the second shortest distance is greater than a preset tolerance, the corresponding facets are filtered out.

7. The method according to claim 6, characterized in that The constructing of a container for each male component comprises quantifying a level of refinement L of the container and constructing the container according to the level of refinement L.

8. The method according to claim 7, characterized in that The calculation formula of the fineness level L is as follows: L = μlog(ΦN(V+S+λ)); in, λ(x,y,z)=(xy) 2 +(yz) 2 +(xz) 2 4 Where ρ is the density of the component, is the average number of triangular faces of the component; V is the volume of the component; N is the number of triangles of the component; S is the surface area of ​​the component; λ is the standard coefficient of the component; μ is a mapping constant; Φ is the a priori component complexity, which is the product of the a priori component density and the average number of component triangles.

9. The method according to claim 2, characterized in that The soft collision detection includes extending each edge of a bounding box in the hierarchical bounding box tree by a specified constant before traversing the hierarchical bounding box tree.

10. An electronic device, characterized in that: include: at least one memory for storing computer instructions; At least one processor, when the at least one processor executes the computer instructions, implements the method according to any one of claims 1-9.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores at least one computer instruction, and the at least one instruction is loaded and executed by a processor to implement the method according to any one of claims 1 to 9.

12. A computer program product, characterized in that The computer program product comprises a computer program / instruction, and when the computer program / instruction is executed by a processor, the method according to any one of claims 1 to 9 is implemented.

Citation Information

Patent Citations

  • Fast continuous collision detection method based on human brain deformation simulation

    CN105205289A

  • Collision detection method based on BIM technology

    CN107330139A