Grid reconstruction method and device, electronic equipment and storage medium
By using collision detection and interception algorithm in the surface interception algorithm to determine the intersection points and boundary points of the triangle pair, and reconstructing them based on these information, the problem of insufficient efficiency and accuracy of the surface interception algorithm in the prior art is solved. , achieving more efficient and accurate grid reconstruction.
Patent Information
- Application Number
- CN202311031178.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-16
- Publication Date
- 2025-02-21
AI Technical Summary
The existing surface interleaving algorithm has shortcomings in terms of computational efficiency, accuracy and robustness, which affects the efficiency and quality of geological modeling.
By obtaining at least two triangular mesh geological surfaces, a collision detection algorithm is used to determine the triangle pair, and then an intersection algorithm is used to determine the intersection set and boundary point set, based on this information, a topologically ordered intersection line set is determined, and a mesh reconstruction is performed , obtain the reconstructed triangular mesh geological surface.
The calculation efficiency of intersection points is improved and the accuracy of intersection results is improved, so that the reconstructed triangular mesh geological surface can better reflect the topological relationship.
Smart Images

Figure CN119494936A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer processing technology, and in particular to a grid reconstruction method, device, electronic device and storage medium. Background Art
[0002] Surface intersection is a very important problem in computer graphics, reverse engineering, solid modeling, geological modeling and other fields. In geological modeling, the intersection algorithm of geological grid surfaces is the key algorithm for topological analysis. However, the calculation efficiency, correctness and robustness of existing intersection algorithms are low, which affects the efficiency and quality of topological analysis and subsequent modeling. Summary of the invention
[0003] In response to the above problems, the present application provides a grid reconstruction method, device, electronic device and storage medium, which can improve the calculation efficiency of intersection points and make the intersection results more accurate.
[0004] The present application provides a grid reconstruction method, comprising:
[0005] Obtain at least two triangular mesh geological surfaces;
[0006] A collision detection algorithm is used to determine the triangle pairs between any two triangular mesh geological surfaces;
[0007] Using an intersection algorithm to determine the intersection point set and the boundary point set in the triangle pair;
[0008] Determine a topologically ordered set of intersection lines based on the set of intersection points and the set of boundary points;
[0009] The arbitrary two triangular mesh geological surfaces are meshed and reconstructed based on the intersection line set to obtain a reconstructed triangular mesh geological surface.
[0010] In some embodiments, the arbitrary two triangular mesh geological surfaces include: a first surface and a second surface, and the use of a collision detection algorithm to determine the triangle pairs in the arbitrary two surfaces includes:
[0011] Constructing an average unit cell according to the first curved surface, wherein each of the average units includes a triangle of the first curved surface;
[0012] Determine all average cells traversed by each triangle of the second surface;
[0013] Determine whether the triangles in all average cells traversed by each triangle intersect with the corresponding triangles of the second surface;
[0014] If the triangles in all the average cells traversed by each triangle intersect with the triangles corresponding to the second surface, the triangles in all the average cells and the triangles corresponding to the second surface are output as triangle pairs to obtain triangle pairs in any two surfaces.
[0015] In some embodiments, constructing an average cell according to the first curved surface includes:
[0016] Determine the bounding box of the first surface;
[0017] dividing the bounding box into average cells;
[0018] Based on the positions of the triangles of the first surface, each triangle in the first surface is assigned to each average cell.
[0019] In some embodiments, the triangle pair includes: a first triangle and a second triangle, and the determining of the intersection point set and the boundary point set in the triangle pair by using the intersection algorithm includes:
[0020] Determine the intersection point between the first triangle and the second triangle based on an intersection algorithm, and input the intersection point into an intersection point set;
[0021] Determine whether each intersection point is a boundary point. If the intersection point is a boundary point, enter it into the boundary point set.
[0022] In some embodiments, determining the intersection point between the first triangle and the second triangle based on an intersection algorithm includes:
[0023] Determine three sides of the first triangle;
[0024] For any side of the first triangle, determine whether the any side has intersected with the second triangle, and if no intersection has been found, determine the intersection point of the any side with the second triangle;
[0025] Determine a positional relationship between the intersection point and the second triangle, and determine a positional relationship between the intersection point and any one of the edges;
[0026] In a case where the intersection point is not outside the second triangle, the intersection point is determined as an intersection point between the first triangle and the second triangle to obtain an intersection point between the first triangle and the second triangle.
[0027] In some embodiments, the method further comprises:
[0028] determining a number of intersections between the first triangle and the second triangle;
[0029] When the number of intersection points between the first triangle and the second triangle exceeds 2, the intersection points are deleted to keep 2 intersection points.
[0030] In some embodiments, the method further comprises:
[0031] Determine whether there are multiple edges passing through a target intersection;
[0032] When there are multiple edges passing through a target intersection, a target edge closest to the target intersection is selected to pass through the target intersection, and other edges among the multiple edges except the target edge are set not to pass through the target intersection.
[0033] In some embodiments, determining a topologically ordered set of intersection lines based on the set of intersection points and the set of boundary points includes:
[0034] sorting the intersection point set and the boundary point set based on geometric information between each intersection point;
[0035] Generate a non-closed curve based on the sorted set of boundary points;
[0036] Remove the boundary points in the intersection point set to obtain the remaining intersection points;
[0037] Generate closed curves from the remaining intersection points to obtain a topologically ordered set of intersection lines.
[0038] In some embodiments, reconstructing the meshes of the two arbitrary triangular mesh geological surfaces based on the intersection line set to obtain a reconstructed triangular mesh geological surface includes:
[0039] The triangulation method of maximizing the minimum internal angle is adopted to reconstruct the meshes of the arbitrary two triangular mesh geological surfaces based on the intersection line set.
[0040] In some embodiments, the method further comprises:
[0041] Merge the intersection points of any two reconstructed triangular mesh geological surfaces whose distance from the intersection line is less than the distance threshold. When merging, the common points of multiple intersection lines cannot be moved, and the edges with intersection lines cannot be deleted.
[0042] The diagonals of two adjacent triangles whose normal vector angles in any two reconstructed triangular geological surfaces are less than an angle threshold are exchanged.
[0043] The present application provides a grid reconstruction device, including:
[0044] An acquisition module, used for acquiring at least two triangular mesh geological surfaces;
[0045] The first determination module is used to determine triangle pairs in any two triangular mesh geological surfaces using a collision detection algorithm;
[0046] A second determination module, configured to determine the intersection point set and the boundary point set in the triangle pair by using an intersection algorithm;
[0047] A third determining module, configured to determine a topologically ordered set of intersection lines based on the set of intersection points and the set of boundary points;
[0048] The reconstruction module is used to reconstruct the meshes of the arbitrary two triangular mesh geological surfaces based on the intersection line set to obtain a reconstructed triangular mesh geological surface.
[0049] An embodiment of the present application provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, any one of the above-mentioned grid reconstruction methods is executed.
[0050] An embodiment of the present application provides a storage medium, which stores a computer program that can be executed by one or more processors and can be used to implement any of the above-mentioned grid reconstruction methods.
[0051] The present application provides a mesh reconstruction method, device, electronic device and storage medium, which obtain at least two triangular mesh geological surfaces; use a collision detection algorithm to determine the triangle pairs in any two triangular mesh geological surfaces; use an intersection algorithm to determine the intersection set and the boundary point set in the triangle pairs; determine a topologically ordered intersection line set based on the intersection point set and the boundary point set; and reconstruct the meshes of the any two triangular mesh geological surfaces based on the intersection line set to obtain a reconstructed triangular mesh geological surface, which can improve the calculation efficiency of the intersection points and make the intersection result more accurate, so that the reconstructed triangular mesh address surface can better reflect the topological relationship. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] Hereinafter, the present application will be described in more detail based on embodiments and with reference to the accompanying drawings.
[0053] Figure 1 A schematic diagram of an implementation flow of a grid reconstruction method provided in an embodiment of the present application;
[0054] Figure 2 A schematic diagram of a data structure of topology information provided in an embodiment of the present application;
[0055] Figure 3 A schematic diagram of an intersection provided in an embodiment of the present application;
[0056] Figure 4 A schematic diagram of the relationship between an intersection point and a triangle provided in an embodiment of the present application;
[0057] Figure 5 A schematic diagram of a parallelepiped composed of space triangles provided in an embodiment of the present application;
[0058] Figure 6 A schematic diagram of the intersection of a method for finding the intersection of an edge and a triangle provided in an embodiment of the present application;
[0059] Figure 7 A schematic diagram of the intersection of a pair of triangles provided in an embodiment of the present application;
[0060] Figure 8 A schematic diagram of a multi-sided common point provided in an embodiment of the present application;
[0061] Fig. 9 A schematic diagram of intersection sorting provided in an embodiment of the present application;
[0062] Fig.10 A schematic diagram of inserting a point into a DT to obtain a triangle provided in an embodiment of the present application;
[0063] Fig.11 A schematic diagram of a method for searching a triangle provided in an embodiment of the present application;
[0064] Fig.12 A schematic diagram of grid merging provided in an embodiment of the present application;
[0065] Fig.13 A schematic diagram of the exchange result of a diagonal exchange provided in an embodiment of the present application;
[0066] Fig.14 A schematic diagram of three curved surfaces intersecting each other in pairs provided in an embodiment of the present application;
[0067] Fig.15 This is a schematic diagram of a situation where an intersection line is encountered during optimization in an embodiment of the present application;
[0068] Fig.16 A schematic diagram of 6 geological surfaces provided in an embodiment of the present application;
[0069] Fig.17 It is a schematic diagram of the collision result between f1 and h1;
[0070] Fig.18 It is a schematic diagram of the collision result between b and f1;
[0071] Fig.19 It is a schematic diagram of the collision result between b and h1;
[0072] Fig. 20 A schematic diagram of an intersection line and a surface provided in an embodiment of the present application;
[0073] Fig.21 A schematic diagram of the results of all intersection lines obtained in Table 2 provided in an embodiment of the present application;
[0074] Fig. 22 A schematic diagram of an example provided for an embodiment of the present application;
[0075] Fig.23 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
[0076] In the drawings, the same reference numerals are used for the same components, and the drawings are not drawn to scale. DETAILED DESCRIPTION
[0077] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. The described embodiments should not be regarded as limiting the present application. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of this application.
[0078] In the following description, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0079] If similar descriptions of "first\second\third" appear in the application documents, the following instructions will be added. In the following description, the terms "first\second\third" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second\third" can be interchanged in a specific order or sequence where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.
[0080] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0081] Based on the problems existing in the related art, an embodiment of the present application provides a grid reconstruction method, which is applied to an electronic device, which may be a computer, a mobile terminal, etc. The function implemented by the grid reconstruction method provided in the embodiment of the present application can be implemented by calling a program code by a processor of the electronic device, wherein the program code can be stored in a computer storage medium.
[0082] Embodiment 1
[0083] The present application embodiment provides a grid reconstruction method. Figure 1 A schematic diagram of the implementation flow of a grid reconstruction method provided in an embodiment of the present application is shown in FIG. Figure 1 As shown, including:
[0084] Step S101, obtaining at least two triangular mesh geological surfaces.
[0085] In the embodiment of the present application, the triangular mesh geological surface may include: a layer surface, a fault surface, a geological variable section, etc.
[0086] Step S102: using a collision detection algorithm to determine triangle pairs in any two triangular mesh geological surfaces.
[0087] In the embodiment of the present application, any two triangular mesh geological surfaces include: a first surface and a second surface, a triangle pair includes a triangle in the first surface and a triangle in the second surface, and a triangle in the first surface and a triangle in the second surface intersect.
[0088] In the embodiment of the present application, the collision detection algorithm can be considered as a pairwise collision problem of static objects in three-dimensional space. The core problem to be solved is how to quickly obtain pairs of basic geometric elements that may intersect.
[0089] In an embodiment of the present application, the collision detection algorithm may include: a bounding sphere tree, an AABB tree, an OBB-Tree and a FDH-Tree, and a collision detection algorithm based on an average cell.
[0090] In the embodiment of the present application, a collision detection algorithm based on average cells is preferred.
[0091] In some embodiments, the two arbitrary triangular mesh geological surfaces include: a first surface and a second surface, and step S102 can be implemented by the following steps:
[0092] Step S1021: construct an average cell according to the first curved surface, wherein the average cell includes triangles of the first curved surface.
[0093] In the embodiment of the present application, the average cell combines the idea of space division and indexing. First, the space occupied by the object is divided into cubic grid cells (average cells) of equal volume according to a certain scale. Each cell can be directly located by spatial position, similar to a spatial three-dimensional matrix, and can be quickly searched by subscript. A container (queue, array, etc.) is maintained in each cell, which is equivalent to building a "bucket" structure for each cell. During processing, one or more corresponding cells are found for each element of the object according to its spatial position, and its index is placed in the container of the cell, which is similar to establishing a spatial index for each element. Subsequent operations can be quickly located through these indexes, thereby speeding up the speed. When used for collision detection of two objects, only one object needs to establish an average cell, and then for each element of the other object, the corresponding cell is searched. Only when the container is not empty, the corresponding collision result is recorded. For surfaces with very different triangle sizes, cubic grid cells of variable size may be required, but this does not generally occur on geological surfaces, so only the construction of uniform grids is considered.
[0094] In an embodiment of the present application, constructing an average cell based on the first surface includes: determining a bounding box of the first surface; dividing the bounding box into average cells; and assigning each triangle in the first surface to each average cell based on the position of the triangles of the first surface.
[0095] In an embodiment of the present application, first, the bounding box of the first surface is determined; secondly, the rectangular bounding box is divided into l*m*n small cubic grids (average cells) according to the number of triangles of the first surface and the shape of the model, and a vector is maintained in each grid to store the index of the triangle; finally, the triangle is assigned to a number of cubic grids according to the position of each triangle, and the index number of the triangle is appended to the vector for storing the triangle maintained by the cubic grid. The basis for allocating triangles is that if the triangle intersects with a cell, the triangle is assigned to the cell. In addition, the size of the cell determines the number of triangles in each cell. If the cell is too large, there are too many triangles in each cell, and if the cell is too small, each triangle is shared by multiple cells, which will affect the efficiency of the algorithm. In an embodiment of the present application, the average cell size is set to 1.2 times the average side length of the triangle, which can achieve a better effect.
[0096] Exemplarily, the following steps may be used to calculate the cells that each triangle passes through: Assume that the cell G has been constructed.
[0097] Calculate the bounding box B of the triangle, where B is its diagonal (x min ,y min ,z min ), (x max ,ymax ,z max ) is represented by:
[0098] x min =min(x1,x2,x3)x max =max(x1,x2,x3)
[0099] y min =min(y1,y2,y3)y max =max(y1,y2,y3)
[0100] z min =min(z1,z2,z3)z max =max(z1,z2,z3)
[0101] The three points of the triangle are v1(x1,y1,z1), v2(x2,y2,z2), and v3(x3,y3,z3).
[0102] Calculate the index range of the minimum and maximum points of B in G (i1, j1), (i2, j2), (i3, j3).
[0103]
[0104]
[0105]
[0106] Here X min , Y min , Z min is the coordinate of the minimum point of G, n x 、n y 、n z is the number of cells in the three directions of G, where cellsize is the side length of the cell
[0107] For each cell in the range (i1,j1),(i2,j2),(i3,j3), calculate whether it intersects with the triangle patch.
[0108] Step S1022, determining all average cells traversed by each triangle of the second surface.
[0109] In the embodiment of the present application, after the average cell is constructed, the collision detection process is similar to the construction process, and it is only necessary to calculate the cells passed by the triangle and then perform an intersection test with the triangles stored therein.
[0110] Step S1023, determining whether the triangles in all the average cells traversed by each triangle intersect with the triangles corresponding to the second curved surface.
[0111] Step S1024, if the triangles in all the average cells traversed by each triangle intersect with the triangles corresponding to the second surface, output the triangles in all the average cells and the triangles corresponding to the second surface as triangle pairs to obtain triangle pairs in any two surfaces.
[0112] Exemplarily, an average cell G is constructed according to the first curved surface S1; for each triangle t in the second curved surface S2, the following operations are performed:
[0113] Step a: Find all cells that t passes through in G, take out the triangles in S1 saved by them, and get the triangle set s;
[0114] Step b: For each triangle t' of s, determine whether t and t' intersect; if they do, add the triangle pair (t, t') to the output sequence.
[0115] Step S103: using an intersection algorithm to determine the intersection point set and the boundary point set in the triangle pair.
[0116] In the embodiment of the present application, the intersection point set includes intersection points and boundary points, while the boundary point set only includes boundary points.
[0117] In the embodiment of the present application, the boundary point is the intersection point on the boundary of the triangle.
[0118] In the embodiment of the present application, step S103 can be implemented by the following steps:
[0119] Step S1031, determining the intersection point between the first triangle and the second triangle based on an intersection algorithm, and inputting the intersection point into an intersection point set.
[0120] Step S1032, determine whether each intersection point is a boundary point, and if the intersection point is a boundary point, input it into the boundary point set.
[0121] In an embodiment of the present application, step S1031 can be implemented in the following manner: determine the three sides of the first triangle; for any side of the first triangle, determine whether the any side has intersected with the second triangle, and if not, determine the intersection point of the any side with the second triangle; determine the positional relationship between the intersection point and the second triangle, and determine the positional relationship between the intersection point and the any side; when the intersection point is not outside the second triangle, determine the intersection point as an intersection point between the first triangle and the second triangle to obtain the intersection point between the first triangle and the second triangle.
[0122] In the embodiment of the present application, the most basic task of surface intersection is to find all intersection points. In order to facilitate the sorting of intersection points in the next step, it is necessary to record the necessary topological information (such as triangle information associated with the intersection point, edge information associated with the intersection point, etc.) in this step. The general intersection algorithm uses the intersection of triangles, which will lead to the overhead problem caused by repeated intersections, and also bring the precision problem of merging repeated points. Therefore, the embodiment of the present application proposes to use the intersection method of edges and triangles to effectively avoid these two problems.
[0123] In the embodiment of the present application, the topological information of points, edges, and triangles is stored between the triangles of the mesh surface. During the intersection process, each intersection also generates information associated with these elements. The effective use of this topological information will be of great help for subsequent processing. The topological information that needs to be recorded includes: the triangle to which each intersection belongs, the intersections contained in each triangle, the intersections generated by each edge, which triangles each edge has intersected with, and so on. Figure 2 A schematic diagram of a data structure of topology information provided in an embodiment of the present application, such as Figure 2 As shown, in Figure 2 In the structure, IntersectPoint is an intersection structure that records the three coordinates of the point, bUsed marks whether it has been visited, surface[2] records which two faces are intersected, triangle[2] is two sets that record which triangles of the two faces produce this intersection; Triangle is a triangle structure that records the index numbers of the three points, intersect_points is a set that records which intersections the triangle produces; Edge is an edge structure that records the two endpoint numbers of the edge and the two triangles to which the edge belongs (if it belongs to only one triangle, the edge is a boundary edge), intersect_points is also a set that records which intersections the edge produces; Surface is a triangular mesh surface that records all points and triangles, and generates information about all edges based on these triangles and stores it in edges.
[0124] The intersection algorithm of a mesh surface first needs to find intersecting triangle pairs. In the final analysis, the most basic algorithm is to find the intersection points of edges (line segments) and triangles and calculate the relationship between the intersection points and triangles. For example, the intersection algorithm of two triangles includes:
[0125] Step A, take out the three edges e1, e2, e3 of t1;
[0126] Step B, for each edge e i , do the following:
[0127] Step a: If e i If there is no intersection with t2, then find e iThe intersection point p with t2 is added to the intersection record (e i , t2), otherwise jump back to Step2;
[0128] Step b: Calculate the relationship between point p and triangle t2 (point is outside, inside, on the edge, on the vertex of the triangle), as well as the relationship between point p and edge e i The relationship (whether it is e i vertices);
[0129] Step c: If point p is outside triangle t2, the point is invalid; otherwise, the necessary topological information is recorded according to the relationship calculated in b, and point p is sent to the output result.
[0130] In an embodiment of the present application, for each triangle pair (t1, t2), the above method can be used to respectively calculate the intersection of (t1, t2) and the intersection of (t2, t1). If the intersection is valid, it is output to the result intersection set; if the intersection is a boundary point, it is also output to the boundary point set.
[0131] Figure 3 A schematic diagram of an intersection provided in an embodiment of the present application, such as Figure 3 As shown, the line segment p1p2 is a side of a triangle, ΔABC is another triangle, N is the normal vector of the plane Π where ΔABC is located, and the intersection point P can be calculated by the following equations:
[0132] P = P1 + λ(P2 - P1) (1);
[0133] N·P+d=0 (2);
[0134]
[0135] The two parameters N and d of plane Π can be obtained from equations (2) and (3). Substituting (1) into (2) we can obtain λ. If λ∈[0,1], the obtained P is valid. Otherwise, it means that P1 and P2 are on the same side of plane Π and the intersection point P is invalid.
[0136] Figure 4 A schematic diagram of the relationship between an intersection point and a triangle provided in an embodiment of the present application, such as Figure 4 As shown in the figure, a triangle and the extension of its sides divide the plane into 7 parts. Together with the three sides and three vertices of the triangle, these 13 positions can be divided into 5 categories: I, II, III and the sides and vertices marked in the figure; if you only want to determine whether the intersection point is inside the triangle, you only need to use the area relationship S ΔABC =S ΔPAB +S ΔPBC +S ΔPCAWhether it is true or not can be judged. Considering that the algorithm in Chapter 4 needs to know the exact relationship between the point and the triangle, the directed volume method is used here to calculate.
[0137] For a triangle in three-dimensional space, the determinant of the 3×3 matrix formed by the coordinates of its three points is the volume of a parallelepiped, which can be uniquely determined by the origin O and its three vertices. Figure 5 A schematic diagram of a parallelepiped composed of space triangles provided in an embodiment of the present application, such as Figure 5 As shown, A, B, and C are the three vertices of a triangle. Connect OA, OB, and OC and draw corresponding parallel lines to obtain a parallelepiped with OA, OB, and OC as edges. Let its volume be V, then
[0138]
[0139] Here V is the directed volume of the hexahedron. To calculate the relationship between point P and the triangle, we only need to calculate (4) and the following three determinants:
[0140]
[0141] Then, the relationship between the point and the triangle can be determined based on the sign relationship of V1, V2, V3 and V. If they are all the same sign, the point is inside the triangle, and if they are different signs, it means that it is outside the corresponding edge. If one of V1, V2, and V3 is 0, it means that the point is on the corresponding edge, and if two are 0, it means that the point is on the corresponding vertex.
[0142] The present invention adopts the edge-triangle intersection method, which may encounter several intersection situations. Figure 6 A schematic diagram of the intersection of an edge and a triangle provided in an embodiment of the present application is shown in FIG. Figure 6 As shown in the figure, P1 is a normal edge-triangle intersection, which does not require special processing. P2 is an edge-vertex intersection, and P3 is an edge-edge intersection. There are two other cases: the edge endpoint falls within the triangle face, and the edge endpoint coincides with the triangle vertex. Both of these cases can be attributed to the P2 case. The general processing method is to find all possible intersection points, and then determine whether these points coincide within a certain accuracy range, and perform corresponding processing.
[0143] The processing method in the embodiment of the present application is: if the intersection point p of edge e and triangle t is on a certain edge e' of t, then the triangle t' that shares the same edge e' with t will no longer participate in the intersection with edge e, but directly record the relevant topological information. Similarly, if the intersection point p of edge e and triangle t is on a certain vertex of t, then all adjacent triangles that share the same point p with t will no longer participate in the intersection with edge e. This can also reduce the overhead of repeated intersections, avoid the accuracy problems that may be encountered in determining duplicate points, and avoid the topological modification problems caused by merging duplicate points. When the intersection point is the endpoint of the edge, the processing method is similar to the case of P2.
[0144] After step S103, the method further includes:
[0145] Step S31, determining the number of intersections between the first triangle and the second triangle;
[0146] Step S32: when the number of intersection points between the first triangle and the second triangle exceeds 2, delete the intersection points to keep 2 intersection points.
[0147] Figure 7 A schematic diagram of the intersection of a triangle pair provided in an embodiment of the present application is shown in FIG. Figure 7 As shown, the number of intersection points of two triangles cannot exceed 2. There can be 1 or 2. Figure 7 a to Figure 7 d is the case of two intersection points. Figure 7 e and Figure 7 f is an intersection point. The intersection points are divided into the intersection points of edges and vertices, the intersection points of edges and edges, the intersection points of edges and triangles, and the intersection points are the endpoints of edges. If the number of intersection points of two triangles exceeds 2, you need to delete an intersection point according to the specific situation of the intersection point.
[0148] In some embodiments, after step S32, the method further includes:
[0149] Step S33, determining whether there are multiple edges passing through a target intersection;
[0150] Step S34, when there are multiple edges passing through a target intersection, select the target edge closest to the target intersection to pass through the target intersection, and set the other edges among the multiple edges except the target edge to not pass through the target intersection.
[0151] Figure 8 A schematic diagram of a multi-sided common point provided in an embodiment of the present application, such as Figure 8As shown in the figure, due to numerical precision problems in the calculation process, the intersection calculation result may have three edges that pass through point A, which is topologically incorrect. The solution is to select the edge closest to point A as the edge that passes through this point. The intersection points of other edges need to be forced to not pass through point A and be recalculated.
[0152] Step S104: determining a topologically ordered set of intersection lines based on the set of intersection points and the set of boundary points.
[0153] In the embodiment of the present application, the intersection line set includes: a non-closed curve and a closed curve. The non-closed curve is determined by a boundary point set, and the closed curve is determined by removing the boundary points in the intersection point set to obtain the remaining intersection points.
[0154] In the embodiment of the present application, step S104 can be implemented by the following steps:
[0155] Step S1041, sorting the intersection point set and the boundary point set based on geometric information between each intersection point;
[0156] Step S1042, generating a first non-closed curve based on the sorted boundary point set;
[0157] Step S1043, removing the boundary points in the intersection point set to obtain the remaining intersection points;
[0158] Step S1044: Generate a second non-closed curve from the remaining intersection points to obtain a topologically ordered set of intersection lines.
[0159] In the embodiment of the present application, the intersections in the intersection set and the boundary point set are scattered and disordered, and need to be sorted and separated into one or more curves. The intersection line here may have two forms: a non-closed curve (with a starting point and an end point) and a closed curve (the starting point can be any point). If there is no topological information in the intersection, it can only be sorted according to the geometric information between the intersections (such as distance information). This idea can be used to solve the intersection sorting in simple cases. Fig. 9 A schematic diagram of intersection sorting provided in an embodiment of the present application is shown in FIG. Fig. 9 As shown, Fig. 9 a, but it cannot be solved Fig. 9 In the case of b, some points of the two intersection lines are close to each other. If only the distance information is used, the intersection line may jump, resulting in the following situation: Fig. 9 The order of c is wrong, and the correct result should be Fig. 9 At the same time, frequently calculating the distance between points will result in a lot of time overhead and reduce the sorting efficiency.
[0160] In the embodiment of the present application, all intersection points can be set as unvisited, and the intersection line set can be set as empty; for each unvisited point p in the boundary point set, the actions of steps ac are performed to construct a curve C with p as the starting point, and C is marked as a non-closed curve; wherein steps ac include:
[0161] Step a. Set p as visited and add point p to C;
[0162] Step b. Take out the triangle information on the two faces recorded by point p, and find the next common unvisited intersection point p' based on the intersection information recorded by these triangles. If it can be found, set p = p' and go to step a. Otherwise, go to step c.
[0163] Step c. Add C to the intersection line set.
[0164] For each unvisited point p in the intersection set, perform steps ac to construct a curve C starting from p and mark C as a closed curve.
[0165] In the embodiment of the present application, the scattered point data can be sorted into several intersection lines according to this algorithm. Assuming that the first boundary point found is P1, the common points contained in the triangle (I) (VII) to which it belongs are P1 and P2. Since P1 has been visited, P2 is the next point of P1. Similarly, the common points contained in the triangle (VII, VIII) (I, II…VI) to which P2 belongs are P1, P2, and P3. Since P1 and P2 have been visited, P3 is the next point of P2. Experiments have shown that using the previous data structure to sort intersections is fast and can ensure the correctness of the sorting.
[0166] Step S105 , reconstructing the meshes of the two arbitrary triangular mesh geological surfaces based on the intersection line set to obtain a reconstructed triangular mesh geological surface.
[0167] In the embodiment of the present application, a triangulation method that maximizes the minimum internal angle may be used to reconstruct the meshes of any two triangular mesh geological surfaces based on the intersection line set.
[0168] In the embodiment of the present application, after the intersection points and intersection lines are obtained, the intersection point information is added to the surfaces involved in the intersection. These intersection points are scattered in the triangles that generate the intersection points. At this time, in order to ensure that the surfaces conform to the triangular mesh definition and ensure the topological consistency and geometric consistency between the surfaces, it is necessary to reconstruct the triangular meshes of the two surfaces near the intersection line, which is also called mesh reconstruction in the present invention. Mesh reconstruction means dividing the triangle where the intersection points are located according to the intersection points so that each intersection point belongs to the vertex of the triangle instead of existing as an isolated point.
[0169] As mentioned above, mesh reconstruction is a triangulation process, and the triangulation that maximizes the minimum internal angle is also called Delaunay triangulation, or DT triangulation for short, and Delaunay triangulation has good geometric properties: the minimum internal angle is the largest. Therefore, the mesh reconstruction in the embodiment of the present application is based on the Delaunay triangulation algorithm. The point-by-point insertion DT triangulation algorithm is an incremental Delaunay triangulation algorithm, and its main idea is to successively insert each point in the point set into the existing DT, and then update the triangles in the area affected by the point. The update operation includes: deleting all triangles in the affected area (points are within the circumscribed circle of the triangle), generating a hole, and then each edge of the hole and the new point form a new triangle. Fig.10 A schematic diagram of inserting a point into a DT to obtain a triangle is provided in an embodiment of the present application, such as Fig.10 As shown, the dotted part is the newly generated triangle.
[0170] The computation time of the point-by-point DT partitioning algorithm is mainly spent on calculating the area affected by the point. Since a DT may contain a large number of triangles, it will take a lot of time to traverse all triangles and determine whether their circumscribed circles contain the point one by one. Anglada proved that the area affected by a point in a DT is local, and it is only necessary to calculate the adjacent triangles of the triangle where the point is located, so an efficient triangle search algorithm is needed.
[0171] Calculating the triangle where a point is located is a necessary operation for inserting a new point. Therefore, an efficient triangle search algorithm will improve the efficiency of the entire algorithm. In a triangular mesh surface, the topological relationship between triangles is a potentially very useful internal connection. Chew proposed a triangle search algorithm based on direction search by using this topological relationship.
[0172] The basic idea of the algorithm is: take any triangle t, and calculate the exact relationship between point p and t according to the volume-oriented algorithm. If p is inside or on the boundary of t, then t is the required triangle, otherwise p must be outside an edge e of t. At this time, the topological information can be used to find the adjacent triangle t' that shares the same edge e with t, and then use t' as the starting triangle to search downward until a triangle containing p is found. Fig.11 A schematic diagram of a method for searching a triangle provided in an embodiment of the present application is shown as follows: Fig.11As shown, assuming that the first triangle is A, the calculated p is outside the two sides of A. The next adjacent triangle may be B or E. Obviously, the graph has two search paths: ABCD and AEFCD. These two paths are linear triangle strips between the starting triangle and the target triangle. Even if the existing DT contains a large number of triangles, this search algorithm only requires a small amount of calculation to quickly find the target triangle where the point is located.
[0173] There are two main ideas for point-by-point insertion of scattered points into DT:
[0174] (1) Generate a "big" triangle containing the point set, then insert points one by one, and finally delete the outer triangles;
[0175] (2) Generate the convex hull of the point set, first perform Delaunay triangulation on the convex hull, and then insert the points inside one by one.
[0176] In the embodiment of the present application, the intersection point to be processed locally belongs to a triangle, so it is more direct to use the first approach, and there is no need to delete the external triangle.
[0177] Among them, the insertion point algorithm in DT includes:
[0178] Step 1: Find the triangle t to which p belongs in DT. If it cannot be found, the algorithm ends.
[0179] Step 2: If p is a vertex of t, the algorithm ends; otherwise t enters the optimization queue Q;
[0180] Step 3: If Q is empty, go to Step 6; otherwise, a triangle t' pops up in Q;
[0181] Step 4: If point p is within the circumscribed circle of triangle t', then t' enters the to-be-deleted set old_tri, otherwise go to Step 3;
[0182] Step 5: Find the three neighbor triangles of t', mark the unprocessed triangles as processed, enter Q, and go to Step 3;
[0183] Step 6: Delete the common edges of the triangles in old_tri, and the remaining edges form the set e_set;
[0184] Step 7: For each edge e in e_set, p and e form a new triangle t' and add it to the set new_tri;
[0185] Step8: Update DT according to old_tri and new_tri, and the algorithm ends.
[0186] In some embodiments, after step S105, the method further includes:
[0187] Step S106, merging the intersection points of any two reconstructed triangular mesh geological surfaces whose distances from the intersection lines are less than the distance threshold, wherein when merging, common points of multiple intersection lines cannot be moved, and edges with intersection lines cannot be deleted.
[0188] In the embodiment of the present application, the DT decomposition algorithm of point-by-point insertion can complete the surface-intersection reconstruction operation of the present invention, and the running speed can also be satisfactory. If there is no special requirement for the shape of the triangle, the intersection and reconstruction process is basically completed. However, it can be seen from the processing method that this method can satisfy the Delaunay characteristics in a local range and has no global characteristics. That is to say, narrow and long triangles are likely to appear around the triangle to be decomposed, and these triangles need to be globally optimized. On the one hand, it makes the surface more beautiful, and on the other hand, it is conducive to subsequent processing.
[0189] The optimization adopted by the present invention has two actions: merging points with a short distance; and exchanging the diagonals of two triangles.
[0190] The merging of points with close distance is similar to the mesh simplification operation. The idea is to merge adjacent points on the intersection line whose distance is less than a certain threshold and merge points on the original mesh surface that are close to the intersection point. When merging, certain constraints are considered (no triangle with an area of 0 can appear after merging, and no triangle flipping can occur, etc.). Fig.12 A schematic diagram of grid merging provided in an embodiment of the present application is shown in FIG. Fig.12 shown.
[0191] Step S107, exchanging the diagonals of two adjacent triangles in any two reconstructed triangular geological surfaces whose normal vector angle is less than an angle threshold.
[0192] The purpose of exchanging the diagonals of two triangles is to make the triangle to be decomposed and the surrounding triangles satisfy the Delaunay property. Fig.13 A schematic diagram of the exchange result of a diagonal exchange provided in an embodiment of the present application is shown as follows: Fig.13 As shown, triangle ABC is the triangle to be decomposed. After adding three intersection points in the middle, it has been divided into 5 small triangles. These triangles conform to the Delaunay property internally, but it can be seen that triangle ABP is a relatively narrow triangle. At this time, if the normal vector angle between triangle ABC and triangle ABD is less than a threshold, and point p is within the circumscribed circle of triangle ABD, the diagonals should be exchanged, that is, AB should be deleted and PD should be added to form new triangles APD and PBD.
[0193] In some embodiments, when there are multiple curved surfaces, in actual geological modeling, it is often encountered that multiple curved surfaces intersect. The intersection of multiple curved surfaces is still based on the intersection of two by two. If the subsequent intersection line affects the previously generated intersection line, the previous intersection line must be modified and new information must be added. The following takes three curved surfaces as an example to illustrate this situation. Fig.14 A schematic diagram of three surfaces intersecting each other is provided in an embodiment of the present application, such as Fig.14 As shown in the figure, the three surfaces α, β, and γ intersect each other. The first step is to intersect α and β. Assume that the intersection line l1 is obtained and l1 is denoted as p0p1…p i p j …p n , and assuming that the triangle on α has been reconstructed, any two adjacent points p on l1 i p i+1 It must be an edge of a triangle of α. The second step is to find the intersection of α and γ. Assume that the intersection line is l2. If l2 does not intersect with l1, no special treatment is required. If they intersect, such as Fig.14 b, let l2 and line segment p i p j If the intersection point is p, two places need to be modified: the intersection line l1 should be at p i p j Add point p in the middle to make it p0p1…p i pp j …p n , point p should be added to the corresponding position of the surface β, and the triangle should be split at the same time, such as Fig.14 As shown in c, the two triangles are split into four, so that the consistency between the surface and the curve can be guaranteed.
[0194] In the embodiment of the present application, the edge data structure may be modified, and intersection line information may be added to the edge structure.
[0195] Specific method: Before finding the intersection, take the intersection line related to the surface to be intersected as input, find the corresponding edge in the surface for every two adjacent points on the intersection line, and add the information of the intersection line to the edge.
[0196] The intersection algorithm between triangles with intersection line information:
[0197] Input: two triangles t1, t2;
[0198] Output: The intersection of the edge of t1 and t2 (maybe none, at most 2);
[0199] Among them, determining the intersection point of the edge of t1 and t2 includes:
[0200] Step 1: Take out the three edges e1, e2, e3 of t1;
[0201] Step 2: For each edge e i , do the following:
[0202] Step a: If e i If there is no intersection with t2, then find e i The intersection point p with t2 is added to the intersection record (e i , t2), otherwise jump back to Step2;
[0203] Step b: Calculate the relationship between point p and triangle t2 (point is outside the triangle, inside the triangle, on the edge, on the vertex), as well as the relationship between point p and edge e i The relationship (whether it is e i vertices);
[0204] Step c: If point p is outside triangle t2, the point is invalid; otherwise, the necessary topological information is recorded according to the relationship calculated in b, and point p is sent to the output result.
[0205] Step d: If e i belongs to a certain intersection line l, then in l e i Add point p between the two associated points. At the same time, add point p to the other surface S that generates l and split e i The two triangles associated with the edge.
[0206] Step e: If point p is on an edge e' of triangle t2, make similar judgment and processing as step d.
[0207] Since the point-by-point interpolation method is performed inside the triangle, the intersection line information on the surface has no effect on the reconstruction operation. However, the optimization operation needs to merge the points with a small distance next to the intersection line and exchange the diagonals of adjacent triangles, which may destroy the original intersection line information. Therefore, the optimization operation needs to follow the existing intersection line constraints, which include:
[0208] The common points of multiple intersection lines cannot be moved;
[0209] Edges with intersection information cannot be deleted;
[0210] Fig.15 Schematic diagram of the situation where an intersection line is encountered during optimization in the embodiment of the present application, such as Fig.15 As shown in Figure 15a, L1 is the original intersection line on the surface. When optimizing L2, since P2 is the common point of the two intersection lines, P2 cannot be merged into P1 at this time. P1 can only be merged into P2, or not merged. AB in Figure 15b is also part of the original intersection line on the surface. At this time, even if P is within the circumscribed circle of ABD, the diagonal exchange operation cannot be performed, otherwise it will cause the original intersection line to break and inconsistency between the surfaces.
[0211] The present application provides a mesh reconstruction method, which obtains at least two triangular mesh geological surfaces; uses a collision detection algorithm to determine the triangle pairs in any two triangular mesh geological surfaces; uses an intersection algorithm to determine the intersection point set and the boundary point set in the triangle pairs; determines a topologically ordered intersection line set based on the intersection point set and the boundary point set; and reconstructs the meshes of the any two triangular mesh geological surfaces based on the intersection line set to obtain a reconstructed triangular mesh geological surface, which can improve the calculation efficiency of the intersection points and make the intersection result more accurate, so that the reconstructed triangular mesh address surface can better reflect the topological relationship.
[0212] Embodiment 2
[0213] Based on the problems existing in the related technologies, the embodiment of the present application provides several key technologies required for the intersection of a mesh surface: collision detection, intersection point calculation, topology detection, intersection point sorting, mesh reconstruction, optimization, synchronization of multiple surfaces, etc., and proposes a mesh surface intersection algorithm with intersection topology check. The algorithm provided in the embodiment of the present application can handle the situations of two surfaces and multiple surfaces, with relatively high efficiency, and the intersection result can correctly reflect the topological relationship between the surfaces.
[0214] The embodiment of the present application provides a specific example of a mesh reconstruction method, which uses C++ language to implement the average cell-based triangular mesh surface intersection algorithm and the multi-surface intersection algorithm. The program running environment is a Dell workstation configured with Xeon CPU 2.8G*2, 1G memory, and RedHat Enterprise operating system. The experimental data are two layer planes, three fault planes, and one geological boundary surface. The two surfaces in the horizontal direction are two layer planes, denoted as h1 and h2, and the three fault planes in the vertical direction, the largest of which is denoted as f1, and the other two are denoted as f2 and f3. The square surface in the vertical direction is the calculated bounding box. Fig.16 A schematic diagram of 6 geological surfaces provided in the embodiment of the present application, such as Fig.16 As shown,
[0215] Experiment 1: Collision Detection
[0216] This experiment uses C++ to implement the above collision detection algorithms, Sphere-Tree, AABB-Tree, FDH-Tree and UniformGrid. In addition, Gottschalk's RAPID package is used for comparison. The experiment is divided into three groups. The first group is h1 and three fault planes, the second group is h2 and three fault planes, and the third group is geological boundary surface b and other 5 surfaces. The test time is as shown in Table 1:
[0217] Table 1 is a speed comparison of several collision detection algorithms provided in the embodiments of the present application (unit: ms)
[0218]
[0219]
[0220]
[0221] From the data in Table 1, it can be seen that when one surface is fixed and the number of triangles on the other surface increases, the number of colliding triangle pairs also tends to increase, resulting in an increasing trend in the construction time and detection time of each algorithm, and thus the overall time will also increase. At the same time, it can be found that the detection time of the hierarchical bounding box algorithm is not much different, but the construction time is very different. The detection time is about an order of magnitude slower than the construction time, resulting in a large difference in overall efficiency. The efficiency of AABB-Tree here is higher than that of Sphere-Tree, which is consistent with the previous analysis. The efficiency of these two methods is higher than that of OBB-Tree and FDH-Tree, which seems to violate the conclusion that should be drawn. However, there is such a description in [Gottschalk 1996] that for surfaces that are large enough and close enough, using OBB-Tree can save collision detection time. The surfaces in the present invention are the stratum planes and fault planes in geological modeling, which generally do not appear to be close enough, so the use of AABB-Tree can achieve good results. Finally, let's compare the hierarchical bounding box with the average cell. Although the detection speed of the average cell is an order of magnitude slower than that of the hierarchical bounding box, since it only needs to construct cells for a surface during preprocessing, it saves a lot of construction time and the overall efficiency is still higher than that of the hierarchical bounding box. Therefore, the average cell algorithm adopted in the present invention can be used as a method to speed up the intersection operation.
[0222] Figures 17 to 19 A schematic diagram of a partial collision detection result of a point is provided for an embodiment of the present application, such as Fig.17 As shown, Fig.17 is the collision result between f1 and h1, Fig.18 is the collision result between b and f1, Fig.19 is the collision result of b and h1.
[0223] Experiment 2: Surface Intersection
[0224] Similarly, we use C++ to implement the surface intersection algorithm of the present invention, and the test data is still Fig.16 The running time of the program is shown in Table 2.
[0225] Table 2 is a schematic table of an intersection time provided in an embodiment of the present application (unit: ms)
[0226]
[0227] As can be seen from Table 2, after using the collision detection algorithm to find the colliding triangle pairs, the intersection time and sorting time are basically proportional to the number of triangle pairs, and have little to do with the number of triangles in the original surface. In addition, the sorting time is an order of magnitude faster than the intersection time, and its time consumption can be basically ignored. At the same time, it can be found that the number of intersection points is basically equal to the number of triangle pairs, which is in line with the actual situation.
[0228] Fig. 20 A schematic diagram of an intersection line and a surface provided in an embodiment of the present application, Fig.21 A schematic diagram of the results of all intersection lines obtained in Table 2 provided in an embodiment of the present application, a represents the intersection line and the surface, and b represents all intersection lines obtained in Table 8.2.
[0229] Experiment 3: Mesh Reconstruction
[0230] In the embodiment of the present application, the above-obtained intersection line is used to reconstruct the original surface. The reconstruction here adopts the spatial point-by-point insertion Delaunay triangulation algorithm proposed by the present invention, and after obtaining the reconstruction result, an optimization operation is performed.
[0231] Experiment 4: Multiple Surfaces
[0232] The previous three experiments used the results of intersecting and reconstructing each pair of surfaces. To prove the correctness of the algorithm, this section conducted separate experiments on the case where multiple surfaces intersect at one point. Fig. 22 A schematic diagram of an example provided in an embodiment of the present application, Fig. 22 aThe part marked by the white box is where the three sides intersect. Fig. 22 b, 22c, and 22d are the specific shapes of the white box area in Figure a after enlargement.
[0233] Embodiment 3
[0234] Based on the foregoing embodiments, an embodiment of the present application provides a grid reconstruction device, and the modules included in the device and the units included in the modules can be implemented by a processor in a computer device; of course, they can also be implemented by a specific logic circuit; in the implementation process, the processor can be a central processing unit (CPU, Central Processing Unit), a microprocessor (MPU, Microprocessor Unit), a digital signal processor (DSP, Digital Signal Processing) or a field programmable gate array (FPGA, Field Programmable Gate Array), etc.
[0235] The present application provides a grid reconstruction device, the grid reconstruction device comprising:
[0236] An acquisition module, used for acquiring at least two triangular mesh geological surfaces;
[0237] The first determination module is used to determine triangle pairs in any two triangular mesh geological surfaces using a collision detection algorithm;
[0238] A second determination module, configured to determine the intersection point set and the boundary point set in the triangle pair by using an intersection algorithm;
[0239] A third determining module, configured to determine a topologically ordered set of intersection lines based on the set of intersection points and the set of boundary points;
[0240] The reconstruction module is used to reconstruct the meshes of the arbitrary two triangular mesh geological surfaces based on the intersection line set to obtain a reconstructed triangular mesh geological surface.
[0241] In some embodiments, the arbitrary two triangular mesh geological surfaces include: a first surface and a second surface, and the use of a collision detection algorithm to determine the triangle pairs in the arbitrary two surfaces includes:
[0242] Constructing an average unit cell according to the first curved surface, wherein each of the average units includes a triangle of the first curved surface;
[0243] Determine all average cells traversed by each triangle of the second surface;
[0244] Determine whether the triangles in all average cells traversed by each triangle intersect with the corresponding triangles of the second surface;
[0245] If the triangles in all the average cells traversed by each triangle intersect with the triangles corresponding to the second surface, the triangles in all the average cells and the triangles corresponding to the second surface are output as triangle pairs to obtain triangle pairs in any two surfaces.
[0246] In some embodiments, constructing an average cell according to the first curved surface includes:
[0247] Determine the bounding box of the first surface;
[0248] dividing the bounding box into average cells;
[0249] Based on the positions of the triangles of the first surface, each triangle in the first surface is assigned to each average cell.
[0250] In some embodiments, the triangle pair includes: a first triangle and a second triangle, and the determining of the intersection point set and the boundary point set in the triangle pair by using the intersection algorithm includes:
[0251] Determine the intersection point between the first triangle and the second triangle based on an intersection algorithm, and input the intersection point into an intersection point set;
[0252] Determine whether each intersection point is a boundary point. If the intersection point is a boundary point, enter it into the boundary point set.
[0253] In some embodiments, determining the intersection point between the first triangle and the second triangle based on an intersection algorithm includes:
[0254] Determine three sides of the first triangle;
[0255] For any side of the first triangle, determine whether the any side has intersected with the second triangle, and if no intersection has been found, determine the intersection point of the any side with the second triangle;
[0256] Determine a positional relationship between the intersection point and the second triangle, and determine a positional relationship between the intersection point and any one of the edges;
[0257] In a case where the intersection point is not outside the second triangle, the intersection point is determined as an intersection point between the first triangle and the second triangle to obtain an intersection point between the first triangle and the second triangle.
[0258] In some embodiments, the grid reconstruction device is further used to:
[0259] determining a number of intersections between the first triangle and the second triangle;
[0260] When the number of intersection points between the first triangle and the second triangle exceeds 2, the intersection points are deleted to keep 2 intersection points.
[0261] In some embodiments, the grid reconstruction device is further used to:
[0262] Determine whether there are multiple edges passing through a target intersection;
[0263] When there are multiple edges passing through a target intersection, a target edge closest to the target intersection is selected to pass through the target intersection, and other edges among the multiple edges except the target edge are set not to pass through the target intersection.
[0264] In some embodiments, determining a topologically ordered set of intersection lines based on the set of intersection points and the set of boundary points includes:
[0265] sorting the intersection point set and the boundary point set based on geometric information between each intersection point;
[0266] Generate a non-closed curve based on the sorted set of boundary points;
[0267] Remove the boundary points in the intersection point set to obtain the remaining intersection points;
[0268] Generate closed curves from the remaining intersection points to obtain a topologically ordered set of intersection lines.
[0269] In some embodiments, reconstructing the meshes of the two arbitrary triangular mesh geological surfaces based on the intersection line set to obtain a reconstructed triangular mesh geological surface includes:
[0270] The triangulation method of maximizing the minimum internal angle is adopted to reconstruct the meshes of the arbitrary two triangular mesh geological surfaces based on the intersection line set.
[0271] In some embodiments, the grid reconstruction device is further used to:
[0272] Merge the intersection points of any two reconstructed triangular mesh geological surfaces whose distance from the intersection line is less than the distance threshold. When merging, the common points of multiple intersection lines cannot be moved, and the edges with intersection lines cannot be deleted.
[0273] The diagonals of two adjacent triangles whose normal vector angles in any two reconstructed triangular geological surfaces are less than an angle threshold are exchanged.
[0274] Embodiment 4
[0275] An embodiment of the present application provides an electronic device; Fig.23 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application is shown in FIG. Fig.23 As shown, the electronic device 700 includes: a processor 701, at least one communication bus 702, a user interface 703, at least one external communication interface 704, and a memory 705. The communication bus 702 is configured to realize the connection and communication between these components. The user interface 703 may include a display screen, and the external communication interface 704 may include a standard wired interface and a wireless interface. The processor 701 is configured to execute the program of the grid reconstruction method stored in the memory to implement the steps in the grid reconstruction method provided in the above embodiment.
[0276] In the embodiment of the present application, if the above-mentioned grid reconstruction method is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application can be essentially or partly reflected in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a U disk, a mobile hard disk, a read-only memory (ROM, Read Only Memory), a magnetic disk or an optical disk. In this way, the embodiment of the present application is not limited to any specific combination of hardware and software.
[0277] Accordingly, an embodiment of the present application provides a storage medium on which a computer program is stored, characterized in that when the computer program is executed by a processor, the steps in the grid reconstruction method provided in the above embodiment are implemented.
[0278] The description of the above electronic device and storage medium embodiments is similar to the description of the above method embodiments, and has similar beneficial effects as the method embodiments. For technical details not disclosed in the computer device and storage medium embodiments of this application, please refer to the description of the method embodiments of this application for understanding.
[0279] It should be understood that "one embodiment" or "an embodiment" mentioned throughout the specification means that specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. It should be understood that in various embodiments of the present application, the size of the sequence number of the above-mentioned processes does not mean the order of execution, and the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application. The above-mentioned sequence numbers of the embodiments of the present application are only for description and do not represent the advantages and disadvantages of the embodiments.
[0280] It should be noted that, in this article, the terms "include", "comprises" or any other variations 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, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0281] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.
[0282] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units; they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0283] In addition, all functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may be a separate unit, or two or more units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0284] A person of ordinary skill in the art can understand that: all or part of the steps of implementing the above-mentioned method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above-mentioned method embodiment; and the aforementioned storage medium includes: mobile storage devices, read-only memories (ROM, Read Only Memory), disks or optical disks, etc. Various media that can store program codes.
[0285] Alternatively, if the above-mentioned integrated unit of the present application is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application can essentially or in other words, the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium and includes a number of instructions for a controller to execute all or part of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROMs, magnetic disks, or optical disks.
[0286] The above is only an implementation method of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A grid reconstruction method, characterized in that: include: Obtain at least two triangular mesh geological surfaces; A collision detection algorithm is used to determine the triangle pairs between any two triangular mesh geological surfaces; Using an intersection algorithm to determine the intersection point set and the boundary point set in the triangle pair; Determine a topologically ordered set of intersection lines based on the set of intersection points and the set of boundary points; The arbitrary two triangular mesh geological surfaces are meshed and reconstructed based on the intersection line set to obtain a reconstructed triangular mesh geological surface.
2. The method according to claim 1, characterized in that The arbitrary two triangular mesh geological surfaces include: a first surface and a second surface, and the use of a collision detection algorithm to determine the triangle pairs in the arbitrary two surfaces includes: constructing an average cell according to the first curved surface, wherein the average cell includes triangles of the first curved surface; Determine all average cells traversed by each triangle of the second surface; Determine whether the triangles in all average cells traversed by each triangle intersect with the corresponding triangles of the second surface; If the triangles in all the average cells traversed by each triangle intersect with the triangles corresponding to the second surface, the triangles in all the average cells and the triangles corresponding to the second surface are output as triangle pairs to obtain triangle pairs in any two surfaces.
3. The method according to claim 2, characterized in that The step of constructing an average cell according to the first curved surface comprises: Determine the bounding box of the first surface; dividing the bounding box into average cells; Based on the positions of the triangles of the first surface, each triangle in the first surface is assigned to each average cell.
4. The method according to claim 1, characterized in that The triangle pair includes: a first triangle and a second triangle, and the intersection point set and the boundary point set in the triangle pair are determined by using an intersection algorithm, including: Determine the intersection point between the first triangle and the second triangle based on an intersection algorithm, and input the intersection point into an intersection point set; Determine whether each intersection point is a boundary point. If the intersection point is a boundary point, enter it into the boundary point set.
5. The method according to claim 4, characterized in that The determining the intersection point between the first triangle and the second triangle based on an intersection algorithm comprises: Determine three sides of the first triangle; For any side of the first triangle, determine whether the any side has intersected with the second triangle, and if no intersection has been found, determine the intersection point of the any side with the second triangle; Determine a positional relationship between the intersection point and the second triangle, and determine a positional relationship between the intersection point and any one of the edges; In a case where the intersection point is not outside the second triangle, the intersection point is determined as an intersection point between the first triangle and the second triangle to obtain an intersection point between the first triangle and the second triangle.
6. The method according to claim 5, characterized in that The method further comprises: determining a number of intersections between the first triangle and the second triangle; When the number of intersection points between the first triangle and the second triangle exceeds 2, the intersection points are deleted to keep 2 intersection points.
7. The method according to claim 6, characterized in that The method further comprises: Determine whether there are multiple edges passing through a target intersection; When there are multiple edges passing through a target intersection, a target edge closest to the target intersection is selected to pass through the target intersection, and other edges among the multiple edges except the target edge are set not to pass through the target intersection.
8. The method according to claim 1, characterized in that The determining of a topologically ordered set of intersection lines based on the set of intersection points and the set of boundary points includes: sorting the intersection point set and the boundary point set based on geometric information between each intersection point; Generate a non-closed curve based on the sorted set of boundary points; Remove the boundary points in the intersection point set to obtain the remaining intersection points; Generate closed curves from the remaining intersection points to obtain a topologically ordered set of intersection lines.
9. The method according to claim 1, characterized in that: The step of reconstructing the meshes of the two arbitrary triangular mesh geological surfaces based on the intersection line set to obtain a reconstructed triangular mesh geological surface comprises: The triangulation method of maximizing the minimum internal angle is adopted to reconstruct the meshes of the arbitrary two triangular mesh geological surfaces based on the intersection line set.
10. The method according to claim 1, characterized in that The method further comprises: Merge the intersection points of any two reconstructed triangular mesh geological surfaces whose distance from the intersection line is less than the distance threshold. When merging, the common points of multiple intersection lines cannot be moved, and the edges with intersection lines cannot be deleted. The diagonals of two adjacent triangles whose normal vector angles in any two reconstructed triangular geological surfaces are less than an angle threshold are exchanged.
11. A grid reconstruction device, characterized in that: include: An acquisition module, used for acquiring at least two triangular mesh geological surfaces; The first determination module is used to determine triangle pairs in any two triangular mesh geological surfaces using a collision detection algorithm; A second determination module, configured to determine an intersection point set and a boundary point set in the triangle pair by using an intersection algorithm; A third determining module, configured to determine a topologically ordered set of intersection lines based on the set of intersection points and the set of boundary points; The reconstruction module is used to reconstruct the meshes of the two arbitrary triangular mesh geological surfaces based on the intersection line set to obtain a reconstructed triangular mesh geological surface.
12. An electronic device, characterized in that: The method comprises a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the grid reconstruction method according to any one of claims 1 to 10 is executed.
13. A storage medium, characterized in that: The computer program stored in the storage medium can be executed by one or more processors and can be used to implement the grid reconstruction method as described in any one of claims 1 to 10.
Citation Information
Cited By
CAD model curved surface interpenetration problem processing method and device, equipment and medium
CN120105511A
Three-dimensional modeling method and system based on discrete space grid surface closed body
CN120726265A