CN-121982269-A - Model repairing method and device, electronic equipment and readable storage medium
Abstract
The application provides a model repairing method, a model repairing device, electronic equipment and a readable storage medium. The method comprises the steps of obtaining a geometric body to be repaired in a three-dimensional model, obtaining free edges of the geometric body to be repaired, analyzing the free edges and endpoints, establishing edge connection relations, determining a candidate edge set according to the edge connection relations, enabling two endpoints of the free edges in the candidate edge set to be connected with other free edges, traversing the free edges in the candidate edge set, determining a closed area set, enclosing the free edges in the closed area set into a closed area based on the edge connection relations, generating a shell according to the free edges in the closed area set, and sewing the shell and the geometric body to be repaired to obtain a first geometric body so as to repair the model. The application realizes the automatic repair of the free edge and improves the simulation efficiency.
Inventors
- MOU JIAHONG
- ZHANG DEQIANG
- CHENG XUN
- Ran Keming
- ZHANG SHENGRONG
Assignees
- 深圳泊松软件技术有限公司
Dates
- Publication Date
- 20260505
- Application Date
- 20251203
Claims (10)
- 1. A method of model repair, comprising: Obtaining a geometric body to be repaired in the three-dimensional model; Acquiring a free edge of the geometric body to be repaired; analyzing each free edge and each endpoint, and establishing an edge connection relationship; according to the edge connection relation, determining a candidate edge set, wherein two endpoints of free edges in the candidate edge set are connected with other free edges; traversing the free edges in the candidate edge set to determine a closed area set, wherein the free edges in the closed area set form a closed area based on an edge connection relationship; Generating a shell according to the free edges concentrated in the closed area; and stitching the shell and the geometric body to be repaired to obtain a first geometric body so as to repair the model.
- 2. The method of claim 1, wherein after suturing the shell with the geometry to be repaired, further comprising: If the type of the first geometric body is a sheet body and the first geometric body is an assembly body, the assembly relation of the first geometric body is released, and at least two parts are obtained; performing inter-body stitching on each sheet part to obtain a second geometric body, and recovering the assembly relation of the second geometric body so as to repair the model; If the type of the first geometric body is a sheet body and the first geometric body is not an assembly body, performing inter-body stitching on the first geometric body to obtain a second geometric body so as to repair the model.
- 3. The method of claim 2, wherein after the second geometry is obtained, further comprising: If the type of the second geometric body is a sheet body, performing non-manifold edge inspection on the second geometric body; and if the target non-manifold surface is obtained, deleting the target non-manifold surface, wherein all sides of the target non-manifold surface are non-manifold sides so as to repair the model.
- 4. A method according to any one of claims 1 to 3, wherein said analyzing each of said free edges and end points to establish edge connection relationships comprises: And calculating the distance between the end points of the free edge and the end points of other free edges for each free edge, and if the distance is smaller than a preset threshold value, establishing the association relation between the end points of the free edge and the end points of other free edges so as to obtain the edge connection relation.
- 5. The method according to claim 4, wherein for each free edge, calculating a distance between an endpoint of the free edge and an endpoint of another free edge, and if the distance is smaller than a preset threshold, establishing an association relationship between the endpoint of the free edge and the endpoint of the other free edge, so as to obtain the edge connection relationship, including: repeating the following steps until all the free edges are traversed, and obtaining the edge connection relation: calculating a first distance between the starting point of a first free edge and the starting points of other free edges, wherein the first free edge is a free edge currently traversed in the free edges of the geometric body to be repaired; if the first distance is smaller than or equal to a preset threshold value, writing the first free edge and the other free edges into a starting point mapping table; if the first distance is greater than the preset threshold value, calculating a second distance between the starting point of the first free edge and the ending points of the other free edges; if the second distance is smaller than or equal to the preset threshold value, writing the first free edge into the starting point mapping table and writing the other free edges into an end point mapping table; if the second distance is greater than the preset threshold value, calculating a third distance between the end point of the first free edge and the starting point of the other free edges; If the third distance is smaller than or equal to the preset threshold value, writing the first free edge into the end mapping table, and writing the other free edges into the start mapping table; If the third distance is greater than the preset threshold, calculating a fourth distance between the end point of the first free edge and the end points of the other free edges; if the fourth distance is smaller than or equal to the preset threshold value, writing the first free edge and the other free edges into the end point mapping table, and acquiring the free edge to be traversed to acquire the first free edge; If the fourth distance is larger than the preset threshold value, acquiring the free edge to be traversed, and acquiring the first free edge; the end points comprise starting points and end points, the edge connection relation comprises a starting point mapping table and an end point mapping table, and each mapping table comprises numbers corresponding to the end points of the free edges and numbers of the free edges connected with the end points.
- 6. The method of claim 4, wherein traversing the free edges in the candidate edge set to determine a closed region set comprises: writing a second free edge into the to-be-closed set, wherein the second free edge is the free edge currently traversed in the candidate edge set; If the number of edges of the to-be-closed set is 1, writing the free edge connected with the second free edge into the to-be-closed set after determining that the free edge connected with the starting point of the first starting point connecting edge and the free edge connected with the end point of the first end point connecting edge belong to the same free edge, so as to obtain the closed area set, wherein the first starting point connecting edge is the free edge connected with the starting point of the second free edge, and the first end point connecting edge is the free edge connected with the end point of the second free edge; If the number of the edges of the to-be-closed set is not 1 or the free edges connected with the starting points of the first starting point connecting edges and the free edges connected with the ending points of the first ending point connecting edges are not the same free edges, writing the first ending point connecting edges into the to-be-closed set; If the second starting point connecting edge is the second free edge or the second ending point connecting edge is the second free edge, the closed area set is obtained, the second starting point connecting edge is the free edge connected with the starting point of the first ending point connecting edge, and the second ending point connecting edge is the free edge connected with the ending point of the first ending point connecting edge; if the second starting point connecting edge is not the second free edge and the second ending point connecting edge is not the second free edge, obtaining the penultimate free edge in the known connecting line; If the last free edge is the second starting point connecting edge, writing the second ending point connecting edge into the set to be closed, traversing the next free edge in the candidate edge set, and returning to the execution step, namely writing the second free edge into the set to be closed; If the last but one free edge is the second end point connecting edge, writing the second end point connecting edge into the set to be closed, traversing the next free edge in the candidate edge set, and returning to the executing step, namely writing the second free edge into the set to be closed.
- 7. The method of claim 6, wherein the acquiring the geometry to be repaired in the three-dimensional model comprises: If the three-dimensional model is detected to have errors, deleting redundant geometric topological data, and legally repairing the three-dimensional model to obtain a processed model; if the geometric body of the sheet body is found in the processed model, setting the type of the geometric body of the sheet body as an entity, and obtaining the geometric body after processing; And if the type of the processed geometry is a sheet body, obtaining the geometry to be repaired of the three-dimensional model.
- 8. A model repair device, comprising: The acquisition module is used for acquiring the geometric body to be repaired in the three-dimensional model; And the free edge of the geometric body to be repaired is acquired; the establishing module is used for analyzing each free edge and each endpoint and establishing an edge connection relation; The determining module is used for determining a candidate edge set according to the edge connection relation, and two endpoints of the free edge in the candidate edge set are connected with other free edges; The method is also used for traversing the free edges in the candidate edge set to determine a closed area set, and the free edges in the closed area set form a closed area based on an edge connection relationship; The restoration module is used for generating a shell according to the free edges concentrated in the closed area; and the shell is also used for stitching the shell and the geometric body to be repaired to obtain a first geometric body so as to repair the model.
- 9. An electronic device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the method of any one of claims 1 to 7 when the computer program is executed.
- 10. A computer readable storage medium storing a computer program, characterized in that the computer program when executed by a processor implements the method according to any one of claims 1 to 7.
Description
Model repairing method and device, electronic equipment and readable storage medium Technical Field The application belongs to the technical field of three-dimensional models, and particularly relates to a model repairing method, a device, electronic equipment and a readable storage medium. Background At present, after modeling is completed in geometric modeling software, the conditions of semantic information loss and precision loss may occur when a file is exported. Under the scene of subsequent import, when the detail realization difference exists between the geometric engine of the current software and the geometric engine of the original software, the imported geometric body is converted into a sheet body from a solid body, and the problem of motion multi-body simulation cannot be performed. The existing method is to manually repair the free edge of the geometric body with problems so as to enable normal simulation, but the simulation efficiency is low. Disclosure of Invention The embodiment of the application provides a model repairing method, a device, electronic equipment and a readable storage medium, which can solve the problem of low simulation efficiency caused by manual repairing of free edges. In a first aspect, an embodiment of the present application provides a model repairing method, including: Obtaining a geometric body to be repaired in the three-dimensional model; Acquiring a free edge of the geometric body to be repaired; analyzing each free edge and each endpoint, and establishing an edge connection relationship; according to the edge connection relation, determining a candidate edge set, wherein two endpoints of free edges in the candidate edge set are connected with other free edges; traversing the free edges in the candidate edge set to determine a closed area set, wherein the free edges in the closed area set form a closed area based on an edge connection relationship; Generating a shell according to the free edges concentrated in the closed area; and stitching the shell and the geometric body to be repaired to obtain a first geometric body so as to repair the model. In a second aspect, an embodiment of the present application provides a model repairing apparatus, including: The acquisition module is used for acquiring the geometric body to be repaired in the three-dimensional model; And the free edge of the geometric body to be repaired is acquired; the establishing module is used for analyzing each free edge and each endpoint and establishing an edge connection relation; The determining module is used for determining a candidate edge set according to the edge connection relation, and two endpoints of the free edge in the candidate edge set are connected with other free edges; The method is also used for traversing the free edges in the candidate edge set to determine a closed area set, and the free edges in the closed area set form a closed area based on an edge connection relationship; The restoration module is used for generating a shell according to the free edges concentrated in the closed area; and the shell is also used for stitching the shell and the geometric body to be repaired to obtain a first geometric body so as to repair the model. In a third aspect, an embodiment of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, the processor implementing the method according to any one of the first aspects when executing the computer program. In a fourth aspect, embodiments of the present application provide a computer readable storage medium storing a computer program which, when executed by a processor, implements a method as in any of the first aspects above. In a fifth aspect, embodiments of the present application provide a computer program product for, when run on an electronic device, causing the electronic device to perform the method of any one of the first aspects. Compared with the prior art, the embodiment of the application has the beneficial effects that: Analyzing each free edge and end points, establishing an edge connection relationship, and providing a foundation for repairing the free edge; The method comprises the steps of determining a candidate edge set according to an edge connection relation, traversing the free edges in the candidate edge set to determine a closed area set, enclosing the free edges in the closed area set into a closed area based on the edge connection relation, accurately obtaining the free edges capable of being connected to form the closed area, generating a shell according to the free edges in the closed area set, stitching the shell and a to-be-repaired geometry to obtain a first geometry, realizing automatic repair of the free edges, and improving simulation efficiency. It will be appreciated that the advantages of the second to fifth aspects may be found in the relevant description of the first aspect, and are not des