Curved surface grid generation method and device, equipment and medium
By mapping the target surface to the parameter plane and dispersed boundary division in the Delaunay algorithm, the problem of low accuracy in surface mesh generation is solved, and high-quality surface mesh generation is achieved to meet the Delaunay characteristics and accurate curvature expression.
Patent Information
- Application Number
- CN202411183315.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-27
- Publication Date
- 2024-11-29
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing Delaunay algorithm has low calculation accuracy when it comes to discrete surfaces, resulting in the surface characteristics of the surface mesh being unable to be accurately expressed, the curvature error is large, and the results are inaccurate.
By mapping the target surface in the three-dimensional space to the parameter plane, performing discrete boundary division, inserting the target point and determining whether it is located in the circumference of the primary triangle, deleting the corresponding triangle, generating the target triangle mesh, and mapping it back to the three-dimensional space .
The calculation accuracy of the Delaunay algorithm is improved, accurate surface mesh generation is achieved, curvature error is reduced, Delaunay characteristics are met, and the shape and size quality of the mesh triangle are improved.
Smart Images

Figure CN119048714A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer graphics processing, and in particular to a method, device, equipment and medium for generating a curved surface mesh. Background Art
[0002] The Delaunay algorithm is a traditional mesh discretization method, which was proposed by mathematician Boris Delaunay in 1934. It is a method for generating triangular meshes. Due to its stability and easy implementation, it is widely used in computer science, numerical computing and other fields.
[0003] Delaunay discretization methods are divided into direct method and parametric method. The direct method calculates the circumscribed ellipse of the surface in three-dimensional space; the parametric method establishes a mapping relationship between the surface and the parametric plane, generates a grid in the parametric plane, and then maps it back to three-dimensional space. It is not easy to check whether the circumscribed ellipse contains a point in three-dimensional space using the direct method, so the parametric method is generally used.
[0004] When discretizing surfaces, the existing parametric method only uses the Riemann metric at the insertion point to calculate the radius and center of the circumscribed circle of a triangle and determine whether the circumscribed circle contains the insertion point. When the curvature of the surface changes, the difference in the Riemann metric at different points on the surface will also increase. Using only the Riemann metric at the insertion point for calculation will result in low calculation accuracy of the Delaunay algorithm, the surface features of the discretized surface mesh cannot be accurately expressed, the curvature error is large, and the generated surface mesh cannot fully meet the Delaunay characteristics, resulting in inaccurate results. Summary of the invention
[0005] The present invention provides a surface mesh generation method, device, equipment and medium to solve the problems of low calculation accuracy of the Delaunay algorithm in the prior art when discretizing the surface, inability to accurately express the surface features of the discretized surface mesh, large curvature error and inaccurate results.
[0006] In order to solve the above technical problems, the technical solution adopted by the present invention is to provide a surface mesh generation method, comprising the steps of: S1, mapping a target surface in a three-dimensional space to a parameter plane, and obtaining the boundary of the target surface on the parameter plane; S2, discretely dividing the boundary to obtain a plurality of boundary points located on the boundary, connecting the plurality of boundary points respectively, and obtaining a primary triangular mesh located inside the boundary; wherein the primary triangular mesh includes a plurality of primary triangles; S3, inserting a target point into one of the primary triangles, combining the target point and the three vertices of each of the remaining primary triangles to be detected, and respectively calculating and judging the target point. Whether the punctuation point is located in the circumscribed circle corresponding to the primary triangle to be detected; S4, if the target point is located in the circumscribed circle corresponding to the primary triangle, the corresponding primary triangle is deleted, and the corresponding cavity area is obtained, and the target point is respectively connected to each vertex of the cavity area to generate multiple target triangles; S5, select the next primary triangle, and perform the same operations as S3 and S4 until all the primary triangles are traversed, and the corresponding multiple target triangles are generated to obtain the target triangle mesh located inside the boundary; S6, map the boundary and the target triangle mesh back to the three-dimensional space to obtain the target surface mesh.
[0007] In some embodiments, in the step of respectively calculating and judging whether the target point is located within the circumscribed circle corresponding to the primary triangle to be detected in combination with the target point and the remaining three vertices of each primary triangle to be detected, the calculation and judgment method includes the steps of: respectively calculating and obtaining the Riemannian metric at the target point and the three vertices of the primary triangle to be detected; respectively calculating and obtaining the center and radius of four different circumscribed circles of the primary triangle to be detected based on four different Riemannian metrics; if the distance from the center of each circumscribed circle to the target point is less than or equal to the radius of the circumscribed circle, it means that the target point is located within the circumscribed circle corresponding to the primary triangle.
[0008] In some embodiments, in the step of respectively calculating and judging whether the target point is located in the circumscribed circle corresponding to the primary triangle to be detected by combining the target point and the three vertices of the remaining primary triangles to be detected, the calculation and judgment method includes the steps of: respectively calculating and obtaining the Riemann metric at the target point and the three vertices of the primary triangle to be detected; arbitrarily selecting an internal point in the primary triangle, and connecting the three vertices of the primary triangle and the internal point to obtain three internal triangles; respectively calculating and obtaining the area ratios of the three internal triangles to the primary triangle, and calculating and obtaining the Riemann metric at the internal point based on the three area ratios and the Riemann metric at the three vertices of the primary triangle; respectively calculating and obtaining the center and radius of two different circumscribed circles of the primary triangle to be detected based on the Riemann metric at the internal point and the target point; if the distance from the center of each circumscribed circle to the target point is less than or equal to the radius of the circumscribed circle, it means that the target point is located in the circumscribed circle corresponding to the primary triangle.
[0009] In some embodiments, in the step of respectively calculating the center and radius of two different circumscribed circles of the primary triangle to be detected based on the Riemann metric at the internal point and the target point, the method for calculating the center and radius of the circumscribed circle includes the steps of: calculating the parametric coordinates of the center of the corresponding circumscribed circle using the Riemann metric at the internal point or the target point and the distance from the center of the corresponding circumscribed circle to the three vertices of the primary triangle; calculating the corresponding radius of the circumscribed circle based on the parametric coordinates of the center and the parametric coordinates of any vertex of the primary triangle.
[0010] In some embodiments, a point at the centroid of the primary triangle is selected as the internal point.
[0011] In some embodiments, in S4, the step of: if the target point is not within the circumscribed circle corresponding to the primary triangle, retaining the corresponding primary triangle.
[0012] In some embodiments, the target point needs to be inserted into the centroid of the corresponding primary triangle.
[0013] The present invention also provides a surface mesh generation device, comprising: a first mapping unit, used to map a target surface in a three-dimensional space onto a parameter plane, and obtain the boundary of the target surface on the parameter plane; a primary mesh generation unit, used to discretely divide the boundary to obtain a plurality of boundary points located on the boundary, and also used to connect the plurality of boundary points respectively to obtain a primary triangular mesh located inside the boundary; wherein the primary triangular mesh includes a plurality of primary triangles; an insertion unit, used to insert a target point into the primary triangle; a calculation and judgment unit, used to combine the target point and the remaining three vertices of each primary triangle to be detected, and respectively calculate and judge whether the target point is located within the circumscribed circle corresponding to the primary triangle to be detected; a target mesh generation unit, used to delete the corresponding primary triangles where the target point is located within the circumscribed circle, and obtain the corresponding cavity area, and also used to connect the target point with each vertex of the cavity area respectively to generate a plurality of target triangles; and also used to obtain a target triangular mesh located inside the boundary based on the plurality of target triangles; a second mapping unit, used to map the boundary and the target triangular mesh back to the three-dimensional space to obtain a target surface mesh.
[0014] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.
[0015] The present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above method are implemented.
[0016] The beneficial effects of the present invention are as follows: the present invention discloses a method, device, equipment and medium for generating a surface mesh, the method comprising the steps of: mapping a target surface onto a parameter plane and obtaining a boundary; performing discrete division on the boundary to obtain a plurality of boundary points, connecting them respectively, and obtaining a primary triangular mesh located inside the boundary; inserting a target point into one of the primary triangles, combining the target point and the three vertices of each remaining primary triangle to be detected, respectively calculating and judging whether the target point is located within the circumscribed circle corresponding to the primary triangle to be detected; if the target point is located within the circumscribed circle corresponding to the primary triangle, deleting the primary triangle and generating a plurality of target triangles; selecting the next primary triangle, and performing the same operation as the aforementioned part until all primary triangles are traversed to obtain a target triangular mesh located inside the boundary; mapping the target triangular mesh to obtain a target surface mesh. The present application combines the inserted target point and the three vertices of each primary triangle to be detected, and respectively calculates and determines whether the target point is located within the circumscribed circle corresponding to the primary triangle to be detected, so as to improve the calculation accuracy of the Delaunay algorithm; at the same time, without involving frequent calculation of the Riemann metric, the generation of accurate Delaunay surface mesh is achieved. The obtained target surface mesh can not only accurately express the surface characteristics of the target surface and reduce the curvature error, but also meet the Delaunay characteristics, and can improve the shape and size quality of the mesh triangles in the generated target surface mesh. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 It is a flow chart of an embodiment of a method for generating a curved mesh in the present application;
[0018] Figure 2 It is a schematic diagram of a target surface in three-dimensional space in an embodiment of a surface mesh generation method of the present application;
[0019] Figure 3 It is a schematic diagram of a boundary in a parameter plane in an embodiment of a method for generating a curved surface mesh of the present application;
[0020] Figure 4 It is a schematic diagram of a primary triangular mesh in a parameter plane in an embodiment of a surface mesh generation method of the present application;
[0021] Figure 5 This is a schematic diagram of inserting a target point in an embodiment of a method for generating a curved mesh in the present application;
[0022] Figure 6 This is a schematic diagram of deleting primary triangles in an embodiment of a surface mesh generation method of the present application;
[0023] Figure 7This is a schematic diagram of calculating and determining target points in an embodiment of a surface mesh generation method of the present application;
[0024] Figure 8 is a schematic diagram of a surface mesh obtained by the prior art;
[0025] Fig. 9 is a schematic diagram of a surface mesh obtained by a surface mesh generation method of the present application;
[0026] Fig.10 is a schematic diagram of a target surface mesh in an embodiment of a surface mesh generation method of the present application;
[0027] Fig.11 It is a structural block diagram of an embodiment of a curved surface mesh generation device of the present application;
[0028] Fig.12 It is a schematic diagram of the structure of an electronic device according to an embodiment of the present application;
[0029] Fig.13 It is a schematic block diagram of an embodiment of a computer-readable storage medium of the present application. DETAILED DESCRIPTION
[0030] In order to facilitate the understanding of the present invention, the present invention is described in more detail below in conjunction with the accompanying drawings and specific embodiments. Preferred embodiments of the present invention are provided in the accompanying drawings. However, the present invention can be implemented in many different forms and is not limited to the embodiments described in this specification. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present invention more thorough and comprehensive.
[0031] It should be noted that, unless otherwise defined, all technical and scientific terms used in this specification have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used in the specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The term "and / or" used in this specification includes any and all combinations of one or more related listed items.
[0032] The Delaunay algorithm is an algorithm used in computational geometry to triangulate a two-dimensional plane point set. The triangulation it generates largely avoids the appearance of narrow triangles. This algorithm is widely used in graphics, material calculation, finite element structural analysis, earth information systems and other fields. The core idea of Delaunay triangulation is to construct a triangulated network so that the circumscribed circle of each triangle in the triangulated network does not contain any other points in the point set, thereby ensuring the excellence of the triangulation.
[0033] In general, the Delaunay algorithm is an important computational geometry algorithm that provides a solid foundation for many computational geometry applications by constructing excellent triangulations.
[0034] This application is a further improvement based on the above Delaunay algorithm.
[0035] Figure 1 The following is a flow chart of the method for generating a curved mesh according to the present invention, including the following steps:
[0036] S1: Map the target surface in the three-dimensional space to the parameter plane, and obtain the boundary of the target surface on the parameter plane.
[0037] S2: Discretely divide the boundary to obtain a plurality of boundary points on the boundary, and connect the plurality of boundary points respectively to obtain a primary triangular mesh located inside the boundary; wherein the primary triangular mesh includes a plurality of primary triangles.
[0038] S3: inserting a target point into one of the primary triangles, combining the target point and the three vertices of each remaining primary triangle to be detected, respectively calculating and determining whether the target point is located within the circumscribed circle corresponding to the primary triangle to be detected.
[0039] S4: If the target point is located within the circumscribed circle corresponding to the primary triangle, the corresponding primary triangle is deleted, and a corresponding cavity area is obtained. The target point is connected to each vertex of the cavity area to generate multiple target triangles.
[0040] S5: Select the next primary triangle and perform the same operations as S3 and S4 until all primary triangles are traversed and multiple corresponding target triangles are generated to obtain a target triangle mesh located inside the boundary.
[0041] S6: Map the boundary and target triangle meshes back to the three-dimensional space to obtain the target surface mesh.
[0042] The present application combines the inserted target point and the three vertices of each primary triangle to be detected, and respectively calculates and determines whether the target point is located within the circumscribed circle corresponding to the primary triangle to be detected, so as to improve the calculation accuracy of the Delaunay algorithm; at the same time, without involving frequent calculation of the Riemann metric, the generation of accurate Delaunay surface mesh is achieved. The obtained target surface mesh can not only accurately express the surface characteristics of the target surface and reduce the curvature error, but also meet the Delaunay characteristics, and can improve the shape and size quality of the mesh triangles in the generated target surface mesh.
[0043] Combine the following Figures 1 to 13, this application is described in detail with specific embodiments.
[0044] like Figure 1 As shown, the surface mesh generation method of the present application includes the steps of:
[0045] S1: Map the target surface in the three-dimensional space to the parameter plane, and obtain the boundary of the target surface on the parameter plane.
[0046] First, the desired target surface should be obtained. In this embodiment, Figure 2 Taking the target surface 1 shown in the figure as an example, the acquisition method includes: according to the required surface shape, a set of control points (a total of six: Point1, Point2, Point3, Point4, Point5, Point6) are set, and the coordinates of Point1-6 are {(0,0,0), (5,3,0), (3.75,1.5,0), (2.5,7,0), (2.5,5,0), (2.5,1.5,0)}, and then a spline curve is generated using the six control points, and the spline curve is stretched along the Z axis by three units to obtain the following. Figure 2 The target surface 1 is shown.
[0047] Among them, spline curves refer to a curve obtained by giving a set of control points. The general shape of the curve is controlled by these points. It can be generally divided into interpolation splines and approximation splines. Interpolation splines are usually used in digital drawing or animation design, and approximation splines are generally used to construct the surface of an object.
[0048] Furthermore, a mapping relationship between the target surface and the parameter plane (i.e., a two-dimensional plane) is established, that is, a point on the target surface corresponds to a point on the parameter plane, and a point on the parameter plane also uniquely corresponds to a point on the target surface. The obtained target surface is mapped to the parameter plane according to the mapping relationship, and its boundary on the parameter plane is obtained.
[0049] In this embodiment, Figure 2 , Figure 3 For example, Figure 3 That is Figure 2 The target surface 1 is mapped to the parameter plane 2, and its boundary 3 is rectangular in shape as a whole.
[0050] S2: Discretely divide the boundary to obtain a plurality of boundary points on the boundary, and connect the plurality of boundary points respectively to obtain a primary triangular mesh located inside the boundary; wherein the primary triangular mesh includes a plurality of primary triangles.
[0051] In this embodiment, Figure 3 Take the boundary 3 as an example. Figure 3The boundary 3 in the parameter plane 2 is discretized, and the division is as follows Figure 4 As shown, the boundary 3 is discretized into a plurality of line segments, each of which is connected end to end in sequence, and the endpoint of each line segment is a boundary point 31 .
[0052] Further, combined with Figure 4 , connect the multiple boundary points 31 according to the rules of the Delaunay algorithm, and obtain the primary triangular mesh 4 located inside the boundary 3. The primary triangular mesh 4 includes multiple primary triangles 41. At this time, the primary triangles 41 have rough shapes (such as too sharp angles or too large sizes, etc.), and cannot express Figure 2 The characteristics of target surface 1 in do not meet the requirements, so further refinement is required.
[0053] S3: inserting a target point into one of the primary triangles, combining the target point and the three vertices of each remaining primary triangle to be detected, respectively calculating and determining whether the target point is located within the circumscribed circle corresponding to the primary triangle to be detected.
[0054] Combination Figure 4 , Figure 5 , Figure 7 As shown, a target point is inserted into one of the primary triangles 41 in the primary triangle mesh 4 .
[0055] In this embodiment, it is preferred to insert the target point at the centroid of the primary triangle 41; the centroid of a triangle (also called the center of gravity or centroid) is the intersection of the three medians of the triangle and is its balance point. The centroid, as a fixed point inside the triangle, provides an inherent symmetry for the triangle; therefore, inserting the target point at the centroid of the primary triangle is conducive to simplifying subsequent calculation steps, saving calculation time and improving efficiency.
[0056] Furthermore, the target point and the three vertices of each remaining primary triangle 41 to be detected are combined to respectively calculate and determine whether the target point is located within the circumscribed circle corresponding to the primary triangle 41 to be detected.
[0057] As a first embodiment of the present application, the calculation and judgment method includes the following steps:
[0058] The Riemannian metric at the target point and the three vertices of the primary triangle 41 to be detected is calculated respectively. The Riemannian metric is a length measurement relationship between the target surface and the parameter plane, which is used to measure the characteristics of a point on the target surface on its parameter plane. In this application, the Riemannian metric can be calculated by the following formula:
[0059]
[0060] Where Γ is the curve on the surface corresponding to the line AB on the parameter plane, L(Γ) represents the length of the corresponding curve on the target surface, AB is the vector corresponding to the line AB on the parameter plane, the line AB is represented by the parameter method, t is the parameter, and the value range is [0, 1], A represents the starting point of the line AB, M represents the Riemann metric, AB T Represents the transposed matrix of AB.
[0061] Furthermore, according to the four different Riemann metrics obtained by calculation, the centers and radii of four different circumscribed circles of the primary triangle 41 to be detected are respectively calculated and obtained.
[0062] If the distance from the center of each circumscribed circle to the target point is less than or equal to the radius of the circumscribed circle, it means that the target point is located in the circumscribed circle corresponding to the detected primary triangle 41 .
[0063] Specific, combined Figure 5 and Figure 7 As shown, assuming that the target point P is inserted at the centroid of the primary triangle DEF, and the primary triangle DEH (adjacent to the primary triangle DEF) is selected as the primary triangle 41 to be detected, whether the target point P is located in the circumscribed circle corresponding to the primary triangle DEH to be detected can be determined by the following method:
[0064]
[0065] Among them, M1 represents the Riemann metric at the vertex D of the primary triangle DEH, M2 represents the Riemann metric at the vertex E of the primary triangle DEH, M3 represents the Riemann metric at the vertex H of the primary triangle DEH, and M P Represents the Riemann metric at the target point P; Represents the Riemannian metric M1, M2, M3, M P The calculated centers of the four different circumscribed circles of the primary triangle DEH; Represents the Riemannian metric M1, M2, M3, M P The radii of the four different circumscribed circles of the calculated primary triangle DEH; Represents the center of the circle The distance from the target point P.
[0066] When the target point P is located within the circumscribed circle corresponding to the detected primary triangle DEH, the following relationship must be satisfied:
[0067]
[0068] When the above four relations are established at the same time, that is, the center of each circumscribed circle The distance to the target point P is less than or equal to the radius of the circumscribed circle. The representative target point P is located in the circumscribed circle corresponding to the detected primary triangle DEH. The above four relationship expressions are used together to effectively improve the calculation accuracy of the Delaunay algorithm.
[0069] As a second embodiment of the present application, the calculation and judgment method may further include the following steps:
[0070] The Riemannian metrics at the target point and the three vertices of the primary triangle 41 to be detected are calculated respectively. Figure 5 and Figure 7 For example, a target point P is inserted at the centroid of the primary triangle DEF, and the primary triangle DEH is selected as the primary triangle to be detected 41. The specific calculation method of the Riemannian metric can refer to the first embodiment above, which will not be repeated here.
[0071] Furthermore, an internal point within the primary triangle DEH to be detected is arbitrarily selected. In this embodiment, a point Q at the centroid of the primary triangle DEH to be detected is preferentially selected as the internal point; the three vertices (D, E, H) of the primary triangle DEH are connected to the internal point Q respectively to obtain three internal triangles, namely, the internal triangle DQH, the internal triangle DQE and the internal triangle EQH.
[0072] Furthermore, the area ratios of the three internal triangles (DQH, DQE and EQH) and the primary triangle DEH to be detected are calculated and obtained respectively, which can be expressed by the following formula:
[0073]
[0074] Among them, S ΔDEH represents the area of the primary triangle DEH, S ΔDQH represents the area of the inner triangle DQH, S ΔDQE represents the area of the inner triangle DQE, S ΔEQH represents the area of the internal triangle EQH, L1 represents the area ratio of the internal triangle DQH to the primary triangle DEH, L2 represents the area ratio of the internal triangle DQE to the primary triangle DEH, and L3 represents the area ratio of the internal triangle EQH to the primary triangle DEH.
[0075] According to the three area ratios (L1, L2, L3) and the Riemann metrics (M1, M2, M3) at the three vertices (D, E, H) of the primary triangle DEH, the Riemann metric at the internal point Q is calculated, which is specifically expressed by the following formula:
[0076] MQ =L1*M1+L2*M2+L3*M3,
[0077] Among them, M Q represents the Riemann metric at the interior point Q.
[0078] Furthermore, according to the Riemannian metric at the internal point Q and the target point P, the centers and radii of two different circumscribed circles of the primary triangle DEH to be detected are respectively calculated.
[0079] Specifically, the method for calculating the center and radius of the circumscribed circle includes the steps of:
[0080] Using the Riemann metric at the internal point Q or the target point P and the distance from the center of the corresponding circumscribed circle to the three vertices (D, E, H) of the primary triangle DEH, the parametric coordinates of the center of the corresponding circumscribed circle are calculated. It can be expressed by the following formula:
[0081]
[0082] in, Represents the Riemann metric M P 、M Q The parametric coordinates of the centers of the two different circumscribed circles of the primary triangle DEH can be expressed as Represents the center of the circle The distance to the vertex D of the primary triangle DEH, Represents the center of the circle The distance to the vertex E of the primary triangle DEH, Represents the center of the circle The distance to the vertex H of the primary triangle DEH; Represents the center of the circle The distance to the vertex D of the primary triangle DEH, Represents the center of the circle The distance to the vertex E of the primary triangle DEH, Represents the center of the circle Distance to vertex H of primary triangle DEH.
[0083] It should be noted that the above formula is based on the principle that the distances from the center of the circumcircle of a triangle to the three vertices of the triangle are equal. By solving each set of equations separately, we can get the center points of the two different circumcircles of the primary triangle DEH. The parameter coordinates of .
[0084] According to the center The parametric coordinates of the circle center are calculated by taking the parametric coordinates of any vertex of the primary triangle DEH and The distance to any vertex can be used to obtain the radius of the corresponding circumscribed circle.
[0085] Furthermore, if the distance from the center of each circumscribed circle to the target point P is less than or equal to the radius of the circumscribed circle, it means that the target point P is located in the circumscribed circle corresponding to the primary triangle DEH, which is expressed by the following formula:
[0086]
[0087] in, Represents the Riemann metric M Q 、M P The radii of the two different circumscribed circles of the calculated primary triangle DEH are: Represents the center of the circle The distance from the target point P.
[0088] Compared with the first embodiment mentioned above, the second embodiment of the present application requires less calculation, but the two embodiments have the same effect, and both can effectively improve the calculation accuracy of the Delaunay algorithm, so that the result of judging whether the target point is located within the circumscribed circle corresponding to the primary triangle 41 to be detected is more accurate.
[0089] S4: If the target point is located within the circumscribed circle corresponding to the primary triangle, the corresponding primary triangle is deleted, and a corresponding cavity area is obtained. The target point is connected to each vertex of the cavity area to generate multiple target triangles.
[0090] Specifically, Figure 5 For example, if the target point P is located in the circumscribed circle corresponding to the detected primary triangle DEH and the primary triangle DFG, it means that the Delaunay areas of the primary triangle DEF where the target point P is located, the detected primary triangle DEH and the primary triangle DFG are all broken by the inserted target point P. Then the primary triangle DEF, the primary triangle DEH and the primary triangle DFG should be deleted, so as to obtain the following: Figure 6 The cavity area DGFEH is shown.
[0091] Then, the target point P is connected to each vertex (D, G, F, E, H) of the cavity area DGFEH to generate multiple target triangles 5 (i.e., target triangle DPG, target triangle GPF, target triangle FPE, target triangle EPH, and target triangle HPD). The newly generated multiple target triangles 5 all satisfy the Delaunay characteristics (i.e., there are no narrow triangles, the triangles are of appropriate size, etc.).
[0092] Furthermore, if the target point P is not within the circumscribed circle corresponding to the detected primary triangle DEH, the corresponding primary triangle DEH is retained and not deleted.
[0093] S5: Select the next primary triangle and perform the same operations as S3 and S4 until all primary triangles are traversed and multiple corresponding target triangles are generated to obtain a target triangle mesh located inside the boundary.
[0094] Specific, combined Figure 4 , Figure 5 In the primary triangular mesh 4, except for the primary triangle DEF where the target point P is located, when all the remaining primary triangles 41 are detected and processed, it is necessary to further select a new primary triangle 41 (non-primary triangle DEF), insert the new target point inside it, and repeat the same operations as S3 and S4 above.
[0095] When all the primary triangles 41 in the primary triangle mesh 4 are traversed (ie, different target points are inserted into each primary triangle 41 and processed), a plurality of target triangles 5 that meet the requirements are generated, and finally a target triangle mesh located inside the boundary 3 is obtained.
[0096] S6: Map the boundary and target triangle meshes back to the three-dimensional space to obtain the target surface mesh.
[0097] Specifically, after mapping the boundary and target triangle meshes back to the three-dimensional space according to the mapping relationship, we get Fig.10 The target surface mesh 6 shown. The newly generated target surface mesh 6 meets Figure 2 The curvature characteristics of the original target surface 1 are obtained, and each mesh triangle 61 therein has excellent quality (such as beautiful shape, moderate size, maximized minimum angle, etc.).
[0098] In summary, combined Figure 8 , Fig. 9 As shown, Figure 8 To use the surface mesh obtained by existing technology, Figure 2 The target surface 1 shown in the figure clearly shows that Figure 8 The two triangles in the red part are sunken inward to form a sunken area 7, which violates Figure 2 The curvature characteristics of target surface 1 do not meet the requirements. Fig. 9 The target surface mesh obtained by using the method of the present application, wherein the two triangles in the red part protrude outward to form a protruding area 8, which conforms to Figure 2 The curvature characteristics of the target surface 1 are achieved; and the shape and size of each triangle therein are also of excellent quality.
[0099] Using the method provided in the present application, even if the curvature of the target surface 1 changes greatly, such as the target surface 1 has many inflection points and large corners, an excellent quality target surface mesh can be finally obtained, effectively reducing the curvature error.
[0100] Based on the same inventive concept, Fig.11 As shown, the present application also provides a surface mesh generation device, the device comprising:
[0101] The first mapping unit 101 is used to map a target surface in a three-dimensional space to a parameter plane, and obtain a boundary of the target surface on the parameter plane.
[0102] The primary mesh generation unit 102 is used to discretely divide the boundary to obtain a plurality of boundary points on the boundary, and is also used to connect the plurality of boundary points respectively to obtain a primary triangular mesh located inside the boundary; wherein the primary triangular mesh includes a plurality of primary triangles.
[0103] The insertion unit 103 is used to insert the target point in the primary triangle.
[0104] The calculation and judgment unit 104 is used to combine the target point and the three vertices of each remaining primary triangle to be detected, and respectively calculate and judge whether the target point is located in the circumscribed circle corresponding to the primary triangle to be detected.
[0105] The target mesh generation unit 105 is used to delete the corresponding primary triangles of the target point within the circumscribed circle and obtain the corresponding cavity area. It is also used to connect the target point with each vertex of the cavity area to generate multiple target triangles; it is also used to obtain the target triangle mesh located inside the boundary based on the multiple target triangles.
[0106] The second mapping unit 106 is used to map the boundary and the target triangle mesh back to the three-dimensional space to obtain the target surface mesh.
[0107] The other technical features of the surface mesh generation device are the same as those disclosed in the above-mentioned embodiment method. Please refer to the description in the above-mentioned corresponding method embodiments and will not be repeated here.
[0108] Based on the same inventive concept, the present application also provides an electronic device, which includes a processor, a memory and a communication circuit, and the processor is connected to the memory and the communication circuit respectively; wherein the communication circuit is used for communication connection, the memory is used to store a computer program, and the processor is used to execute the computer program to implement the above-mentioned surface mesh generation method.
[0109] See also Fig.12The electronic device described in the embodiment of the present application may specifically include a processor 210 and a memory 220. The memory 220 is coupled to the processor 210.
[0110] The processor 210 is used to control the operation of the electronic device. The processor 210 may also be referred to as a CPU (Central Processing Unit). The processor 210 may be an integrated circuit chip having the ability to process signals. The processor 210 may also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. A general-purpose processor may be a microprocessor or the processor 210 may also be any conventional processor, etc.
[0111] The memory 220 is used to store computer programs, and may be a RAM, a ROM, or other types of storage terminals. Specifically, the memory 220 may include one or more computer-readable storage media, which may be non-transitory or transient. The memory 220 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage terminals, flash memory storage terminals. In some embodiments, the non-transitory computer-readable storage medium in the memory 220 is used to store at least one program code.
[0112] The processor 210 is used to execute the computer program stored in the memory 220 to implement the methods described in the various method embodiments of the present application.
[0113] In some embodiments, the electronic device may further include: a peripheral terminal interface 230 and at least one peripheral terminal. The processor 210, the memory 220 and the peripheral terminal interface 230 may be connected via a bus or a signal line. Each peripheral terminal may be connected to the peripheral terminal interface 230 via a bus, a signal line or a circuit board. Specifically, the peripheral terminal includes: at least one of a radio frequency circuit 240, a display screen 250, an audio circuit 260 and a power supply 270.
[0114] The peripheral terminal interface 230 may be used to connect at least one peripheral terminal related to I / O (Input / output) to the processor 210 and the memory 220. In some embodiments, the processor 210, the memory 220, and the peripheral terminal interface 230 are integrated on the same chip or circuit board; in some other implementations, any one or two of the processor 210, the memory 220, and the peripheral terminal interface 230 may be implemented on a separate chip or circuit board, which is not limited in this embodiment.
[0115] The radio frequency circuit 240 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The radio frequency circuit 240 communicates with the communication network and other IoT devices through electromagnetic signals, and the radio frequency circuit 240 is the communication circuit of the electronic device. The radio frequency circuit 240 converts the electrical signal into an electromagnetic signal for transmission, or converts the received electromagnetic signal into an electrical signal. Optionally, the radio frequency circuit 240 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, an operator identity module card, and the like. The radio frequency circuit 240 can communicate with other terminals through at least one wireless communication protocol. The wireless communication protocol includes, but is not limited to: the World Wide Web, a metropolitan area network, an intranet, various generations of mobile communication networks (2G, 3G, 4G and 5G), a wireless local area network and / or a WiFi (Wireless Fidelity) network. In some embodiments, the radio frequency circuit 240 may also include circuits related to NFC (Near Field Communication), which is not limited in this application.
[0116] The display screen 250 is used to display the UI (User Interface). The UI may include graphics, text, icons, videos, and any combination thereof. When the display screen 250 is a touch display screen, the display screen 250 also has the ability to collect touch signals on the surface or above the surface of the display screen 250. The touch signal can be input to the processor 210 as a control signal for processing. At this time, the display screen 250 can also be used to provide virtual buttons and / or virtual keyboards, also known as soft buttons and / or soft keyboards. In some embodiments, the display screen 250 can be one, set on the front panel of the electronic device; in other embodiments, the display screen 250 can be at least two, respectively set on different surfaces of the electronic device or in a folding design; in other embodiments, the display screen 250 can be a flexible display screen, set on a curved surface or a folding surface of the electronic device. Even, the display screen 250 can also be set to a non-rectangular irregular shape, that is, a special-shaped screen. The display screen 250 can be made of materials such as LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode, organic light-emitting diode).
[0117] The audio circuit 260 may include a microphone and a speaker. The microphone is used to collect sound waves from the operator and the environment, and convert the sound waves into electrical signals and input them into the processor 210 for processing, or input them into the radio frequency circuit 240 to achieve voice communication. For the purpose of stereo acquisition or noise reduction, there may be multiple microphones, which are respectively arranged in different parts of the electronic device. The microphone may also be an array microphone or an omnidirectional acquisition microphone. The speaker is used to convert the electrical signal from the processor 210 or the radio frequency circuit 240 into sound waves. The speaker may be a traditional film speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can not only convert the electrical signal into sound waves audible to humans, but also convert the electrical signal into sound waves inaudible to humans for purposes such as ranging. In some embodiments, the audio circuit 260 may also include a headphone jack.
[0118] The power supply 270 is used to power various components in the electronic device. The power supply 270 can be an alternating current, a direct current, a disposable battery, or a rechargeable battery. When the power supply 270 includes a rechargeable battery, the rechargeable battery can be a wired rechargeable battery or a wireless rechargeable battery. A wired rechargeable battery is a battery that is charged through a wired line, and a wireless rechargeable battery is a battery that is charged through a wireless coil. The rechargeable battery can also be used to support fast charging technology.
[0119] For a detailed description of the functions and execution processes of each functional module or component in the electronic device embodiment of the present application, reference can be made to the description in the above-mentioned method embodiments of the present application, which will not be repeated here.
[0120] In the several embodiments provided in the present application, it should be understood that the disclosed electronic devices and methods can be implemented in other ways. For example, the various embodiments of the electronic devices described above are only schematic. For example, the division of modules or 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 integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0121] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, 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.
[0122] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0123] Based on the same inventive concept, the present application also provides a computer-readable storage medium storing a computer program, which can be executed by a processor to implement the above-mentioned surface mesh generation method.
[0124] See also Fig.13 , if the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium 300. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including several instructions / computer programs to enable an IoT device (which can be a personal computer, server, or network terminal, etc.) or a processor (processor) to perform all or part of the steps of each implementation method of the present application. The aforementioned storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks or optical disks, and electronic terminals such as computers, mobile phones, laptops, tablet computers, cameras, etc. having the above-mentioned storage media.
[0125] The description of the execution process of the program data in the computer-readable storage medium can refer to the description in the above-mentioned method embodiments of the present application, and will not be repeated here.
[0126] It can be seen that the present invention discloses a surface mesh generation method, device, equipment and medium, the method comprising the following steps: a first step, mapping a target surface in a three-dimensional space to a parameter plane, and obtaining the boundary of the target surface on the parameter plane; a second step, discretely dividing the boundary to obtain a plurality of boundary points on the boundary, connecting the plurality of boundary points respectively, and obtaining a primary triangular mesh located inside the boundary; wherein the primary triangular mesh comprises a plurality of primary triangles; a third step, inserting a target point into one of the primary triangles, combining the target point and the three vertices of each remaining primary triangle to be detected, and respectively calculating and judging the target point. Whether the punctuation point is located in the circumscribed circle corresponding to the primary triangle to be detected; the fourth step, if the target point is located in the circumscribed circle corresponding to the primary triangle, the corresponding primary triangle is deleted, and the corresponding cavity area is obtained, and the target point is connected to each vertex of the cavity area respectively to generate multiple target triangles; the fifth step, select the next primary triangle, and perform the same operations as the third and fourth steps until all primary triangles are traversed, and multiple corresponding target triangles are generated to obtain the target triangle mesh located inside the boundary; the sixth step, map the boundary and the target triangle mesh back to the three-dimensional space to obtain the target surface mesh. The device comprises: a first mapping unit, used for mapping a target surface in a three-dimensional space onto a parameter plane, and obtaining a boundary of the target surface on the parameter plane; a primary mesh generation unit, used for discretely dividing the boundary to obtain a plurality of boundary points on the boundary, and also used for connecting the plurality of boundary points respectively to obtain a primary triangular mesh located inside the boundary; wherein the primary triangular mesh comprises a plurality of primary triangles; an insertion unit, used for inserting a target point into a primary triangle; a calculation and judgment unit, used for combining the target point and the three vertices of each remaining primary triangle to be detected, and respectively calculating and judging whether the target point is located within the circumscribed circle corresponding to the primary triangle to be detected; a target mesh generation unit, used for deleting the corresponding primary triangles where the target point is located within the circumscribed circle, and obtaining a corresponding cavity area, and also used for connecting the target point with each vertex of the cavity area respectively to generate a plurality of target triangles; and also used for obtaining a target triangular mesh located inside the boundary based on the plurality of target triangles; a second mapping unit, used for mapping the boundary and the target triangular mesh back to the three-dimensional space, and obtaining a target surface mesh.The present application combines the inserted target point and the three vertices of each primary triangle to be detected, and respectively calculates and determines whether the target point is located within the circumscribed circle corresponding to the primary triangle to be detected, so as to improve the calculation accuracy of the Delaunay algorithm; at the same time, without involving frequent calculation of the Riemann metric, the generation of accurate Delaunay surface mesh is achieved. The obtained target surface mesh can not only accurately express the surface characteristics of the target surface and reduce the curvature error, but also meet the Delaunay characteristics, and can improve the shape and size quality of the mesh triangles in the generated target surface mesh.
[0127] The above are only embodiments of the present invention, and are not intended to limit the protection scope of the present invention. Any equivalent structural transformations made using the contents of the present invention description and drawings, or directly or indirectly applied in other related technical fields, are included in the protection scope of the present invention.
Claims
1. A surface mesh generation method, It is characterized in that Includes steps: S1, mapping a target surface in a three-dimensional space to a parameter plane, and obtaining a boundary of the target surface on the parameter plane; S2, discretely dividing the boundary to obtain a plurality of boundary points located on the boundary, and connecting the plurality of boundary points respectively to obtain a primary triangular mesh located inside the boundary; wherein the primary triangular mesh includes a plurality of primary triangles; S3, inserting a target point into one of the primary triangles, combining the target point and the three vertices of each of the remaining primary triangles to be detected, respectively calculating and determining whether the target point is located within the circumscribed circle corresponding to the primary triangle to be detected; S4, if the target point is located within the circumscribed circle corresponding to the primary triangle, the corresponding primary triangle is deleted, and a corresponding cavity area is obtained, and the target point is respectively connected to each vertex of the cavity area to generate multiple target triangles; S5, selecting the next primary triangle, and performing the same operations as S3 and S4, until all the primary triangles are traversed, and a corresponding plurality of target triangles are generated, to obtain a target triangle mesh located inside the boundary; S6, mapping the boundary and the target triangular mesh back to the three-dimensional space to obtain a target curved surface mesh.
2. The method for generating a curved mesh according to claim 1, It is characterized in that In the step of respectively calculating and judging whether the target point is located within the circumscribed circle corresponding to the primary triangle to be detected by combining the target point and the remaining three vertices of each of the primary triangles to be detected, the calculation and judgment method includes the steps of: Respectively calculating and obtaining the Riemannian metrics at the target point and at three vertices of the primary triangle to be detected; According to the four different Riemann metrics, respectively calculate and obtain the centers and radii of four different circumscribed circles of the primary triangle to be detected; If the distance from the center of each circumscribed circle to the target point is less than or equal to the radius of the circumscribed circle, it means that the target point is located in the circumscribed circle corresponding to the primary triangle.
3. The method for generating a curved mesh according to claim 1, It is characterized in that In the step of respectively calculating and judging whether the target point is located within the circumscribed circle corresponding to the primary triangle to be detected by combining the target point and the remaining three vertices of each of the primary triangles to be detected, the calculation and judgment method includes the steps of: Respectively calculating and obtaining the Riemannian metrics at the target point and at three vertices of the primary triangle to be detected; Randomly select an internal point in the primary triangle, and connect three vertices of the primary triangle to the internal point to obtain three internal triangles; The area ratios of the three internal triangles to the primary triangle are calculated respectively, and the Riemann metric at the internal point is calculated according to the three area ratios and the Riemann metric at the three vertices of the primary triangle; According to the Riemannian metric at the internal point and the target point, respectively calculate and obtain the center and radius of two different circumscribed circles of the primary triangle to be detected; If the distance from the center of each circumscribed circle to the target point is less than or equal to the radius of the circumscribed circle, it means that the target point is located in the circumscribed circle corresponding to the primary triangle.
4. The method for generating a curved mesh according to claim 3, It is characterized in that In the step of respectively calculating the center and radius of two different circumscribed circles of the primary triangle to be detected according to the Riemannian metric at the internal point and the target point, the method for calculating the center and radius of the circumscribed circle comprises the steps of: Utilizing the Riemann metric at the internal point or the target point and the distances from the center of the corresponding circumscribed circle to the three vertices of the primary triangle, the parametric coordinates of the center of the corresponding circumscribed circle are calculated; The radius of the corresponding circumscribed circle is calculated based on the parametric coordinates of the center of the circle and the parametric coordinates of any vertex of the primary triangle.
5. The method for generating a curved mesh according to claim 3, It is characterized in that A point at the centroid of the primary triangle is selected as the internal point.
6. The method for generating a curved mesh according to claim 1, It is characterized in that In said S4, the steps are also included: If the target point is not within the circumscribed circle corresponding to the primary triangle, the corresponding primary triangle is retained.
7. The method for generating a curved mesh according to claim 1, It is characterized in that The target point needs to be inserted into the centroid of the corresponding primary triangle.
8. A curved surface mesh generation device, It is characterized in that include: A first mapping unit, used to map a target curved surface in a three-dimensional space to a parameter plane, and obtain a boundary of the target curved surface on the parameter plane; A primary mesh generation unit, used for discretely dividing the boundary to obtain a plurality of boundary points located on the boundary, and for connecting the plurality of boundary points respectively to obtain a primary triangular mesh located inside the boundary; wherein the primary triangular mesh includes a plurality of primary triangles; an insertion unit, configured to insert a target point into the primary triangle; A calculation and judgment unit, used to combine the target point and the three vertices of each of the remaining primary triangles to be detected, and respectively calculate and judge whether the target point is located within the circumscribed circle corresponding to the primary triangle to be detected; A target mesh generation unit is used to delete the corresponding primary triangles of the target point located within the circumscribed circle and obtain a corresponding cavity area, and is also used to connect the target point with each vertex of the cavity area to generate a plurality of target triangles; and is also used to obtain a target triangle mesh located inside the boundary based on the plurality of target triangles; The second mapping unit is used to map the boundary and the target triangular mesh back to the three-dimensional space to obtain a target curved surface mesh.
9. An electronic device, It is characterized in that The method comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium storing a computer program. It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Delaunay triangulation grid refinement method suitable for GPU, GPU and system
CN109949420A
Region decomposition-based three-dimensional model automatic registration method and device
CN117011128A
Plane constraint triangular mesh generation method and system
CN118097062A
Curved surface mesh generation method and device, electronic equipment and storage medium
CN118364641A
Mesh generation
US20230316654A1
Cited By
Processing method and device for grid holes of circuit board model, and storage medium
CN121580923A
