Grid cutting method and device, computer equipment and storage medium
By obtaining and splicing target crop line segments, combining the positional relationship of the closed figure, dividing the set of molecules to obtain the crop boundary information, and cutting the grid, solving the problem of low grid cutting accuracy in the existing technology, realizing the More efficient and accurate grid cutting.
Patent Information
- Application Number
- CN202310757512.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-25
- Publication Date
- 2024-12-27
AI Technical Summary
The existing grid cutting methods have low accuracy when dealing with cutting planes in extreme cases, and cannot effectively cut grids for various cutting planes.
By obtaining multiple target crop line segments, splicing them to form a closed figure set, and dividing a set of molecules based on the relative positional relationship between the closed figures, obtaining the crop boundary information, and then accurately cropping the cutting grid to generate target cropping Cut the grid.
Improve the accuracy of grid cutting, and can more robustly determine the section information of the section surface, ensuring the quality and efficiency of the grid after cutting.
Smart Images

Figure CN119206125A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer-aided technology, and in particular to a grid cutting method, device, computer equipment and storage medium. Background Art
[0002] With the rapid development of computer technology, computer-aided diagnosis and preoperative planning have gained greater attention and wider application in clinical practice. For example, three-dimensional information of lesions is obtained through various imaging methods (such as CT, MRI, etc.), and three-dimensional models of lesions are obtained through a variety of computer image and graphics technologies. Compared with traditional two-dimensional image diagnosis, three-dimensional model imaging can provide more image information that is beneficial to the object of detection, and can better analyze and evaluate the image information of the object of detection.
[0003] The mesh model is a flexible and efficient three-dimensional model, which is widely used in lesion display and surgical planning. Mesh cutting is an important operation in mesh processing, which is of great significance for highlighting the region of interest and simulating surgical operations. In the past 30 years, there has been little research on mesh cutting.
[0004] The existing mesh cutting method cuts the mesh by determining the cutting plane. This type of method first determines a cutting plane with a normal vector, and uses the cutting plane to split the original mesh, retains the mesh on the positive side of the cutting plane, and then fills the cutting surface formed by the cutting plane and the mesh, and finally merges the retained original mesh and the new mesh of the cutting surface, and outputs the cut mesh content. However, the existing mesh cutting method cannot cut the mesh for cutting planes in various extreme cases, and there is a problem of low mesh cutting accuracy. Summary of the invention
[0005] Based on this, it is necessary to provide a grid cutting method, device, computer equipment and storage medium that can improve the accuracy of grid cutting in response to the above technical problems.
[0006] In a first aspect, the present application provides a grid cutting method, the method comprising:
[0007] Acquire multiple target cutting line segments, and splice the multiple target cutting line segments to form multiple first closed figures each containing the multiple target cutting line segments; the multiple target cutting line segments are formed according to multiple triangular facets contained in the to-be-cut mesh and a cutting plane; the cutting plane is used to cut the to-be-cut mesh;
[0008] According to the plurality of first closed figures, a closed figure set is obtained;
[0009] Obtaining the relative position relationship between multiple second closed figures in the closed figure set;
[0010] Based on the relative positional relationship between the plurality of second closed figures, a subset is divided from the closed figure set, and for each subset, according to the relative positional relationship between the third closed figures included in each subset, clipping boundary information corresponding to each subset is obtained;
[0011] The grid to be cut is cut according to the cutting boundary information to generate a cut target cutting grid corresponding to the grid to be cut.
[0012] In one of the embodiments, the relative position relationship includes a containment relationship;
[0013] Based on the relative positional relationship between the plurality of second closed figures, a subset is divided from the closed figure set, including:
[0014] According to the inclusion relationship between each second closed figure in the closed figure set, at least one target closed figure is obtained from the closed figures included in the closed figure set; the target closed figure is a closed figure in the closed figure set that is not included in any second closed figure other than itself;
[0015] According to the inclusion relationship between each second closed figure in the closed figure set, the closed figures respectively included in each target closed figure are obtained;
[0016] According to each target closed figure and the second closed figures respectively included in each target closed figure, a subset corresponding to each target closed figure is formed.
[0017] In one embodiment, for each subset, according to the relative position relationship between each third closed figure included in each subset, obtaining the clipping boundary information corresponding to each subset includes:
[0018] Get the inclusion relationship between each third closed graph contained in the current sub-collection; the current sub-collection is any sub-collection;
[0019] Determine the boundary type corresponding to each third closed figure included in the current subset according to the inclusion relationship between each third closed figure; the boundary type is used to characterize the type of the cutting boundary of the grid to be cut;
[0020] Each third closed figure included in the current subset and the boundary type corresponding to each third closed figure are used as the cutting boundary information of the current subset.
[0021] In one embodiment, determining the boundary type corresponding to each third closed figure included in the current subset according to the inclusion relationship between each third closed figure includes:
[0022] Establishing a closed graph relationship tree based on the inclusion relationship between each third closed graph included in the current subset;
[0023] Obtain the current closed graph and the current level of the current closed graph in the closed graph relationship tree from each third closed graph included in the current subset;
[0024] Get the boundary type corresponding to the current level, and use the boundary type corresponding to the current level as the boundary type corresponding to the current closed figure.
[0025] In one embodiment, obtaining the boundary type corresponding to the current level includes:
[0026] When the current level is an odd-numbered level in the closed graphical relationship tree, the boundary type corresponding to the current level is set to a solid boundary type;
[0027] When the current level is an even-numbered level in the closed graph relationship tree, the boundary type corresponding to the current level is set to a hole boundary type.
[0028] In one embodiment, performing a cutting process on the grid to be cut according to the cutting boundary information includes:
[0029] From the clipping boundary information, obtain the current clipping boundary information; the current clipping boundary information is the clipping boundary information corresponding to the current subset;
[0030] Obtain each third closed figure contained in the current subset corresponding to the current clipping boundary information;
[0031] If there is no common point between the third closed figures included in the current subset, the grid to be cut is cut according to the current cutting boundary information.
[0032] In one embodiment, after obtaining each third closed figure included in the current subset corresponding to the current clipping boundary information, the method further includes:
[0033] If at least two of the third closed figures included in the current subset corresponding to the current clipping boundary information have a common point, obtaining position information of the common point;
[0034] Based on the position information of the common point, the at least two third closed figures are split to obtain at least two fourth closed figures after the splitting, and the boundary types corresponding to the at least two third closed figures are used as the boundary types corresponding to the at least two fourth closed figures;
[0035] forming updated cropping boundary information according to at least two fourth closed figures, boundary types corresponding to at least two fourth closed figures, third closed figures not containing a common point, and boundary types corresponding to third closed figures not containing a common point;
[0036] The grid to be cut is cut according to the updated cutting boundary information.
[0037] In one embodiment, generating a cropped target cropping grid corresponding to the to-be-cropped grid includes:
[0038] Using the position information of the common point, merging at least two fourth closed figures to obtain a merged third closed figure;
[0039] According to the merged third closed figures and the third closed figures not containing a common point, a grid cutting surface is formed after the cutting grid is cut;
[0040] Generate a target cutting grid based on the grid cutting surface.
[0041] In one embodiment, obtaining a closed graph set according to a plurality of first closed graphs includes:
[0042] Obtaining self-intersecting figures and self-intersecting points of the self-intersecting figures from a plurality of first closed figures;
[0043] Based on the self-intersection points, the self-intersecting graph is split to obtain at least two non-self-intersecting sub-closed graphs;
[0044] Non-self-intersecting figures other than self-intersecting figures and sub-closed figures among the plurality of first closed figures are taken as second closed figures to form a closed figure set.
[0045] In one embodiment, the number of cutting planes is multiple;
[0046] Get multiple target cutting line segments, including:
[0047] Obtain multiple cutting line segments formed by the triangular face and multiple cutting planes, as well as the plane position relationship of each cutting plane;
[0048] According to the planar position relationship of the cutting plane and the multiple cutting line segments, multiple target cutting line segments are obtained.
[0049] In one embodiment, the planar position relationship of the cutting planes includes a first position relationship; the first position relationship indicates that the plurality of cutting planes are parallel, or the plurality of cutting planes intersect and the plane intersection lines of the plurality of cutting planes do not pass through the grid to be cut;
[0050] According to the planar position relationship of the cutting plane and the multiple cutting line segments, multiple target cutting line segments are obtained, including:
[0051] If the plane position relationship of the cutting planes is the first position relationship, the cutting line segments in the preset vector directions of the plurality of cutting planes are taken as target cutting line segments.
[0052] In one embodiment, the planar position relationship of the cutting planes includes a second position relationship; the second position relationship represents that a plurality of cutting planes intersect and the plane intersection lines of the plurality of cutting planes pass through the grid to be cut;
[0053] According to the planar position relationship of the cutting plane and the multiple cutting line segments, multiple target cutting line segments are obtained, including:
[0054] When the planar position relationship of the cutting planes is the second position relationship, a plurality of intersecting line segments formed by the intersection of the triangular face of the mesh to be cut and the plurality of cutting planes are obtained, and a side line sub-segment of the triangular face is obtained; the side line sub-segment is obtained according to the intersection of the triangular face and the plurality of intersecting line segments;
[0055] According to the intersection relationship of the multiple intersecting line segments, the intersecting sub-line segments corresponding to the multiple intersecting line segments are obtained;
[0056] Intersecting sub-line segments in the preset vector directions of multiple cutting planes and edge sub-line segments in the preset vector directions of multiple cutting planes are used as target sub-line segments to form multiple target cutting line segments.
[0057] In one embodiment, after generating the cropped target cropping grid corresponding to the to-be-cropped grid, the method includes:
[0058] In response to an optimization processing instruction for a target cutting grid, obtaining each vertex of the target cutting grid;
[0059] Get the number of connected vertices between each vertex of the target clipping grid and the preset number of target connected vertices;
[0060] Get the average difference between the number of connected vertices and the number of target connected vertices;
[0061] When the difference average value is greater than a preset difference threshold, the target cropping grid is subjected to a mesh regeneration process.
[0062] In one embodiment, obtaining the relative position relationship between a plurality of second closed figures in the closed figure set includes:
[0063] Obtain a current closed figure and a current vertex of the current closed figure from multiple closed figures;
[0064] Obtain candidate closed figures; the candidate closed figures are closed figures other than the current closed figure among multiple closed figures;
[0065] A target ray starting from the current vertex is obtained; and the relative position relationship between the current closed figure and each candidate closed figure is obtained according to the number of intersections between the target ray and the candidate closed figures.
[0066] In one embodiment, a plurality of target cutting line segments are spliced to form a plurality of first closed figures each including the plurality of target cutting line segments, including:
[0067] From multiple target cutting line segments, obtain the current cutting line segment and the current endpoint of the current cutting line segment; the current endpoint is any endpoint of the current cutting line segment;
[0068] Obtain a target cutting segment with the current endpoint as the endpoint, and based on the current endpoint, splice the current cutting segment and the target cutting segment;
[0069] The target cutting line segment is used as the updated current cutting line segment, and the process returns to the step of obtaining the current endpoint of the current cutting line segment until a first closed figure is formed.
[0070] In a second aspect, the present application further provides a grid cutting device, the device comprising:
[0071] A cutting line segment splicing module is used to obtain multiple target cutting line segments and splice the multiple target cutting line segments to form multiple first closed figures respectively containing multiple target cutting line segments; the multiple target cutting line segments are formed with a cutting plane according to multiple triangular facets contained in the grid to be cut; the cutting plane is used to cut the grid to be cut;
[0072] A graphic set acquisition module, used to obtain a closed graphic set according to a plurality of first closed graphics;
[0073] A position relationship acquisition module, used to acquire the relative position relationship between a plurality of second closed figures in the closed figure set;
[0074] A boundary information acquisition module, configured to divide the closed figure set into subsets based on the relative positional relationship between the plurality of second closed figures, and for each subset, acquire the cutting boundary information corresponding to each subset according to the relative positional relationship between the third closed figures included in each subset;
[0075] The cutting processing module is used to perform cutting processing on the to-be-cut grid according to the cutting boundary information, and generate a cut target cutting grid corresponding to the to-be-cut grid.
[0076] In a third aspect, the present application further provides a computer device, which includes a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.
[0077] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, which implements the steps of the above method when executed by a processor.
[0078] In a fifth aspect, the present application further provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps of the above method are implemented.
[0079] The above-mentioned mesh cutting method, device, computer equipment and storage medium obtain multiple target cutting line segments, and splice the multiple target cutting line segments to form multiple first closed figures that respectively contain multiple target cutting line segments; the multiple target cutting line segments are formed according to the multiple triangular facets contained in the mesh to be cut and the cutting plane; the cutting plane is used to cut the mesh to be cut; a closed figure set is obtained according to the multiple first closed figures; the relative position relationship between the multiple second closed figures in the closed figure set is obtained; based on the relative position relationship between the multiple second closed figures, subsets are divided from the closed figure set, and for each subset, the cutting boundary information corresponding to each subset is obtained according to the relative position relationship between the third closed figures included in each subset; according to the cutting boundary information, the mesh to be cut is cut to generate a cut target cutting mesh corresponding to the mesh to be cut. Compared with the traditional technology, the present application obtains a first closed figure by splicing discrete cutting line segments, and forms a closed figure set. From the relative position relationship between the second closed figures contained in the closed figure set, independent subsets are determined. Further, the cutting boundary information corresponding to each subset can be determined according to the relative position relationship between the third closed figures contained in the subset. In this way, the cutting information of the cutting surface of the grid to be cut can be further obtained. Through the relative position relationship between the above-mentioned second closed figures, the cutting information of the cutting surface can be determined more robustly. Further, according to the cutting boundary information corresponding to each subset, the grid to be cut can be cut. In this way, the cutting of the grid can be completed effectively and accurately, thereby improving the accuracy of cutting the grid. BRIEF DESCRIPTION OF THE DRAWINGS
[0080] Figure 1 A schematic diagram of a method in an embodiment of an embodiment;
[0081] Figure 2 A schematic diagram of the structure of different types of three-dimensional grids in one embodiment;
[0082] Figure 3 A schematic flow chart of a step of dividing a subset from a closed graph set in one embodiment;
[0083] Figure 4 is a structural schematic diagram of the relative position relationship of the second closed figure in one embodiment;
[0084] Figure 5 A schematic diagram of a step of determining a boundary type corresponding to each third closed figure included in a current subset in an embodiment;
[0085] Figure 6 A schematic diagram of the structure of a closed graph relationship tree in one embodiment;
[0086] Figure 7 A schematic diagram of the structure of a closed graph relationship tree splitting result in one embodiment;
[0087] Figure 8 is a schematic structural diagram of a third closed figure having common points in one embodiment;
[0088] Fig. 9 A schematic diagram of the structure of a self-intersecting graph in one embodiment;
[0089] Fig.10 It is a structural schematic diagram of the plane position relationship of multiple cutting planes in one embodiment;
[0090] Fig.11 A schematic diagram of a structure in which a triangular facet intersects with a plurality of cutting planes in one embodiment;
[0091] Fig.12 A schematic diagram of a grid cutting method in another embodiment;
[0092] Fig.13 is a structural block diagram of a grid cutting method device in an embodiment;
[0093] Fig.14 FIG. 2 is a diagram showing the internal structure of a computer device in an embodiment. DETAILED DESCRIPTION
[0094] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0095] The existing mesh cutting methods include: (1) selecting and cutting triangles one by one for mesh cutting. This method requires the user to select the triangles to be deleted one by one. Although this method is very simple to operate, its process is too cumbersome, and as the mesh becomes more refined, the workload increases exponentially. In addition, the cut surface generated by this method is jagged and very unsightly, requiring post-processing such as mesh smoothing. (2) Selecting and cutting triangles based on region growth information based on adjacency information. In this method, the user selects a triangle with the mouse, and then uses the triangle as the starting point to spread to its adjacent meshes layer by layer, expand the number of selected triangles, and then delete the selected triangles. This method makes it difficult to achieve the number of selected triangles that is actually the number of triangles that need to be deleted, and the effect is poor. (3) Cube intersection cutting. This method constructs a cube by clicking and dragging the mouse, and then intersects the mesh to be cut with the cube and deletes the intersecting mesh. This method is greatly affected by the number and size of the triangular facets of the mesh to be cut, has a slow calculation speed, and requires multiple complex parameter controls, with poor versatility and robustness. (4) Manual selection of cutting lines. This type of method allows the user to manually select the vertices of the cutting edge, and then forms a cutting contour line through methods such as the shortest path theory, thereby splitting the mesh at both ends of the cutting line. This type of method can specify various cutting shapes, but the accuracy of the result depends on the accuracy and number of the cutting line vertices selected by the user. (5) Automatic optimization of cutting lines. This class provides a rough cutting area that contains an ideal cutting area or is close to the segmentation edge, and controls the shape transformation of the cutting area through algorithms such as the active contour method, the minimum ratio cycle algorithm (Minimun Ratio Cycle), and the graph cut method to reduce the user's workload. This type of method allows the user to roughly specify the initial area, but has disadvantages such as unsatisfactory results and local optimality. (6) Clustering-based cutting methods require the specification of the initial categories of some vertices, and then calculate the category of each vertex according to a certain algorithm to achieve mesh cutting. The clipping effect of this type of method is too dependent on data features. When the vertex information of different categories is similar, it is difficult to be segmented normally. (7) Method by determining the clipping plane. This type of method first determines a clipping plane with a normal vector, and uses the clipping plane to split the original mesh, retaining the mesh on the positive side of the clipping plane, and then fills the clipping surface formed by the clipping plane and the mesh. Finally, the retained original mesh and the new mesh of the clipping surface are merged and output. A method of traversing each triangle patch one by one, determining the position of the patch and the clipping plane, and obtaining the positive side, negative side, and intersecting patch set of the clipping plane. The algorithm is simple in principle and easy to implement, but the traversal of each patch causes the same line segment to be calculated multiple times, so the same intersection point has different coordinates on different intersection lines, which makes the algorithm unable to robustly combine the intersecting line set into a clipping surface polygon.A two-point mesh model cutting method, which manually selects seed points to generate cutting surfaces. In the process of calculating cutting, starting directly from the seed points, the complete cutting area triangle is found through the adjacent structure, and the cutting edge is obtained. Then the triangular strip mesh generated by cutting is merged with the upper and lower sub-grids respectively, so that the three-dimensional mesh model is divided into upper and lower parts according to the cut surface, and the cut parts are no longer adhered. When filling the filling surface, the ear cutting method is used for filling, and the loop subdivision method (a mesh subdivision method) is used to subdivide the triangular strip mesh to obtain a uniformly distributed triangular strip mesh. The algorithm directly assumes that the polygon sets generated by the cutting line are not connected to each other. In fact, there may be common points between the polygons, which makes the robustness of the algorithm have certain risks. In order to avoid directly judging the position relationship between each triangle and the cutting surface during the cutting process, and calculating the error caused by the intersection line segment, the prior art provides a cutting method based on the judgment of the position relationship between the edge and the cutting surface, but this method can only obtain the mesh on the plane normal vector side, and they have not conducted an in-depth discussion on the cutting surface segmentation process.
[0096] In summary, the existing mesh cutting method cannot perform mesh cutting for cutting planes in various extreme situations, and there is a problem of low mesh cutting accuracy. Based on this, the present application provides a mesh cutting method that can effectively improve the mesh cutting accuracy. The mesh cutting method provided in the present application can be applied to surface meshes as well as to volume meshes.
[0097] In one embodiment, Figure 1 As shown, a grid cutting method is provided. This embodiment takes the method applied to a terminal as an example. It can be understood that the method can also be applied to a server, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. In this embodiment, the method includes the following steps:
[0098] S102, obtaining a plurality of target cutting line segments, and splicing the plurality of target cutting line segments to form a plurality of first closed figures each containing the plurality of target cutting line segments; the plurality of target cutting line segments are formed according to a plurality of triangular facets contained in a mesh to be cut and a cutting plane; the cutting plane is used to cut the mesh to be cut.
[0099] The target cutting line segment may be a line segment formed by the intersection of a triangle patch and a cutting plane; a triangle patch refers to a plane figure composed of three vertices and three edges, a triangle patch may be the smallest unit of patches forming a mesh, and the mesh to be cut may be represented in the form of a triangle patch. The cutting plane refers to a plane used to cut (or split or cut) the mesh to be cut.
[0100] For example, the mesh to be cut is formed based on multiple triangular facets. When the cutting plane cuts the mesh to be cut, the cutting plane intersects with the triangular facets to obtain discrete intersecting line segments, which can be used as target cutting line segments. As an example, if the cutting plane intersects with a certain triangular facet, and the cutting plane intersects with two edges of the triangular facet to obtain two intersection points on the two edges, then the line segment between the two intersection points can be used as the target cutting line segment.
[0101] The first closed figure refers to a closed figure formed by splicing a plurality of target cutting line segments. For example, the first closed figure may be a polygon obtained by splicing a plurality of target cutting line segments.
[0102] For example, multiple discrete target cutting line segments can be obtained through the planar position relationship between the cutting plane and the triangular facets constituting the to-be-cut mesh, and the multiple discrete target cutting line segments can be spliced to obtain the first closed figure. For example, the target cutting line segments with the same endpoints (vertices) in the multiple target cutting line segments can be spliced to form the first closed figure.
[0103] Optionally, the splicing of discrete target cutting line segments into a first closed figure can be performed according to a pre-set splicing condition. The pre-set splicing condition in this embodiment can be that adjacent target cutting line segments have the same vertex, and the spliced vertices of any target cutting line segment are no longer spliced. In the specific implementation process, starting from a vertex of any target cutting line segment, connect another target cutting line segment with the vertex, and then connect the new target cutting line segment from another vertex of the next target cutting line segment. Repeat this process until a closed figure (first closed figure) can be formed, and the discrete target cutting line segments can be connected into a single or multiple first closed figures. If a vertex is the vertex of more than two target cutting line segments, arbitrarily select a non-current target cutting line segment for connection, and the connected target cutting line segment will no longer participate in subsequent connections. The non-current target cutting line segment refers to the target cutting line segment that has not been connected.
[0104] S104, obtaining a closed figure set according to the plurality of first closed figures.
[0105] The closed figure set may be a set formed by a plurality of first closed figures, or may be a set of first closed figures formed by processing a plurality of first closed figures to obtain processed first closed figures.
[0106] Exemplarily, multiple first closed figures may be preprocessed to obtain closed figures that meet preset conditions, and a closed figure set may be formed by the multiple closed figures that meet the preset conditions. For example, if the first closed figure includes multiple intersecting closed figures, the first closed figure may be split into multiple non-intersecting closed figures, and the multiple non-intersecting closed figures may be used as closed figures that meet the preset conditions.
[0107] In a specific implementation process, if the first closed figure is a closed figure without intersection points, the first closed figure can be used as a non-split closed figure that meets the preset conditions; and the first closed figure with intersection points can be split to obtain split closed figures that meet the preset conditions. A closed figure set can be formed by non-split closed figures that meet the preset conditions and split closed figures that meet the preset conditions.
[0108] S106, obtaining a relative position relationship between a plurality of second closed figures in the closed figure set.
[0109] The second closed figure may be a closed figure included in the closed figure set, and the second closed figure may be obtained by preprocessing the first closed figure. As an example, the first closed figure may be preprocessed to obtain the second closed figure, and the closed figure set may be obtained based on the second closed figure and the first closed figure that does not require preprocessing. As another example, the closed figure set may be obtained by multiple first closed figures, and the first closed figure included in the closed figure set may be preprocessed to obtain multiple second closed figures included in the closed figure set. The preprocessing may be to split the first closed figures that have intersection points.
[0110] The relative position relationship refers to the relative relationship between the positions of the second closed figures; for example, the relative position relationship can be a containment relationship or a non-containment relationship, and the non-containment relationship can be a separation relationship. For example, if the second closed figure A contains the second closed figure B, the relative position relationship between the second closed figure A and the second closed figure B is a containment relationship. If the second closed figure A is separated from the second closed figure C, the relative position relationship between the second closed figure A and the second closed figure C is a separation relationship or a non-containment relationship.
[0111] Exemplarily, the relative position relationship between the second closed figures in the closed figure set can be obtained by judging the relative position relationship. For example, the relative position relationship can be judged by the ray method. Furthermore, each second closed figure can be processed according to the relative position relationship between the second closed figures, and the cutting information of the cutting surface of the grid to be cut can be obtained. The cutting surface of the grid to be cut refers to the cross section obtained after the cutting plane cuts (cuts) the grid to be cut, and the cross section can be used as the grid surface of the new grid, which is the new grid generated after the grid to be cut is cut. The cutting information can be the grid boundary information contained in the cutting surface.
[0112] S108, based on the relative position relationship between the multiple second closed figures, divide the closed figure set into subsets, and for each subset, obtain the clipping boundary information corresponding to each subset according to the relative position relationship between the third closed figures included in each subset.
[0113] The subset refers to a set formed by classifying a plurality of second closed figures included in the closed figure set. The third closed figure may be a closed figure included in the subset. As an example, the closed figure included in the closed figure set is a second closed figure, and the closed figure included in the subset is a third closed figure; the third closed figure may be the second closed figure.
[0114] The relative position relationship between the third closed figures may be a containment relationship between the third closed figures. The cutting boundary information may be boundary information corresponding to the cutting surface of the grid to be cut; for example, the cutting boundary information may be contour information of the cutting surface, or may be graphic type information, and the graphic type information may be a solid boundary type or a hole boundary type.
[0115] Exemplarily, the multiple second closed figures included in the closed figure set can be divided according to the inclusion relationship and non-inclusion relationship between the multiple second closed figures, and subsets can be formed according to the divided second closed figures. For each subset, the third closed figures included in the subset can be determined, and the relative position relationship between the third closed figures can be determined. Further, the cutting boundary information of the cutting surface of the grid to be cut can be determined according to the relative position relationship between the third closed figures.
[0116] In the specific implementation process, the second closed figures with inclusion relationship can be obtained, for example, the second closed figure A includes the second closed figures B and C, and the second closed figure C includes the second closed figure D, then the subset X can be formed according to the second closed figures A, B, C, and D. And the second closed figures E and F with non-inclusion relationship with the second closed figure A are obtained. If the second closed figure E and the second closed figure F have inclusion relationship, the subset Y can be formed based on the second closed figure E and the second closed figure F; for example, the second closed figure E can include the second closed figure F.
[0117] In the specific implementation process, for each subset, the cutting boundary information corresponding to each subset can be determined according to the inclusion relationship between the third closed figures. For example, for subset X, it is formed by second closed figures A, B, C, and D, then the second closed figures A, B, C, and D can be used as third closed figures A, B, C, and D respectively; then the third closed figure A contains the third closed figures B and C, and the third closed figure C contains the third closed figure D, then the third closed figure A can be determined to be the outermost entity boundary of the grid to be cut, the third closed figures B and C are both hole boundaries, and the third closed figure D is the boundary of the entity grid within the hole boundary corresponding to the third closed figure C. For example, for subset Y, it includes third closed figures E and F, and the third closed figure E contains the third closed figure F, then the third closed figure E can be determined to be the outermost entity boundary of the grid to be cut, and the third closed figure F is the hole boundary within the grid to be cut.
[0118] S110, performing a cutting process on the to-be-cut grid according to the cutting boundary information, and generating a cut target cutting grid corresponding to the to-be-cut grid.
[0119] The target cutting grid refers to the cutting grid obtained by cutting the grid to be cut. As an example, if the cutting plane does not intersect the grid to be cut, the target cutting grid is the original grid to be cut. If the cutting plane intersects the grid to be cut, and the number of cutting planes is one, the target cutting grid is the cut grid corresponding to the two sides of the cutting plane.
[0120] Exemplarily, the cutting information corresponding to the cutting surface of the mesh to be cut can be obtained based on the cutting boundary information. Furthermore, the mesh surface information of the new mesh (the cut mesh) can be obtained based on the cutting information corresponding to the cutting surface of the mesh to be cut, and the corresponding new mesh (target cutting mesh) can be generated based on the mesh surface information of the new mesh. For example, the two sub-meshes obtained after the cutting plane divides the mesh to be cut can be obtained, and the cutting information corresponding to the cutting surface is used as the mesh surface information of the unknown mesh surfaces of the two sub-meshes to generate two new target cutting meshes. In this way, through the above steps S102-S108, the cutting information of the cutting surface after cutting the mesh to be cut can be effectively and accurately obtained, and the target cutting mesh after cutting can be generated based on the cutting information of the cutting surface, thereby improving the accuracy of cutting the mesh.
[0121] In a specific implementation, a pre-set grid cutting mode can be obtained, and the grid cutting mode includes a first cutting mode and a second cutting mode. If the grid cutting mode is the first cutting mode, the section surface of the grid to be cut can be triangulated by the earcut method. In this way, the efficiency of cutting the section surface can be improved. If the grid cutting mode is the second cutting mode, the section surface of the grid to be cut can be triangulated by the advancing front method. In this way, the quality of the target cutting grid obtained by cutting can be improved. As an example, the grid cutting mode can be a mode pre-set by the user through the terminal, and the terminal can display the first cutting mode and the mode options of the first cutting mode so that the user can select the required grid cutting mode. As an example, if the user does not select the grid cutting mode, the grid cutting can be performed according to the default grid cutting mode, and the default grid cutting mode can be the first cutting mode. In this way, different mesh cutting modes (different triangulation methods) can be selected according to the user's requirements for mesh algorithm quality and efficiency, so that the robustness and high quality of mesh cutting can be considered. Furthermore, for scenes requiring high quality of mesh, it is possible to propose a quality assessment of the triangulation results, and determine whether mesh optimization is needed based on the assessment results, so that the robustness and high quality can be considered while also taking into account the efficiency of mesh cutting.
[0122] In this embodiment, a plurality of target cutting line segments are obtained, and the plurality of target cutting line segments are spliced to form a plurality of first closed figures respectively containing the plurality of target cutting line segments; the plurality of target cutting line segments are formed according to a plurality of triangular facets contained in a mesh to be cut and a cutting plane; the cutting plane is used to cut the mesh to be cut; a closed figure set is obtained according to the plurality of first closed figures; a relative positional relationship between a plurality of second closed figures in the closed figure set is obtained; based on the relative positional relationship between the plurality of second closed figures, subsets are divided from the closed figure set, and for each subset, cutting boundary information corresponding to each subset is obtained according to the relative positional relationship between the third closed figures included in each subset; according to the cutting boundary information, the mesh to be cut is cut to generate a cut target cutting mesh corresponding to the mesh to be cut. This embodiment obtains the target cutting line segments formed by the cutting plane and the triangular facets, and splices the discrete target cutting line segments to form a closed figure set, and determines the unrelated subsets from the relative position relationship between the second closed figures included in the closed figure set. Further, the cutting boundary information corresponding to each subset can be determined according to the relative position relationship between the third closed figures included in the subset, and the cutting information of the cutting surface of the grid to be cut is determined according to the cutting boundary information. Through the relative position relationship between the above-mentioned second closed figures, the cutting information of the cutting surface can be determined more robustly, the accuracy of the cutting information of the cutting surface can be improved, and further based on the cutting information of the cutting surface, the target cutting grid after cutting can be generated, thereby improving the accuracy of cutting the grid.
[0123] In one embodiment, in S102, the step of obtaining multiple target cutting line segments may include:
[0124] Establish a vertex set. The vertex unit is used to obtain the vertices of each triangle face and save the vertex position of each vertex. It can also obtain the signed distance between each vertex and the cutting plane. If the distances from all vertices to the cutting plane are positive numbers, it means that the mesh to be cut is on the positive side of the plane normal vector; if the distances from all vertices to the cutting plane are negative numbers, it means that the mesh is on the negative side of the plane normal vector. If the above two situations exist, the cutting result can be output directly. The cutting plane does not intersect with the mesh to be cut, that is, one side of the cutting plane is the original mesh (the mesh to be cut), and the other side is an empty mesh. The cutting contour line and the cutting surface subdivision mesh of the mesh to be cut are empty.
[0125] Create an edge set and a triangle patch set. The edge unit is used to index two vertices in the vertex set to obtain each edge to form an edge set. The triangle unit is used to index two edges in the edge set to obtain each triangle patch to form a triangle patch set. The edge unit is also used to obtain a flag for each edge and the cutting plane to determine whether it has an intersection point, and the position of the intersection point. The triangle unit is also used to obtain a flag for the positional relationship between the triangle and the cutting plane. Flags related to the relative position of the cutting plane can be set in edge operations and face operations.
[0126] Through the vertex of each edge, determine whether the edge intersects with the clipping plane. If both endpoints of the edge are on the positive side of the normal vector of the clipping plane, it indicates that the edge is on the positive side of the normal vector of the clipping plane; if both endpoints of the edge are on the negative side of the normal vector of the clipping plane, it indicates that the edge is on the negative side of the normal vector of the clipping plane; if both endpoints of the edge are on both sides of the normal vector of the clipping plane, it indicates that the edge intersects with the clipping plane, and the intersection point is obtained. If one endpoint of the edge is on the plane, whether the edge is on the positive side, negative side, or on the plane of the normal vector of the clipping plane depends on the position of the other endpoint.
[0127] Traverse the triangles and get the positions of the three edges according to the index to determine the position of the triangles.
[0128] When there is no edge intersecting with the clipping plane, if the three edges of the triangle are all on the positive side of the clipping plane normal vector, confirm that the triangle is on the positive side of the clipping plane; when the three edges of the triangle are all on the negative side of the clipping plane normal vector, confirm that the triangle is on the negative side of the clipping plane; when one edge is on the clipping plane, confirm that the triangle is on the positive or negative side of the clipping plane, depending on whether the other two edges of the triangle are on the positive or negative side of the clipping plane, and use the edge as the target clipping line segment; when more than two edges are on the clipping plane, confirm that the triangle is on the clipping plane.
[0129] When there is an edge that intersects with the clipping plane, it can be confirmed that the clipping plane passes through an intersection vertex and a line segment of the triangular face. Connect the intersection point with the intersection vertex of the triangular face, split the triangular face into two triangular facets on the positive and negative sides of the clipping plane, and save the newly generated clipping line segment as the target clipping line segment. Through the above method, the original mesh to be clipped can be divided into a part located on the positive side of the clipping plane normal vector and a part located on the negative side of the clipping plane.
[0130] When there are two edges intersecting with the clipping plane, it can be confirmed that the clipping plane passes through the two edges of the triangle, and the intersection point of the two intersecting edges is connected to decompose the triangle into two sides of the plane, and the newly generated clipping line segment is saved as the target clipping line segment. For one side, it is divided into a quadrilateral, and the quadrilateral can be further decomposed into new triangles.
[0131] In this embodiment, based on the traditional point-line-plane triangulated network representation method, it is proposed to add information related to the cutting plane in the point-line-plane unit. Specifically, the signed distance from the vertex to the cutting plane is added to the point unit, the information on the relative position between the line and the plane (positive side, negative side, intersection and plane) and the cutting point information when there is an intersection are added to the line unit, and the relative position information between the facet and the cutting plane (positive side of the cutting plane, negative side of the cutting plane, intersection with the cutting plane and on the cutting plane) is added to the surface unit. This representation method can also be further extended to the volume mesh, that is, the relative position information between the volume unit and the cutting plane is added to the volume mesh.
[0132] By taking the triangle as the smallest unit of the mesh to be cut, and taking each vertex of the triangle as the saved data, the edge of the triangle is obtained by indexing two vertices, and the triangle is obtained by indexing three edges. The relative relationship between the triangle and the cutting plane is judged in this way. In this way, the target cutting line segment can be determined effectively and accurately, thereby improving the accuracy of the newly generated target cutting mesh and the accuracy of cutting the mesh to be cut.
[0133] In a specific embodiment, when establishing the edge and face sets, the number of triangles of each edge of the to-be-cut mesh is detected at the same time. When the number of triangles of the triangles is equal to 2, it can be determined that the to-be-cut mesh is a two-dimensional manifold mesh, such as Figure 2 (a) When the number of triangles where some of the edges of a triangle are located is greater than or equal to an even number of 2, it can be determined that the mesh to be cut is a closed mesh with intersections, such as Figure 2 (b) When the number of triangles where the edge is located is odd, the mesh to be cut is a non-closed mesh, such as Figure 2 As shown in (c), the situation becomes too complicated and does not meet the general assumptions of subsequent polygon combination and closure. In this case, only the target cutting mesh and its outer contour after cutting are obtained, and the meshing information of the cutting surface cannot be performed. Therefore, the cutting surface meshing of the cutting mesh to be cut is not performed.
[0134] In this embodiment, the above steps S102-S110 are applicable to the cutting of various two-dimensional manifold meshes and closed meshes. For non-closed meshes, outputs other than the cut surface mesh can be provided, thereby improving the output rate of the cut mesh.
[0135] In one embodiment, the relative position relationship includes a containment relationship;
[0136] like Figure 3 As shown, based on the relative positional relationship between the plurality of second closed figures, a subset is divided from the closed figure set, including:
[0137] S302, according to the inclusion relationship between each second closed figure in the closed figure set, obtaining at least one target closed figure from the closed figures included in the closed figure set; the target closed figure is a closed figure in the closed figure set that is not included in any second closed figure other than itself;
[0138] S304, obtaining closed figures respectively included in each target closed figure according to the inclusion relationship between each second closed figure in the closed figure set;
[0139] S306: Form subsets corresponding to the target closed figures respectively according to the target closed figures and the second closed figures respectively included in the target closed figures.
[0140] The target closed figure refers to a second closed figure that is not included in any second closed figure other than itself, that is, the target closed figure may include other second closed figures or may not include other second closed figures. The number of target closed figures may be one or more.
[0141] Exemplarily, at least one target closed figure that is not contained by any second closed figure other than itself can be determined from the closed figures contained in the closed figure set according to the inclusion relationship and non-inclusion relationship between the second closed figures. For each target closed figure, the closed figures contained in the target closed figure are determined based on the inclusion relationship of the target closed figure; based on the target closed figure and the second closed figures contained in the target closed figure, a subset corresponding to the target closed figure is formed.
[0142] For example, if the second closed figure A is a closed figure that is not included in any second closed figure other than itself, then the second closed figure A can be used as a target closed figure, and according to the inclusion relationship between the second closed figure A and other second closed figures, it is determined that the second closed figure A includes the second closed figures B, C, and D, wherein it can be further determined that the second closed figure C includes the second closed figure D, and the second closed figure B is separated from the second closed figure C. In this way, a subset X can be formed according to the second closed figures A, B, C, and D.
[0143] like Figure 4 As shown, polygon 1 is a closed figure that is not contained by any second closed figure other than itself, then polygon 1 can be used as the target closed figure, and according to the inclusion relationship between polygon 1 and other polygons, it is determined that polygon 1 contains polygons 3, 4, and 6, wherein it can be further determined that polygon 3 contains polygon 6, and the relative position relationship between polygon 3 and polygon 4 is a non-inclusion relationship (separate relationship). In this way, a subset can be formed based on polygons 1, 3, 4, and 6.
[0144] If polygon 2 is a closed figure that is not contained by any second closed figure except itself, then polygon 2 can be used as the target closed figure. Based on the inclusion relationship between polygon 2 and polygon 5, it is determined that polygon 2 contains polygon 5. Then, a subset can be formed based on polygon 2 and polygon 5.
[0145] In this embodiment, by obtaining at least one target closed figure from the closed figures included in the closed figure set, and determining the closed figures respectively included in each target closed figure, it is possible to form subsets corresponding to each target closed figure according to each target closed figure and the second closed figures respectively included in each target closed figure, thereby improving the accuracy of the boundary information of the section surface, and further improving the accuracy of the grid cutting.
[0146] In one embodiment, for each subset, according to the relative position relationship between each third closed figure included in each subset, the clipping boundary information corresponding to each subset is obtained, including:
[0147] Get the inclusion relationship between each third closed graph contained in the current sub-collection; the current sub-collection is any sub-collection;
[0148] Determine the boundary type corresponding to each third closed figure included in the current subset according to the inclusion relationship between each third closed figure; the boundary type is used to characterize the type of the cutting boundary of the grid to be cut;
[0149] Each third closed figure included in the current subset and the boundary type corresponding to each third closed figure are used as the cutting boundary information of the current subset.
[0150] The current subset may be any one of the multiple subsets; for any subset, the method provided in this embodiment may be applied to determine the cutting boundary information. The boundary type is used to characterize the cutting boundary type corresponding to the cutting plane of the to-be-cut mesh; the cutting plane is the cross section obtained after cutting (cutting) the to-be-cut mesh. The cutting boundary type may be the type corresponding to the cutting boundary of the cutting plane.
[0151] Exemplarily, if the subset is formed based on the second closed figure, the second closed figure can be used as the third closed figure, so the closed figure included in the subset is the third closed figure. For any subset, the inclusion relationship between the third closed figures in the subset can be obtained, and the boundary type corresponding to each third closed figure can be determined based on the inclusion relationship between the third closed figures. For example, the boundary type corresponding to the third closed figure can be a hole boundary or a solid boundary. Based on each third closed figure and its corresponding boundary type, the cutting boundary information of the subset is formed.
[0152] In this embodiment, the boundary type corresponding to each third closed figure included in the current subset is determined through the inclusion relationship between each third closed figure, and the cutting boundary information of the current subset is obtained based on each third closed figure included in the current subset and the boundary type corresponding to each third closed figure. The boundary type can be effectively determined, and the cutting boundary information corresponding to each subset can be further accurately obtained, thereby improving the accuracy of the boundary information of the cutting surface, and further improving the accuracy of the grid cutting.
[0153] In one embodiment, Figure 5 As shown, according to the inclusion relationship between the third closed figures, the boundary type corresponding to each third closed figure included in the current subset is determined, including:
[0154] S502, establishing a closed graph relationship tree based on the inclusion relationship between each third closed graph included in the current subset;
[0155] S504, acquiring the current closed graph and the current level of the current closed graph in the closed graph relationship tree from each third closed graph included in the current subset;
[0156] S506, obtaining the boundary type corresponding to the current level, and using the boundary type corresponding to the current level as the boundary type corresponding to the current closed figure.
[0157] The closed graph relationship tree may be a relationship tree formed according to the relative position relationship between the third closed graph relationships. The current closed graph may be any one of the plurality of third closed graphs. The current level refers to a level in the closed graph relationship tree, and may be a level at which the current closed graph is located.
[0158] For example, for any subset, a closed graph relationship tree can be established according to the inclusion relationship between each third closed graph in the subset. The hierarchical position of each third closed graph in the closed graph relationship tree can be determined, and the boundary type of the third closed graph can be determined according to the level corresponding to each third closed graph and the boundary type corresponding to the level.
[0159] For example, according to Figure 4 The relative position relationship of each polygon in is established as follows Figure 6The closed graph relationship tree shown in the figure, in which the infinite polygon is the root node of the closed graph relationship tree during the algorithm implementation process, and the connection between polygon 1 and polygon 2 can be established through the infinite polygon. In the specific implementation process, polygon 1 contains polygons 3 and 4, then the level corresponding to polygons 3 and 4 is the next level of the level corresponding to polygon 1, that is, the child node of the node corresponding to polygon 1 is the node corresponding to polygons 3 and 4; polygon 3 contains polygon 6, then the level corresponding to polygon 3 is the previous level of the level where polygon 6 is located. Polygon 2 contains polygon 5, then the level corresponding to polygon 2 is the previous level of the level where polygon 5 is located
[0160] In this embodiment, a closed graphic relationship tree is established through the inclusion relationship between each third closed graphic included in the current subset, and the boundary type of each third closed graphic can be determined according to the level of each third closed graphic in the closed graphic relationship tree and the boundary type corresponding to the level, thereby improving the accuracy of determining the cutting boundary information, thereby improving the accuracy of cutting the grid to be cut.
[0161] In one embodiment, obtaining the boundary type corresponding to the current level includes:
[0162] When the current level is an odd-numbered level in the closed graphical relationship tree, the boundary type corresponding to the current level is set to a solid boundary type;
[0163] When the current level is an even-numbered level in the closed graph relationship tree, the boundary type corresponding to the current level is set to a hole boundary type.
[0164] Among them, the entity boundary type can be used to characterize the outermost boundary of a solid mesh; the solid mesh is used to characterize that the mesh is solid. The hole boundary type can be used to characterize the outermost boundary of a hole mesh, and can be used to characterize the boundary between a solid mesh and a hole mesh. The hole mesh characterizes that the mesh is a hole. For example, if a mesh has no holes, the mesh is a solid mesh; if a mesh has holes, the mesh includes a solid mesh and a hole mesh, and the solid mesh and the hole mesh are on the same plane, and the closed figure corresponding to the solid mesh contains the closed figure corresponding to the hole mesh. The boundary type of the closed figure corresponding to the solid mesh is the entity boundary type; the boundary type of the closed figure corresponding to the hole mesh is the hole boundary type.
[0165] In the specific implementation process, if the current level is an odd-numbered level in the closed graphic relationship tree, the boundary type corresponding to the current level is determined as a solid boundary type. If the current level is an even-numbered level in the closed graphic relationship tree, the boundary type corresponding to the current level is determined as a hole boundary type.
[0166] For example, Figure 6 As shown in the closed graph relationship tree, since there are infinite polygons corresponding to the nodes in the algorithm implementation process, the level where the infinite polygons are located can be determined as the 0th level, then the level where polygons 1 and 2 are located is the 1st level, the level where polygons 3, 4, and 5 are located is the 2nd level, and the level where polygon 6 is located is the 3rd level; in this way, the boundary type corresponding to the 1st and 3rd levels is determined as the solid boundary type, and the boundary type corresponding to the 2nd level is determined as the hole boundary type, then the boundary type corresponding to polygons 1, 2, and 6 is the solid boundary type, and the boundary type corresponding to polygons 3, 4, and 5 is the hole boundary type.
[0167] In the specific implementation process, the root node of the closed graph relationship tree can be set as the 0th layer, the child nodes of the root node are the first layer nodes, and so on. For any odd-numbered layer polygon, the polygon and its child node polygons are used as the outer boundary and hole boundary of an object, and different objects are triangulated separately. In this way, any polygon input into the triangulation algorithm is a simple polygon or a polygon containing holes to ensure the correct operation of the constrained triangulation.
[0168] In this embodiment, by corresponding the current level to an odd layer or an even layer and determining the boundary type of the current level, it is possible to accurately determine the boundary type of the closed figure and the cutting boundary information, thereby improving the accuracy of generating the target cutting grid.
[0169] In a specific embodiment, Figure 7 As shown, the closed graph relationship tree can be split according to the nodes and their child nodes of the odd layers to obtain a simpler closed graph node tree. In order to ensure the robustness of the triangulation of the mesh to be cut, it is proposed to construct a polygon node tree (closed graph relationship tree) based on the relative position relationship of the polygons. At the same time, by splitting the polygon node tree, the number of cutting surface polygons input into the triangulation algorithm is made as small as possible and the relative position relationship is as simple as possible, making the mesh cutting more efficient and robust.
[0170] In one embodiment, the grid to be cut is cut according to the cutting boundary information, including:
[0171] From the clipping boundary information, obtain the current clipping boundary information; the current clipping boundary information is the clipping boundary information corresponding to the current subset;
[0172] Obtain each third closed figure contained in the current subset corresponding to the current clipping boundary information;
[0173] If there is no common point between the third closed figures included in the current subset, the grid to be cut is cut according to the current cutting boundary information.
[0174] The current cutting boundary information refers to the cutting boundary information corresponding to the current subset, and the current subset may be any subset. The cutting boundary information may be the boundary information corresponding to the section surface of the to-be-cut grid.
[0175] Exemplarily, any one of the cutting boundary information can be obtained from the cutting boundary information as the current cutting boundary information, and the current subset corresponding to the current cutting boundary information can be determined. From the third closed figures contained in the current subset, it can be determined whether the third closed figures have common points. If there are no common points between the third closed figures, the cutting boundary information (cutting boundary information) of the cutting plane can be determined according to the current cutting boundary information. Based on the cutting boundary information of the cutting plane, the cutting grid to be cut is cut to generate the target cutting grid. In this way, in order to solve the problem that the common points of multiple polygons lead to the failure of the cutting, it is proposed to move the common points of the polygons so that there are no common points between the polygons, thereby improving the success rate of the mesh cutting.
[0176] In this embodiment, by determining whether each third closed figure in the current subset has a common point, if no common point exists, the grid to be cut can be directly cut according to the current cutting boundary information corresponding to the current subset, thereby ensuring that the grid to be cut is successfully cut and avoiding cutting failure, thereby improving the success rate of cutting the grid to be cut, and further improving the accuracy of generating the target cutting grid.
[0177] In one embodiment, after obtaining each third closed figure included in the current subset corresponding to the current clipping boundary information, the method further includes:
[0178] If at least two of the third closed figures included in the current subset corresponding to the current clipping boundary information have a common point, obtaining position information of the common point;
[0179] Based on the position information of the common point, the at least two third closed figures are split to obtain at least two fourth closed figures after the splitting, and the boundary types corresponding to the at least two third closed figures are used as the boundary types corresponding to the at least two fourth closed figures;
[0180] forming updated cropping boundary information according to at least two fourth closed figures, boundary types corresponding to at least two fourth closed figures, third closed figures not containing a common point, and boundary types corresponding to third closed figures not containing a common point;
[0181] The grid to be cut is cut according to the updated cutting boundary information.
[0182] The location information of the common point may be the intersection information of the two third closed figures. The fourth closed figure may be a closed image obtained by splitting the two third closed figures with the common point. For example, if the third closed figure A and the third closed figure B have an intersection, the third closed figure A and the third closed figure B may be split based on the intersection of the third closed figure A and the third closed figure B to obtain the fourth closed figure A and the fourth closed figure B respectively. Figure 8 The polygon shown is a third closed figure having a common point.
[0183] Exemplarily, for any cutting boundary information, if there is an intersection point in the third closed figure included in the current subset corresponding to the cutting boundary information, the intersecting third closed figure can be split based on the intersection information of the intersection point to obtain at least two fourth closed figures after the split, and the boundary type corresponding to the intersecting third closed figure is used as the boundary type of the corresponding fourth closed figure after the split. The cutting boundary information updated by the current subset is obtained according to the fourth closed figure without common points, the boundary type corresponding to the fourth closed figure without common points, the third closed figure without common points, and the boundary type corresponding to the third closed figure without common points. The cutting boundary information (cutting boundary information) of the cutting plane can be determined based on the cutting boundary information updated by the current subset, and the cutting boundary information of the cutting plane can be cut based on the cutting boundary information of the cutting plane to generate a target cutting mesh. After the segmentation is completed, the common points of the polygons after the move are replaced with the original vertices, and the unreasonable triangles obtained after the common points are moved can be deleted to improve the accuracy of mesh segmentation.
[0184] In this embodiment, if at least two third closed figures have common points, the at least two third closed figures can be split based on the position information of the common points to obtain a fourth closed figure without common points, and the boundary type corresponding to the third closed figures with common points is used as the boundary type of the fourth closed figures without common points. In this way, the cutting boundary information of the current subset is updated to avoid grid cutting failure caused by grid cutting based on the third closed figures with common points, improve the success rate of cutting the grid to be cut, and at the same time improve the accuracy of the cutting boundary information, thereby improving the accuracy of cutting the grid to be cut and the accuracy of the target cutting grid generated after cutting.
[0185] In one embodiment, generating a cropped target cropping grid corresponding to the to-be-cropped grid includes:
[0186] Using the position information of the common point, merging at least two fourth closed figures to obtain a merged third closed figure;
[0187] According to the merged third closed figures and the third closed figures not containing a common point, a grid cutting surface is formed after the cutting grid is cut;
[0188] Generate a target cutting grid based on the grid cutting surface.
[0189] The mesh cutting plane may be a sectioning plane of the mesh to be cut, and the sectioning plane refers to a cross section obtained after the cutting plane cuts (cuts) the mesh to be cut.
[0190] Exemplarily, the grid to be cut can be cut according to a preset grid cutting mode based on the updated cutting boundary information to obtain an initial cutting plane of the grid to be cut. The fourth closed figures corresponding to the common points can be merged using the position information of the common points to obtain a third closed figure with the common points after merging. Based on the third closed figure with the common point after merging, and each third closed figure that does not contain the common point, the initial cutting plane is updated to obtain an updated cutting plane (grid cutting plane). Further, based on the updated cutting plane (grid cutting plane), a target cutting grid can be generated. In this way, the cutting plane obtained after cutting the grid to be cut is updated to obtain a cutting plane that conforms to the actual situation, thereby improving the accuracy of the target cutting grid generated by cutting.
[0191] In this embodiment, at least two fourth closed figures are merged using the position information of the common point, and a grid cutting surface is formed after the cutting grid is cut according to the merged third closed figure and each third closed figure that does not contain the common point; and a target cutting grid is generated based on the grid cutting surface. In this way, the accuracy of the target cutting grid generated by cutting can be improved.
[0192] In one embodiment, obtaining a closed graph set according to a plurality of first closed graphs includes:
[0193] Obtaining self-intersecting figures and self-intersecting points of the self-intersecting figures from a plurality of first closed figures;
[0194] Based on the self-intersection points, the self-intersecting graph is split to obtain at least two non-self-intersecting sub-closed graphs;
[0195] Non-self-intersecting figures other than self-intersecting figures and sub-closed figures among the plurality of first closed figures are taken as second closed figures to form a closed figure set.
[0196] Among them, a self-intersecting figure can be a closed figure with a self-intersection point; a self-intersection point can be a self-intersection point, and a self-intersection point can be a vertex that intersects inside the closed figure itself, such as Fig. 9As shown, P2 and P6 can both be used as intersection points (self-intersection points). A sub-closed figure refers to a closed figure obtained by splitting a self-intersecting figure based on self-intersection points. For example, Fig. 9 As shown, based on P2 and P6, the self-intersecting graph is split to obtain sub-closed graphs P1P2P3P4, sub-closed graphs P2P5P6P7, and sub-closed graphs P2P6P8P10. A non-self-intersecting graph can be a first closed graph without self-intersection points. It can be understood that a sub-closed graph is also a non-self-intersecting graph.
[0197] Exemplarily, from a plurality of first closed figures, a self-intersecting figure with a self-intersecting point is obtained, and the self-intersecting point of the self-intersecting figure is obtained. The self-intersecting figure is split based on the self-intersecting point to obtain at least two non-self-intersecting sub-closed figures, and the self-intersecting point can be used as a vertex for splitting. The non-self-intersecting first closed figure and the non-self-intersecting sub-closed figure are used as second closed figures to obtain multiple second closed figures to form a closed figure set.
[0198] In the specific implementation process, when the input mesh to be cut is a closed mesh that is not a two-dimensional manifold, the target cutting line segments obtained after cutting may have more than two segments sharing a vertex, which will lead to the existence of self-intersection points in the polygons of the final section, which may cause the failure of triangulation. In view of this situation, a simple polygon self-intersection point detection and splitting method is added in the process of loop closure to ensure that the final combined polygons are simple polygons without self-intersection points, which increases the adaptability of the algorithm.
[0199] For example, if the first closed figure has a self-intersection point, that is, a vertex appears more than twice in the polygon sequence of the first closed figure. Take the polygon sequence as a cyclic sequence, and start traversing from a self-intersection point in the polygon sequence as the starting point until the next time the self-intersection point is encountered as the starting point. The vertex traversed is an independent sub-polygon, and so on, until all vertices are traversed and return to the starting point to end the traversal. It is worth noting that there may still be other self-intersection points inside the split sub-polygon. Repeat the above process and continue to split the sub-polygon until all the sub-polygons finally obtained have no self-intersection points; where the polygon sequence refers to the sequence formed by the vertices of the polygon.
[0200] like Fig. 9As shown in the figure, a first closed figure including three rhombus polygons is shown, and the middle polygon has common points P2 and P6 with the polygons on both sides respectively. In the process of splicing the target cutting line segments to form polygons, the three rhombus polygons can form a first closed figure with self-intersection points, and one possible vertex order is P1-P2-P5-P6-P8-P9-P10-P6-P7-P2-P3-P4. At this time, according to the polygon splitting method proposed above, vertices P2 and P6 are determined as self-intersection points. The P2 connection point can be disconnected, that is, two polygons P2-P5-P6-P8-P9-P10-P6-P7 and P2-P3-P4-P1 are formed. The former also has a self-intersection point P6, and repeated operations cause the polygon to be split into two polygons P6-P8-P9-P10 and P6-P7-P2-P5.
[0201] In the specific implementation process, the polygon sequence can also be a non-circular sequence. The method for splitting self-intersecting polygons can be similar to the method of using the polygon sequence as a circular sequence. If the polygon sequence is a non-circular sequence, when the point traverses to the end point of the polygon sequence, it should continue to traverse from the starting point of the polygon sequence.
[0202] In this embodiment, by splitting the self-intersecting graphs to obtain sub-closed graphs without self-intersection points, and taking the non-self-intersecting first closed graphs and the non-self-intersecting sub-closed graphs as the second closed graphs, a plurality of second closed graphs are obtained to form a closed graph set, which can improve the success rate of cutting the grid, ensure that the final combined polygons are simple polygons without self-intersection points, and increase the adaptability of the grid cutting scene. At the same time, it can improve the accuracy of generating the target cutting grid.
[0203] In one embodiment, the number of cutting planes is multiple;
[0204] Get multiple target cutting line segments, including:
[0205] Obtain multiple cutting line segments formed by the triangular face and multiple cutting planes, as well as the plane position relationship of each cutting plane;
[0206] According to the planar position relationship of the cutting plane and the multiple cutting line segments, multiple target cutting line segments are obtained.
[0207] The multiple cutting line segments may be initial cutting line segments, and the target cutting line segments may be obtained by screening the initial cutting line segments. The target cutting line segments may be line segments used to determine cutting information of the cutting plane.
[0208] The plane position relationship may be a relative relationship between a plurality of cutting planes. For example, the plane position relationship may be that the planes intersect or are parallel.
[0209] For example, the planar position relationship between multiple cutting planes can be determined to determine whether they are parallel or intersecting, and in the case of intersecting planes, it can be determined whether the intersecting line segments of the intersecting cutting planes pass through the grid to be cut. The cutting line segments formed by the triangular face and each cutting plane are obtained to obtain multiple cutting line segments. Furthermore, based on the planar position relationship of the cutting planes, the multiple cutting line segments can be screened, and the cutting line segments that meet the screening conditions are used as target cutting line segments.
[0210] In the specific implementation process, a mesh cutting method with an arbitrary number of cutting planes is proposed. When cutting meshes on multiple cutting planes, there is no need to cut the meshes serially (cutting multiple times, using one cutting plane each time, and the result of each cutting is used as the input for the next cutting). Instead, the cutting operations of the mesh to be cut and multiple planes are performed simultaneously. While ensuring the running speed, the problem of instability caused by mesh degradation in multiple operations is avoided.
[0211] In this embodiment, in the case where multiple cutting planes are used to cut the to-be-cut mesh, the target cutting line segments and the cutting line segments formed by the triangular facets can be screened based on the plane position relationship between the multiple cutting planes to obtain the target cutting line segments, which can improve the accuracy of the target cutting line segments, thereby improving the accuracy of determining the cutting boundary information, and further improving the accuracy of the target cutting mesh after cutting. At the same time, the to-be-cut mesh can be cut based on multiple cutting planes at the same time, which improves the efficiency of mesh cutting.
[0212] In one embodiment, the plane position relationship of the cutting planes includes a first position relationship; the first position relationship indicates that the multiple cutting planes are parallel, or the multiple cutting planes intersect and the plane intersection lines of the multiple cutting planes do not pass through the grid to be cut;
[0213] According to the planar position relationship of the cutting plane and the multiple cutting line segments, multiple target cutting line segments are obtained, including:
[0214] If the plane position relationship of the cutting planes is the first position relationship, the cutting line segments in the preset vector directions of the plurality of cutting planes are taken as target cutting line segments.
[0215] Among them, the first positional relationship can be used to characterize that multiple cutting planes are parallel, or multiple cutting planes intersect and the plane intersection lines of multiple cutting planes do not pass through the grid to be cut; the plane intersection lines can be the intersection straight lines or intersection line segments of the cutting planes that intersect; passing through the grid to be cut can mean that part of the line segments or all of the line segments of the plane intersection lines are in the grid to be cut. The intersection of multiple cutting planes can be that some cutting planes intersect, some cutting planes are parallel, or they can be two-to-two cutting planes intersect; for example, the intersection of multiple cutting planes can be that one of the cutting planes intersects with the other cutting planes, and the other cutting planes are parallel; for example, cutting plane M intersects with cutting planes N, L, and P respectively, and cutting plane N is parallel to cutting planes L and P. In this case, it can be regarded as the intersection of multiple cutting planes; the plane intersection lines are the three intersection lines between cutting plane M and cutting planes N, L, and P respectively.
[0216] Exemplarily, the preset vector direction may be the normal vector direction of the cutting plane, and the normal vector direction refers to the direction of the normal vector of the cutting plane. If the plane position relationships between the intersecting cutting planes are all first position relationships, the cutting line segments in the normal vector directions of the plurality of cutting planes may be used as target cutting line segments.
[0217] For example, the first positional relationship can be used to characterize Fig.10 The cutting planes shown in (a) are parallel to each other and can be used to characterize Fig.10 The clipping plane intersection line shown in (b) does not pass through the mesh.
[0218] In this embodiment, by determining whether the planar position relationship between the intersecting cutting planes is a first position relationship, if it is the first position relationship, the target cutting line segment is obtained according to the cutting line segments of the preset vector directions of the multiple cutting planes. In this way, the accuracy of the target cutting line segment can be improved, thereby improving the accuracy of the target cutting grid after cutting. Moreover, when the planar position relationship of the cutting planes is the first position relationship, multiple cutting planes can be used to cut the grid to be cut at the same time, solving the problem of low efficiency of cutting the grid to be cut by cutting planes one by one, thereby improving the efficiency of cutting the grid to be cut by multiple cutting planes.
[0219] In one embodiment, the plane position relationship of the cutting planes includes a second position relationship; the second position relationship represents that a plurality of cutting planes intersect and the plane intersection lines of the plurality of cutting planes pass through the grid to be cut;
[0220] According to the planar position relationship of the cutting plane and the multiple cutting line segments, multiple target cutting line segments are obtained, including:
[0221] When the planar position relationship of the cutting planes is the second position relationship, a plurality of intersecting line segments formed by the intersection of the triangular face of the mesh to be cut and the plurality of cutting planes are obtained, and a side line sub-segment of the triangular face is obtained; the side line sub-segment is obtained according to the intersection of the triangular face and the plurality of intersecting line segments;
[0222] According to the intersection relationship of the multiple intersecting line segments, the intersecting sub-line segments corresponding to the multiple intersecting line segments are obtained;
[0223] Intersecting sub-line segments in the preset vector directions of multiple cutting planes and edge sub-line segments in the preset vector directions of multiple cutting planes are used as target sub-line segments to form multiple target cutting line segments.
[0224] The second positional relationship can be used to represent that multiple cutting planes intersect, and the plane intersection lines of the multiple cutting planes pass through the grid to be cut. For example, the second positional relationship can be used to represent Fig.10 The cut grid intersection line shown in (c) passes through the grid.
[0225] Among them, the intersecting line segments can be the line segments obtained by the intersection of the triangle patch and the cutting plane. For example, if there are three cutting planes, the three cutting planes can intersect with the triangle patch to obtain three intersecting line segments. The edge sub-segment refers to the sub-segment formed by the edge of the triangle patch and the intersecting line segment. The intersecting line segment can split the edge of the triangle patch into edge sub-segments. For example, an intersecting line segment can split an edge of the triangle patch into two edge sub-segments. The intersection relationship of the intersecting line segments refers to the intersection relationship of the intersection of the intersecting line segments in the triangle patch. The intersecting sub-segments can be the sub-segments obtained by splitting the intersecting line segments from each other. For example, if the intersecting sub-segment A intersects with the intersecting sub-segment B, the intersecting sub-segment A can split the intersecting sub-segment B into two intersecting sub-segments, and the intersecting sub-segment B can split the intersecting sub-segment A into two intersecting sub-segments.
[0226] Exemplarily, if the planar position relationship between the intersecting cutting planes is the second position relationship, then the triangular facets of the to-be-cut mesh intersecting with the multiple cutting planes may be obtained to form corresponding multiple intersecting line segments. And according to the intersection of the multiple intersecting line segments with the edges of the triangular facets, the edge line sub-segments of the triangular facets are obtained. According to the intersection relationship between the multiple intersecting line segments, the intersecting sub-segments corresponding to each intersecting line segment may be obtained. The intersecting sub-segments that are simultaneously in the preset vector direction of multiple cutting planes, and the edge line sub-segments that are simultaneously in the preset vector direction of multiple cutting planes may be used as target sub-segments; for example, the intersecting sub-segments in the normal vector direction of cutting plane A and in the normal vector direction of cutting plane B, and the edge line sub-segments in the normal vector direction of cutting plane A and in the normal vector direction of cutting plane B may be used as target sub-segments, that is, the target sub-segments need to simultaneously satisfy the preset vector direction of each cutting plane. Based on the multiple target sub-segments, multiple target cutting line segments may be formed.
[0227] In this embodiment, when the planar position relationship of the cutting planes is the second position relationship, the sub-line segments (including intersecting sub-line segments and edge sub-line segments) that meet the preset vector directions of multiple cutting planes are used as target cutting line segments. In this way, the accuracy of the target cutting line segments can be improved, thereby improving the accuracy of the target cutting grid after cutting. In addition, when the planar position relationship of the cutting planes is the second position relationship, multiple cutting planes can be used to cut the grid to be cut at the same time, solving the problem of low efficiency of cutting the grid to be cut by cutting planes one by one, thereby improving the efficiency of cutting the grid to be cut by multiple cutting planes.
[0228] In a specific embodiment, if a triangular facet does not intersect any clipping plane, the triangular facets located in the positive direction of all clipping planes (positive direction of normal vector) are saved. If a triangular facet intersects a single clipping plane, if the triangular facet is located on the positive side of the normal vector of other clipping planes, the triangular facet is split, and the triangular facets located in the positive direction of all clipping planes are saved, and the clipping line segments formed by the triangular facets and the clipping planes are saved.
[0229] If a triangle intersects with multiple clipping planes, it is necessary to retain the areas in the triangle that are in the positive direction of each clipping plane and triangulate these areas. The boundaries of the areas to be retained are the edges of the original triangles, the intersection segments of the triangles and the clipping planes, and their edge sub-segments. Fig.11 As shown, a triangular face P1-P2-P3 intersects with three clipping planes Plane1, Plane2, and Plane3 to form P 1a -P 1b , P 2a -P 2b and P3a -P 3b Three intersecting line segments, where P 1a -P 1b With P 2a -P 2b Intersect at point P 12 , P 2a -P 2b and P 3a -P 3b Intersect at P 23 , and P 1a -P 1b and P 3a -P 3b No intersection. These intersection points split the intersecting line segment into multiple intersecting sub-line segments, determine whether each intersecting sub-line segment is in the positive direction of each cutting plane, and retain the intersecting sub-line segments P that are all in the positive direction of the cutting plane. 12 -P 23 , P 23 -P 3b , P 12 -P 1b Then the edges of the original triangle are shrunk. The line segments P1-P2 and P2-P3 and any of their edge line sub-segments are not located in the positive direction of the three planes at the same time. The edge line sub-segment P in P1-P3 1b -P 3b If it is in the positive direction of three planes at the same time, the edge sub-segment is retained. According to the retained intersecting sub-segments and edge sub-segments, the target cutting segment is obtained, and the loop can be closed according to the target cutting segment. For example, according to P 12 -P 23 -P 3b -P 1b -P 12 Close the loop to form a quadrilateral P 12 -P 23 -P 3b -P 1b .
[0230] Since the intersecting line segments between the positive cutting planes of each cutting plane are shared by multiple cutting planes, the intersecting line segments will inevitably be located on multiple closed loops, that is, there is a situation where the endpoints are located on an odd number of target cutting line segments, which will lead to loop closure failure. To avoid this problem, the target cutting line segments located on each cutting plane should be loop closed separately.
[0231] In this embodiment, if a triangular face intersects with multiple cutting planes, the target cutting line segments are obtained through the sub-line segments formed between the cutting planes and the sub-line segments formed between the cutting planes and the triangular facets, thereby improving the accuracy of the target cutting line segments and thus improving the accuracy of the target cutting mesh after cutting.
[0232] In one embodiment, after generating the cropped target cropping grid corresponding to the to-be-cropped grid, the method includes:
[0233] In response to an optimization processing instruction for a target cutting grid, obtaining each vertex of the target cutting grid;
[0234] Get the number of connected vertices between each vertex of the target clipping grid and the preset number of target connected vertices;
[0235] Get the average difference between the number of connected vertices and the number of target connected vertices;
[0236] When the difference average value is greater than a preset difference threshold, the target cropping grid is subjected to a mesh regeneration process.
[0237] The target cutting grid may be a grid generated after cutting the grid to be cut. The optimization processing instruction may be an instruction for optimizing the target cutting grid. The optimization processing instruction may be an instruction pre-set and saved before cutting the grid to be cut. The optimization processing instruction may also be an instruction initiated by a user to optimize the target cutting grid after the target cutting grid is generated. Each vertex of the target cutting grid may be a boundary vertex of the target cutting grid or an internal vertex of the target cutting grid. The internal vertex may be a vertex inside the grid that does not intersect with the boundary and can be used to describe the internal structure of the grid. The number of connected vertices may be the number of connections with a certain vertex. The target number of connected vertices may be the optimal number of connected vertices. The optimal number of connected vertices may be used to characterize that the vertices of the grid are considered to be regular vertices under the condition of the number of connected vertices. The difference average value may be the difference between the average value of the number of connected vertices between each vertex and the target number of connected vertices. The difference average value may be calculated by standard deviation, variance, mean absolute deviation, etc. The difference threshold may be a threshold pre-set for comparing the difference average value.
[0238] Exemplarily, in response to an instruction initiated by a user at a terminal to perform optimization processing on a newly generated target cropping mesh, the number of connected vertices corresponding to each boundary vertex of the target cropping mesh and the number of connected vertices corresponding to each internal vertex of the target cropping mesh are obtained, and the average value of the difference between the number of connected vertices corresponding to the boundary vertices and a preset optimal number of vertex connections, as well as the average value of the difference between the number of connected vertices corresponding to the internal vertices and the preset optimal number of vertex connections are calculated respectively, and the difference average values are compared with preset difference thresholds respectively. If the difference average values are all greater than the difference threshold, the target cropping mesh can be re-meshed based on a mesh regeneration (Remesh) method of local operations.
[0239] For example, the user can specify whether to perform mesh optimization on the newly generated target cutting mesh. If target cutting mesh optimization is required, the triangular network of the target cutting mesh formed by the subdivision can be evaluated in terms of vertex regularity, triangle anisotropy, etc., and the target cutting mesh optimization without changing the boundary edges can be performed for the target cutting mesh that does not meet the requirements. Generally, when the number of connected vertices of the boundary vertices of the target cutting mesh is 4, it is considered a regular vertex, and when the number of connected vertices of the internal vertices is 6, it is considered a regular vertex. Usually, the average difference between each vertex and the optimal number of connected vertices is calculated and compared with a preset threshold. When the average difference is greater than the threshold, the target cutting mesh is optimized. The anisotropy of the triangle can be judged by the maximum and minimum angles and the aspect ratio. The calculation result is compared with the anisotropy threshold. If it is not within the threshold range, the target cutting mesh optimization operation is performed. In order to quickly perform the target cutting mesh optimization operation, the target cutting mesh regeneration (Remesh) method based on local operation can be directly adopted.
[0240] In this embodiment, in response to an optimization processing instruction for a target cut mesh, when the average difference between the number of connected vertices and the target number of connected vertices is greater than a preset difference threshold, mesh regeneration processing is performed on the target cut mesh, which can improve the accuracy of mesh cutting and thus improve the accuracy of the newly generated mesh.
[0241] In one embodiment, obtaining the relative position relationship between a plurality of second closed figures in the closed figure set includes:
[0242] Obtain a current closed figure and a current vertex of the current closed figure from multiple closed figures;
[0243] Obtain candidate closed figures; the candidate closed figures are closed figures other than the current closed figure among multiple closed figures;
[0244] A target ray starting from the current vertex is obtained; and the relative position relationship between the current closed figure and each candidate closed figure is obtained according to the number of intersections between the target ray and the candidate closed figures.
[0245] The current closed figure can be any one of the multiple closed figures. The current vertex can be any vertex in the current closed figure. The candidate closed figure can be any closed figure in the multiple closed figures except the current closed figure. The target ray refers to the ray starting from the current vertex. The number of intersections refers to the number of times the target ray intersects with the candidate closed figure, and the number of intersections can be represented by the number of intersections between the target ray and the candidate closed figure. The relative position relationship can be an inclusion relationship or a non-inclusion relationship, and the non-inclusion relationship can be a separation relationship.
[0246] Exemplarily, any one of the multiple closed figures can be used as the current closed figure, that is, for any closed figure, the method provided in this embodiment can be applied to obtain the relative position relationship between the closed figure and other closed figures. Any vertex of the current closed figure can be obtained, and the target ray can be obtained with the vertex as the starting point, and the number of intersections between the target ray and the candidate closed figure can be determined. According to the number of intersections, the relative position relationship between the current closed figure and the candidate closed figure is determined.
[0247] Optionally, for a mesh, the polygons obtained after cutting generally only contain two relationships: separation and inclusion. Separation means that the two polygons have no common area, and inclusion means that the two polygons contain a common area. This embodiment can adopt an efficient and accurate method for determining the relative position of polygons: first, select any vertex from polygon A to determine the positional relationship between the vertex and polygon B. If the vertex is on the boundary of polygon B, select another vertex from polygon A for determination until any vertex Pa is inside or outside polygon B, and save the positional relationship; then select any vertex from polygon B to determine the positional relationship between the vertex and polygon A. If the vertex is on the boundary of polygon A, select another vertex from polygon B for determination until a vertex Pb is inside or outside polygon A, and save the positional relationship. Finally, if Pa is outside polygon B and point Pb is outside polygon A, the two polygons are in a separation state; if Pa is outside polygon B and point Pb is inside polygon A, polygon B is inside polygon A; if Pa is inside polygon B and point Pb is outside polygon A, polygon A is inside polygon B. Among them, the ray method can be used to determine the positional relationship between vertices and polygons, which can efficiently and robustly determine the relative positional relationship of closed figures.
[0248] In this embodiment, by using the target ray with the current vertex as the starting point, the relative position relationship between the current closed figure and each candidate closed figure is obtained according to the number of intersections between the target ray and the candidate closed figures. The relative position relationship between each closed figure can be effectively judged, so that the cutting information of the cutting surface can be accurately obtained, thereby improving the accuracy of the target cutting grid.
[0249] In a specific embodiment, the relative position relationship between a plurality of vertices of a polygon (second closed figure) and another polygon (second closed figure) can be determined, and the relative position relationship results obtained by different vertices can be voted to obtain the final relative position relationship between the polygons. For example, the relative position relationship corresponding to the vertex with the most votes in the voting result can be subtracted as the relative position relationship between the polygons. In this way, the robustness of determining the relative position relationship between the plurality of second closed figures can be further enhanced, thereby improving the robustness of cutting the mesh.
[0250] In one embodiment, a plurality of target cutting line segments are spliced to form a plurality of first closed figures each including the plurality of target cutting line segments, including:
[0251] From multiple target cutting line segments, obtain the current cutting line segment and the current endpoint of the current cutting line segment; the current endpoint is any endpoint of the current cutting line segment;
[0252] Obtain a target cutting segment with the current endpoint as the endpoint, and based on the current endpoint, splice the current cutting segment and the target cutting segment;
[0253] The target cutting line segment is used as the updated current cutting line segment, and the process returns to the step of obtaining the current endpoint of the current cutting line segment until a first closed figure is formed.
[0254] The current cutting line segment may be any one of the target cutting line segments, and the current endpoint may be any endpoint of the current cutting line segment.
[0255] Exemplarily, based on any endpoint of any target cutting line segment as a base point, other target cutting line segments with the base point as endpoints can be obtained, and two target cutting line segments with the base point can be spliced to obtain a spliced target cutting line segment. The spliced target cutting line segment can be used as a new target cutting line segment, and the splicing steps are repeated according to the above method until a first closed figure is formed.
[0256] Optionally, the process of splicing discrete target cutting line segments into a first closed figure follows the principle that adjacent edges of a polygon have common vertices. Starting from a vertex of any target cutting line segment, connect another target cutting line segment having the vertex, and then connect the new target cutting line segment from another vertex of the next target cutting line segment. Repeat this process until a closed figure (first closed figure) can be formed, and the discrete target cutting line segments can be connected into a single or multiple first closed figures. If a vertex is on the vertex of more than two target cutting line segments, arbitrarily select a non-current target cutting line segment for connection, and the connected target cutting line segment will no longer participate in subsequent connections. The non-current target cutting line segment refers to the target cutting line segment that has not been connected.
[0257] In this embodiment, a target cutting line segment with the current endpoint as the endpoint is obtained, and based on the current endpoint, the current cutting line segment and the target cutting line segment are spliced; the target cutting line segment is used as the updated current cutting line segment, and the step of obtaining the current endpoint of the current cutting line segment is returned until a first closed figure is formed. The first closed figure can be effectively obtained, so that the cutting information of the cutting surface can be accurately obtained, thereby improving the accuracy of the target cutting grid.
[0258] In one embodiment, Fig.12 As shown, a grid cutting method is provided, comprising:
[0259] S601, the user sets the grid to be cut and the cutting plane.
[0260] S602, the user sets personalized parameter settings for the cutting process.
[0261] The process takes as input the mesh to be clipped and the position and normal of the clipping plane to be clipped, and specifies the output data type, the priority of the algorithm efficiency and the mesh quality. In the case of quality priority, the mesh optimization threshold is specified. If no custom parameters are specified, the default values are used.
[0262] The output data type supports the meshes on both sides of the cutting plane, the cutting surface mesh formed by the cutting plane and the original mesh (the mesh to be cut), the contour formed by the cutting plane and the original mesh, and the combination of the above data. When the default value is used, the combination of the mesh on the positive side of the cutting plane and the cutting surface mesh is output, and the default subdivision algorithm uses the ear cutting method.
[0263] S603, establishing a set of points, lines, and triangle patches, and confirming whether the grid to be cut is closed.
[0264] S604, edge operation, adding information related to the relative position of the cutting plane in the edge unit, and further saving the intersection point if the line segment intersects the cutting plane.
[0265] S605, face operation, traversing each triangle face, retaining the triangle face located in the positive direction of the cutting plane, and for the triangle face intersecting with the cutting plane, retaining the area located in the positive direction of the cutting plane and dividing it; outputting the target cutting line segment.
[0266] S606, the loop is closed, and a first closed graph is obtained.
[0267] S607, determine whether the grid to be cut is a closed grid. If yes, execute S08; if no, execute S15.
[0268] S608: construct a polygon tree according to the relative position relationship between the second closed figures.
[0269] S609: split the polygon tree according to the relative position relationship between the third closed figures.
[0270] S610, output multiple groups of polygon sets.
[0271] S611, judging the user's requirements for speed and quality. If the requirement is speed, then executing S12; if the requirement is quality, then executing S13.
[0272] S612, earcut method to obtain a new generated mesh
[0273] S613, using the advancing front triangulation method to obtain a newly generated mesh.
[0274] S614, Grid Evaluation and Optimization.
[0275] S615, combined triangulation network according to user customization needs
[0276] S616, output the result of cutting the grid.
[0277] In this embodiment, the implementation solution for solving the problem provided may correspond to the implementation solutions recorded in the above-mentioned methods, and the technical solution provided in this embodiment may be interpreted according to the methods in the above-mentioned embodiments, so as to improve the accuracy of cutting the grid to be cut.
[0278] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0279] Based on the same inventive concept, the embodiment of the present application also provides a grid cutting device for implementing the grid cutting method involved above. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above method, so the specific limitations in one or more grid cutting device embodiments provided below can refer to the limitations of the grid cutting method above, and will not be repeated here.
[0280] In one embodiment, Fig.13 As shown, a grid cutting device 700 is provided, comprising: a cutting line segment splicing module 710, a graphic set acquisition module 720, a position relationship acquisition module 730, a boundary information acquisition module 740 and a cutting processing module 750, wherein:
[0281] The cutting line segment splicing module 710 is used to obtain multiple target cutting line segments and splice the multiple target cutting line segments to form multiple first closed figures that respectively contain multiple target cutting line segments; the multiple target cutting line segments are formed with the cutting plane according to the multiple triangular facets contained in the grid to be cut; the cutting plane is used to cut the grid to be cut.
[0282] The graphic set acquisition module 720 is used to obtain a closed graphic set according to a plurality of first closed graphics.
[0283] The position relationship acquisition module 730 is used to acquire the relative position relationship between multiple second closed figures in the closed figure set.
[0284] The boundary information acquisition module 740 is used to divide the closed figure set into subsets based on the relative position relationship between multiple second closed figures, and for each subset, obtain the cutting boundary information corresponding to each subset according to the relative position relationship between each third closed figure included in each subset.
[0285] The cutting processing module 750 is used to perform cutting processing on the to-be-cut grid according to the cutting boundary information, and generate a cut target cutting grid corresponding to the to-be-cut grid.
[0286] In one embodiment, the relative position relationship includes a containment relationship. The boundary information acquisition module includes a target closed graph determination unit, a target containment graph determination unit and a subset formation unit.
[0287] The target closed figure determination unit is used to obtain at least one target closed figure from the closed figures included in the closed figure set according to the inclusion relationship between each second closed figure in the closed figure set; the target closed figure is a closed figure in the closed figure set that is not included by any second closed figure other than itself. The target included figure determination unit is used to obtain the closed figures respectively included in each target closed figure according to the inclusion relationship between each second closed figure in the closed figure set. The subset formation unit is used to form subsets corresponding to each target closed figure according to each target closed figure and the second closed figures respectively included in each target closed figure.
[0288] In one embodiment, the boundary information acquisition module includes a current subset unit, a boundary type determination unit, and a cropping boundary information determination unit.
[0289] The current subset unit is used to obtain the inclusion relationship between each third closed figure included in the current subset; the current subset is any subset. The boundary type determination unit is used to determine the boundary type corresponding to each third closed figure included in the current subset according to the inclusion relationship between each third closed figure; the boundary type is used to characterize the type of the cutting boundary of the grid to be cut. The cutting boundary information determination unit is used to use each third closed figure included in the current subset and the boundary type corresponding to each third closed figure as the cutting boundary information of the current subset.
[0290] In one embodiment, the boundary type determination unit includes a relationship tree establishment unit, a level determination unit, and a current level type unit.
[0291] The relationship tree establishment unit is used to establish a closed graph relationship tree based on the inclusion relationship between each third closed graph included in the current subset. The level determination unit is used to obtain the current closed graph and the current level of the current closed graph in the closed graph relationship tree from each third closed graph included in the current subset. The current level type unit is used to obtain the boundary type corresponding to the current level, and use the boundary type corresponding to the current level as the boundary type corresponding to the current closed graph.
[0292] In one embodiment, the current level type cells include odd-numbered layer cells and even-numbered layer cells.
[0293] The odd-numbered layer unit is used to set the boundary type corresponding to the current layer to the solid boundary type when the current layer is an odd-numbered layer in the closed graphic relationship tree. The even-numbered layer unit is used to set the boundary type corresponding to the current layer to the hole boundary type when the current layer is an even-numbered layer in the closed graphic relationship tree.
[0294] In one embodiment, the cutting processing module includes a current boundary information unit, a current boundary corresponding graphic unit and a non-common point unit.
[0295] The current boundary information unit is used to obtain the current cutting boundary information from the cutting boundary information; the current cutting boundary information is the cutting boundary information corresponding to the current subset. The current boundary corresponding graphics unit is used to obtain the third closed graphics contained in the current subset corresponding to the current cutting boundary information. The non-common point unit is used to perform cutting processing on the to-be-cut grid according to the current cutting boundary information if there is no common point between the third closed graphics contained in the current subset.
[0296] In one embodiment, the cutting processing module further includes a common point unit, a third closed figure splitting unit, a cutting boundary information updating unit and an updating cutting process.
[0297] The common point unit is used to obtain the position information of the common point if at least two third closed figures have a common point among the third closed figures included in the current subset corresponding to the current cutting boundary information. The third closed figure splitting unit is used to split the at least two third closed figures based on the position information of the common point to obtain at least two fourth closed figures after splitting, and use the boundary type corresponding to the at least two third closed figures as the boundary type corresponding to the at least two fourth closed figures. The cutting boundary information updating unit is used to form updated cutting boundary information according to the at least two fourth closed figures, the boundary type corresponding to the at least two fourth closed figures, the third closed figures that do not contain the common point, and the boundary type corresponding to the third closed figures that do not contain the common point. The updating cutting process is used to perform cutting processing on the grid to be cut according to the updated cutting boundary information.
[0298] In one embodiment, the cutting processing module further includes a merging processing unit, a grid cutting surface determining unit and a target grid generating unit.
[0299] The merging processing unit is used to merge at least two fourth closed figures using the position information of the common point to obtain a merged third closed figure. The grid cutting surface determination unit is used to form a grid cutting surface after the cutting grid is cut according to the merged third closed figure and each third closed figure that does not contain the common point. The target grid generation unit is used to generate a target cutting grid based on the grid cutting surface.
[0300] In one embodiment, the graphic set acquisition module includes a self-intersecting graphic acquisition unit, a self-intersecting point splitting unit and a second closed graphic unit.
[0301] The self-intersecting graph acquisition unit is used to acquire self-intersecting graphs and self-intersecting points of the self-intersecting graphs from the plurality of first closed graphs. The self-intersecting point splitting unit is used to split the self-intersecting graphs based on the self-intersecting points to obtain at least two non-self-intersecting sub-closed graphs. The second closed graph unit is used to use the non-self-intersecting graphs other than the self-intersecting graphs and the sub-closed graphs in the plurality of first closed graphs as second closed graphs to form a closed graph set.
[0302] In one embodiment, there are multiple cutting planes. The cutting line segment splicing module includes a plane position relationship determination unit and a target cutting line segment determination unit.
[0303] The plane position relationship determination unit is used to obtain multiple cutting line segments formed by the triangular facet and multiple cutting planes, and the plane position relationship of each cutting plane. The target cutting line segment determination unit is used to obtain multiple target cutting line segments according to the plane position relationship of the cutting planes and the multiple cutting line segments.
[0304] In one embodiment, the planar positional relationship of the cutting planes includes a first positional relationship; the first positional relationship indicates that the multiple cutting planes are parallel, or the multiple cutting planes intersect and the planar intersection lines of the multiple cutting planes do not pass through the grid to be cut.
[0305] The target cutting line segment determination unit includes a first position relationship unit. The first position relationship unit is used to take the cutting line segments in the preset vector directions of the plurality of cutting planes as the target cutting line segments if the plane position relationship of the cutting planes is the first position relationship.
[0306] In one embodiment, the planar positional relationship of the cutting planes includes a second positional relationship; the second positional relationship represents that a plurality of cutting planes intersect and the planar intersection lines of the plurality of cutting planes pass through the to-be-cut grid.
[0307] The target cutting line segment determining unit includes a second position relationship unit, an intersecting sub-line segment acquiring unit and a target sub-line segment determining unit.
[0308] The second position relationship unit is used to obtain multiple intersecting line segments formed by the intersection of the triangular facets of the mesh to be cut and the multiple cutting planes, and to obtain the edge sub-segments of the triangular facets when the plane position relationship of the cutting planes is the second position relationship; the edge sub-segments are obtained according to the intersection of the triangular facets and the multiple intersecting line segments. The intersecting sub-segment acquisition unit is used to obtain the intersecting sub-segments corresponding to the multiple intersecting line segments according to the intersection relationship of the multiple intersecting line segments. The target sub-segment determination unit is used to use the intersecting sub-segments in the preset vector direction of the multiple cutting planes and the edge sub-segments in the preset vector direction of the multiple cutting planes as target sub-segments to form multiple target cutting line segments.
[0309] In one embodiment, the device further includes an optimization processing instruction response module, a connection vertex number acquisition unit, a difference average value acquisition unit and a difference average value judgment unit.
[0310] The optimization processing instruction response module is used to respond to the optimization processing instruction for the target cutting mesh and obtain each vertex of the target cutting mesh. The connection vertex number acquisition unit is used to obtain the number of connection vertices between each vertex of the target cutting mesh and the preset target number of connection vertices. The difference average value acquisition unit is used to obtain the difference average value between the number of connection vertices and the target number of connection vertices. The difference average value judgment unit is used to perform mesh regeneration processing on the target cutting mesh when the difference average value is greater than a preset difference threshold.
[0311] In one embodiment, the position relationship acquisition module includes a current vertex determination unit, a candidate closed figure acquisition unit and a target ray unit.
[0312] The current vertex determination unit is used to obtain the current closed figure and the current vertex of the current closed figure from multiple closed figures. The candidate closed figure acquisition unit is used to obtain candidate closed figures; the candidate closed figure is a closed figure other than the current closed figure among the multiple closed figures. The target ray unit is used to obtain the target ray starting from the current vertex; and according to the number of intersections between the target ray and the candidate closed figure, the relative position relationship between the current closed figure and each candidate closed figure is obtained.
[0313] In one embodiment, the cutting line segment splicing module includes a current cutting line segment acquiring unit, a current endpoint splicing unit and an iterative splicing unit.
[0314] The current cutting line segment acquisition unit is used to acquire the current cutting line segment from multiple target cutting line segments, and acquire the current endpoint of the current cutting line segment; the current endpoint is any endpoint of the current cutting line segment. The current endpoint splicing unit is used to acquire the target cutting line segment with the current endpoint as the endpoint, and splice the current cutting line segment and the target cutting line segment based on the current endpoint. The iterative splicing unit is used to use the target cutting line segment as the updated current cutting line segment, and return to the step of acquiring the current endpoint of the current cutting line segment until the first closed figure is formed.
[0315] Each module in the above-mentioned grid cutting device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each module above.
[0316] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig.14 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store the grids to be cut and the cutting planes. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a grid cutting method is implemented.
[0317] Those skilled in the art will understand that Fig.14 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0318] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
[0319] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0320] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0321] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0322] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0323] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A grid cutting method, characterized in that: The method comprises: Acquire multiple target cutting line segments, and splice the multiple target cutting line segments to form multiple first closed figures respectively including the multiple target cutting line segments; the multiple target cutting line segments are formed with a cutting plane according to multiple triangular facets included in the grid to be cut; the cutting plane is used to cut the grid to be cut; Obtaining a closed figure set according to the plurality of first closed figures; Acquire the relative position relationship between a plurality of second closed figures in the closed figure set; Based on the relative positional relationship between the plurality of second closed figures, subsets are divided from the closed figure set, and for each subset, according to the relative positional relationship between the third closed figures included in each subset, clipping boundary information corresponding to each subset is acquired; The to-be-cut grid is cut according to the cutting boundary information to generate a cut target cutting grid corresponding to the to-be-cut grid.
2. The method according to claim 1, characterized in that The relative position relationship includes a containment relationship; The step of dividing the closed figure set into a subset based on the relative positional relationship between the plurality of second closed figures comprises: According to the inclusion relationship between each second closed figure in the closed figure set, at least one target closed figure is obtained from the closed figures included in the closed figure set; the target closed figure is a closed figure in the closed figure set that is not included in any second closed figure other than itself; According to the inclusion relationship between each second closed figure in the closed figure set, the closed figures respectively included in each of the target closed figures are obtained; According to each of the target closed figures and the second closed figures respectively included in each of the target closed figures, subsets corresponding to each of the target closed figures are formed.
3. The method according to claim 2, characterized in that The step of acquiring, for each subset, the clipping boundary information corresponding to each subset according to the relative position relationship between the third closed figures included in each subset, includes: Obtaining the inclusion relationship between each third closed graph contained in the current subset; the current subset is any subset; Determining, according to the inclusion relationship between the third closed figures, the boundary type corresponding to each third closed figure included in the current subset; the boundary type is used to characterize the type of the cutting boundary of the grid to be cut; Each third closed figure included in the current subset and the boundary type corresponding to each third closed figure are used as the cutting boundary information of the current subset.
4. The method according to claim 3, characterized in that The step of determining the boundary type corresponding to each third closed figure included in the current subset according to the inclusion relationship between the third closed figures includes: Establishing a closed graph relationship tree based on the inclusion relationship between each third closed graph included in the current subset; Acquire a current closed graph and a current level of the current closed graph in the closed graph relationship tree from each third closed graph included in the current subset; The boundary type corresponding to the current level is obtained, and the boundary type corresponding to the current level is used as the boundary type corresponding to the current closed figure.
5. The method according to claim 4, characterized in that The obtaining of the boundary type corresponding to the current level includes: When the current level is an odd-numbered level in the closed graphical relationship tree, setting the boundary type corresponding to the current level to a physical boundary type; When the current level is an even-numbered level in the closed graphic relationship tree, the boundary type corresponding to the current level is set to a hole boundary type.
6. The method according to claim 3, characterized in that The step of performing a cutting process on the to-be-cut grid according to the cutting boundary information includes: Acquire current cropping boundary information from the cropping boundary information; the current cropping boundary information is the cropping boundary information corresponding to the current subset; Obtaining each third closed figure included in the current subset corresponding to the current clipping boundary information; If there is no common point between the third closed figures included in the current subset, the grid to be cut is cut according to the current cutting boundary information.
7. The method according to claim 6, characterized in that After obtaining each third closed figure included in the current subset corresponding to the current cutting boundary information, the method further includes: If at least two of the third closed figures included in the current subset corresponding to the current clipping boundary information have a common point, obtaining position information of the common point; Based on the position information of the common point, the at least two third closed figures are split to obtain at least two fourth closed figures after the splitting, and the boundary types corresponding to the at least two third closed figures are used as the boundary types corresponding to the at least two fourth closed figures; forming updated cropping boundary information according to the at least two fourth closed figures, the boundary types corresponding to the at least two fourth closed figures, the third closed figures not containing a common point, and the boundary types corresponding to the third closed figures not containing a common point; The grid to be cut is cut according to the updated cutting boundary information.
8. The method according to claim 7, characterized in that The step of generating a cropped target cropping grid corresponding to the to-be-cropped grid includes: Using the position information of the common point, merging the at least two fourth closed figures to obtain a merged third closed figure; According to the merged third closed figures and the third closed figures not containing a common point, forming a grid cutting surface after cutting the cutting grid; Based on the grid cutting surface, the target cutting grid is generated.
9. The method according to claim 1, characterized in that: The step of obtaining a closed graph set according to the plurality of first closed graphs comprises: Acquire self-intersecting figures and self-intersecting points of the self-intersecting figures from the plurality of first closed figures; Based on the self-intersection points, the self-intersecting graph is split to obtain at least two non-self-intersecting sub-closed graphs; The non-self-intersecting figures other than the self-intersecting figures among the plurality of first closed figures and the sub-closed figures are used as the second closed figures to form the closed figure set.
10. The method according to any one of claims 1 to 9, characterized in that: The number of the cutting planes is multiple; The obtaining of multiple target cutting line segments includes: Acquire a plurality of cutting line segments formed by the triangular face and a plurality of cutting planes, and a planar position relationship between the cutting planes; The plurality of target cutting line segments are obtained according to the planar position relationship of the cutting plane and the plurality of cutting line segments.
11. The method according to claim 10, characterized in that The planar position relationship of the cutting planes includes a first position relationship; the first position relationship indicates that the multiple cutting planes are parallel, or the multiple cutting planes intersect and the plane intersection lines of the multiple cutting planes do not pass through the grid to be cut; The obtaining of the plurality of target cutting line segments according to the planar position relationship of the cutting plane and the plurality of cutting line segments comprises: If the plane position relationship of the cutting planes is the first position relationship, the cutting line segments in the preset vector directions of the plurality of cutting planes are taken as target cutting line segments.
12. The method according to claim 10, characterized in that The planar position relationship of the cutting planes includes a second position relationship; the second position relationship represents that the multiple cutting planes intersect and the plane intersection lines of the multiple cutting planes pass through the grid to be cut; The obtaining of the plurality of target cutting line segments according to the planar position relationship of the cutting plane and the plurality of cutting line segments comprises: When the planar position relationship of the cutting planes is the second position relationship, a plurality of intersecting line segments formed by the intersection of the triangular face of the to-be-cut mesh and the plurality of cutting planes are obtained, and a side line sub-segment of the triangular face is obtained; the side line sub-segment is obtained by intersecting the triangular face with the plurality of intersecting line segments; According to the intersection relationship of the plurality of intersecting line segments, obtaining the intersecting sub-line segments corresponding to the plurality of intersecting line segments; Intersecting sub-line segments in the preset vector directions of the plurality of cutting planes and edge sub-line segments in the preset vector directions of the plurality of cutting planes are taken as target sub-line segments to form the plurality of target cutting line segments.
13. The method according to any one of claims 1 to 9, characterized in that: After the target cut grid after cutting corresponding to the cut grid is generated, the method includes: In response to an optimization processing instruction for the target cutting grid, acquiring each vertex of the target cutting grid; Obtaining the number of connected vertices between each vertex of the target clipping grid and a preset number of target connected vertices; Obtaining an average value of the difference between the number of connected vertices and the number of target connected vertices; When the difference average value is greater than a preset difference threshold, mesh regeneration processing is performed on the target cutting mesh.
14. The method according to claim 1, characterized in that The obtaining of the relative positional relationship between the plurality of second closed figures in the closed figure set comprises: Acquire a current closed figure and a current vertex of the current closed figure from the multiple closed figures; Acquire a candidate closed figure; the candidate closed figure is a closed figure other than the current closed figure among the multiple closed figures; A target ray starting from the current vertex is obtained; and a relative position relationship between the current closed figure and each of the candidate closed figures is obtained according to the number of intersections between the target ray and the candidate closed figures.
15. The method according to any one of claims 1 to 9, characterized in that: The step of splicing the plurality of target cutting line segments to form a plurality of first closed figures each including the plurality of target cutting line segments comprises: Acquire a current cutting line segment from the multiple target cutting line segments, and acquire a current endpoint of the current cutting line segment; the current endpoint is any endpoint of the current cutting line segment; Acquire a target cutting line segment with the current endpoint as an endpoint, and splice the current cutting line segment and the target cutting line segment based on the current endpoint; The target cutting line segment is used as the updated current cutting line segment, and the process returns to the step of obtaining the current endpoint of the current cutting line segment until a first closed figure is formed.
16. A grid cutting device, characterized in that: The device comprises: A cutting line segment splicing module, used for acquiring a plurality of target cutting line segments, and splicing the plurality of target cutting line segments to form a plurality of first closed figures respectively including the plurality of target cutting line segments; the plurality of target cutting line segments are formed with a cutting plane according to a plurality of triangular facets included in the mesh to be cut; the cutting plane is used for cutting the mesh to be cut; A graphic set acquisition module, used to obtain a closed graphic set according to the plurality of first closed graphics; A position relationship acquisition module, used to acquire the relative position relationship between a plurality of second closed figures in the closed figure set; a boundary information acquisition module, configured to divide the closed figure set into subsets based on the relative positional relationship between the plurality of second closed figures, and, for each subset, acquire the cutting boundary information corresponding to each subset according to the relative positional relationship between the third closed figures included in each subset; The cutting processing module is used to perform cutting processing on the to-be-cut grid according to the cutting boundary information, and generate a cut target cutting grid corresponding to the to-be-cut grid.
17. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 15 are implemented.
18. A computer-readable storage medium having a computer program stored thereon, 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 15 are implemented.
19. A computer program product comprising a computer program, 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 15 are implemented.
Citation Information
Cited By
Field plant data visual management system based on grid storage architecture
CN119719401A
