3D model network topology repair methods and electronic devices

By constructing the mapping information and twin relationship information of the 3D model and adopting a parallel processing flow, the problem of low efficiency in the topology repair of 3D mesh models in the prior art is solved. This achieves efficient and accurate non-manifold vertex repair and manifold topology transformation, improving the speed and stability of 3D mesh processing.

CN122312962APending Publication Date: 2026-06-30ZG TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
ZG TECH CO LTD
Filing Date
2026-03-26
Publication Date
2026-06-30

AI Technical Summary

Technical Problem

In existing technologies, topology repair methods for 3D mesh models are limited by the serial graph traversal paradigm and non-parallel-friendly data structures, resulting in the inability to effectively utilize multi-core hardware resources and problems such as large thread synchronization overhead, irregular memory access, and uncertain repair logic.

Method used

By constructing the first mapping information, second mapping information, and twin relationship information of the 3D model, non-manifold vertices are identified and repaired. A parallel processing flow is adopted, including constructing the association information between mesh faces and half edges, vertices and half edges, and half edges and twin half edges, so as to realize the transformation of non-manifold topology into manifold topology.

Benefits of technology

It significantly improves the efficiency of topology construction, accurately identifies non-manifold vertices and counts the number of sectors, ensures that the repair effect conforms to the topological characteristics of the 3D mesh, improves the overall speed and stability of mesh topology repair, and provides reliable topological data support for subsequent processing tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122312962A_ABST
    Figure CN122312962A_ABST
Patent Text Reader

Abstract

This application provides a method and electronic device for network topology repair of a 3D model. The method includes: constructing a first mapping information containing mesh faces and corresponding halves based on 3D model mesh data; determining a second mapping information containing each vertex and its corresponding half based on this; then combining the first two to determine the twin relationship information of each half; next, identifying non-manifold vertices based on the three types of information and counting their sector counts; and finally, completing the repair of non-manifold vertices based on the sector count and the second mapping information. By constructing multi-layer mapping information, a complete topology data system is built. Each step supports parallel processing. It accurately identifies non-manifold vertices based on topological features and achieves targeted repair based on the sector count. While ensuring repair accuracy, it significantly improves the efficiency of mesh topology repair and provides stable topology data support for subsequent mesh processing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and more specifically, to a method for repairing network topology using a three-dimensional model and an electronic device. Background Technology

[0002] Three-dimensional mesh models are susceptible to noise and outliers, and the original models often contain topological defects such as non-manifold edges and vertices. These defects not only hinder vertex-based mesh processing tasks but also prevent the model from clearly defining its internal and external spaces, making subsequent numerical calculations difficult to perform accurately. Therefore, constructing a topologically safe and complete mesh model is a fundamental prerequisite for subsequent high-precision applications.

[0003] Existing mesh topology repair techniques primarily rely on traditional mesh data structures and sequential processing methods. These methods typically require traversing the vertices, edges, and faces of the mesh sequentially to construct connectivity relationships, and then identifying and repairing topological errors. This approach generally relies on sequential search and stepwise adjustment, checking the connectivity of local neighborhoods to determine the existence of non-manifold structures, and then performing operations such as merging, deleting, or splitting to correct them.

[0004] However, in real-time industrial inspection scenarios involving large-scale 3D mesh data, existing technologies are limited by the serial graph traversal paradigm and non-parallel-friendly data structures, resulting in the mesh topology repair process being unable to effectively utilize multi-core hardware resources. This leads to problems such as high thread synchronization overhead, irregular memory access, and uncertain repair logic. Summary of the Invention

[0005] The purpose of this application is to address the shortcomings of the prior art by providing a network topology repair method and electronic device for three-dimensional models. This addresses the problems in the prior art, which are limited by the serial graph traversal paradigm and non-parallel-friendly data structures, resulting in the inability to effectively utilize multi-core hardware resources in the mesh topology repair process, and the existence of large thread synchronization overhead, irregular memory access, and uncertain repair logic.

[0006] To achieve the above objectives, the technical solution adopted in this application is as follows: In a first aspect, this application provides a method for repairing the network topology of a three-dimensional model, the method comprising: Based on the mesh data of the 3D model, a first mapping information of the 3D model is constructed. The first mapping information includes: multiple mesh faces of the 3D model and multiple half-edges corresponding to each mesh face. Each half-edge is generated based on the vertex connection relationship of the mesh face. Based on the first mapping information of the three-dimensional model, the second mapping information of the three-dimensional model is determined, and the second mapping information includes: each vertex of the three-dimensional model and the half-side corresponding to each vertex; Based on the first mapping information and the second mapping information, the twin relationship information of each half of the three-dimensional model is determined. The twin relationship information includes: half of the model and twin half of the model. The twin half of the model and the half of the model are connected to the same pair of vertices but in opposite directions. Based on the first mapping information, the second mapping information, and the twin relationship information, at least one non-manifold vertex and the number of sectors for each non-manifold vertex are determined; Based on the number of sectors of each non-manifold vertex and the second mapping information, each non-manifold vertex in the 3D model is repaired.

[0007] Secondly, embodiments of this application also provide an electronic device, including: a processor, a storage medium, and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the storage medium via the bus, and the processor executes the machine-readable instructions to perform the steps of a network topology repair method for a three-dimensional model as described in any one of the first aspects.

[0008] The beneficial effects of this application are as follows: By constructing the association information between mesh faces and half-edges, vertices and half-edges, and half-edges and twin half-edges step by step, complete data information of the 3D model mesh topology is built. Each information construction step supports parallelization, significantly improving the efficiency of topology construction. Based on the three types of mapping information, non-manifold vertices can be accurately identified and the number of sectors can be counted with accurate and unbiased results. Finally, by combining the number of sectors and the mapping information between vertices and half-edges, non-manifold vertices are repaired, transforming the non-manifold topology into a manifold topology. The repair logic conforms to the characteristics of 3D mesh topology, ensuring the repair effect. The method of this application is highly parallelized, effectively repairing non-manifold vertices while significantly improving the overall speed of mesh topology repair, providing stable and reliable topology data support for subsequent mesh processing tasks.

[0009] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0010] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0011] Figure 1A flowchart of a network topology repair method for a three-dimensional model provided in an embodiment of this application is shown; Figure 2 A schematic diagram of a mesh surface provided in an embodiment of this application is shown; Figure 3 This application provides a flowchart of obtaining first mapping information according to an embodiment of the present application; Figure 4 This application provides a flowchart of obtaining second mapping information according to an embodiment of the present application; Figure 5 This illustration shows a schematic diagram of a storage data structure provided in an embodiment of this application; Figure 6 This document illustrates a flowchart of an embodiment of obtaining twin relationship information. Figure 7 This document illustrates a flowchart of obtaining non-manifold vertices according to an embodiment of this application. Figure 8 This illustration shows a schematic diagram of a bidirectional loop traversal provided in an embodiment of this application; Figure 9 This illustration shows another schematic diagram of bidirectional loop traversal provided in an embodiment of this application; Figure 10 This document illustrates a flowchart of a non-manifold vertex repair method provided in an embodiment of this application. Figure 11 This document illustrates a flowchart of a non-manifold edge repair method provided in an embodiment of this application. Figure 12 This document illustrates a flowchart of another method for non-manifold edge repair provided in an embodiment of this application. Figure 13 A schematic diagram of the structure of an electronic device provided in an embodiment of this application is shown. Detailed Implementation

[0012] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. The components of the embodiments of this application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely represents selected embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.

[0013] It should be noted that the term "comprising" will be used in the embodiments of this application to indicate the presence of the features declared thereafter, but does not exclude the addition of other features.

[0014] Three-dimensional mesh models are a primary representation of three-dimensional spatial data and are widely used in industrial design, reverse engineering, and many other fields. These models are often generated by methods such as 3D scanning, but they are prone to topological defects such as non-manifold edges and vertices due to noise and outliers. Topology-safe mesh models are the foundation for subsequent mesh processing, and the repaired complete mesh is a prerequisite for numerical calculations such as finite element analysis. Only manifold meshes can guarantee the accuracy of physical simulations.

[0015] Existing mesh topology repair methods, limited by the mesh data structure itself or the topology repair method, struggle to achieve rapid topology repair when faced with large volumes of 3D mesh data. This not only severely hinders the implementation of various downstream mesh processing tasks but also directly affects the task processing efficiency of mesh processing in industrial automation scenarios, failing to provide timely and stable mesh data support for subsequent related operations.

[0016] Based on this, this application proposes a network topology repair method for 3D models. First, a first mapping information containing mesh faces and corresponding half-edges is constructed based on the 3D model mesh data. Then, a second mapping information containing each vertex and its corresponding half-edge is determined based on this. Subsequently, the twin relationship information of each half-edge is determined by combining the first two. Next, non-manifold vertices are identified based on the three types of information, and their sector counts are calculated. Finally, non-manifold vertex repair is completed based on the sector count and the second mapping information. By constructing multi-layer mapping information, a complete topology data system is built. Each step supports parallel processing. Non-manifold vertices are accurately identified by combining topological features, and targeted repair is achieved based on the sector count. While ensuring repair accuracy, this significantly improves the efficiency of mesh topology repair and provides stable topology data support for subsequent mesh processing.

[0017] Next, combine Figure 1 This application describes a method for repairing the network topology of a three-dimensional model. The method can be implemented by an electronic device, such as... Figure 1 As shown, the method includes: S101. Based on the mesh data of the 3D model, construct the first mapping information of the 3D model.

[0018] The first mapping information includes: multiple mesh faces of the 3D model and multiple half-edges corresponding to each mesh face, with each half-edge generated based on the vertex connection relationships of the mesh faces. It should be understood that the first mapping information can store the face indices of the mesh faces and the half-edge indices of the half-edges, allowing the location of the corresponding mesh face and half-edge based on these indices.

[0019] Optionally, mesh data consists of vertices, faces, and edges formed by vertices and faces. A mesh face is the basic building block of a 3D mesh model; it is a closed shape formed by connecting vertices, such as a triangular face. A half-edge is a directed form of an edge; its relationship to directed and undirected graphs is discussed in [reference needed]. Figure 2 Each triangular face can be decomposed into three counterclockwise half-sides, and each half-side corresponds to a fixed and unique face.

[0020] Optionally, the mesh data of the 3D model includes core elements such as vertices and triangular mesh faces. Based on the definition of computer graphics, each triangular mesh face is decomposed in a directed manner, generating three halves in either a counterclockwise or clockwise direction. The generation of the halves follows the vertex connection relationship of the mesh face, ensuring that the direction of the halves is consistent with the connection logic of the vertices. Subsequently, a one-to-one correspondence is established between each mesh face and the multiple halves generated by its decomposition. Each half is stored consecutively in an array according to the arrangement order of its corresponding mesh face, ultimately forming the first mapping information containing the mesh face and its corresponding half.

[0021] It should be noted that there is a strict quantitative relationship between the number of mesh faces Nf and the number of half edges Nhe: Nf = 3 × Nhe. Based on this quantitative relationship, the integrity of the generated half edges can be verified.

[0022] S102. Determine the second mapping information of the three-dimensional model based on the first mapping information of the three-dimensional model.

[0023] The second mapping information is a set of information relating vertices to the radiating halves originating from those vertices. This information includes each vertex of the 3D model and its corresponding half. A half-edge originating from or ending at that vertex is called a radiating half, and the number of half-edges is equal to the number of mesh faces connected to that vertex. The second mapping information can store vertex indices and half-edge indices, allowing for the location of the corresponding vertex and half-edge.

[0024] It should be noted that the core of mesh topology construction is to obtain the connection relationships of vertices, edges, and faces. The construction of the second mapping information is based on the number of faces as the main parallel order. Based on the association relationship between mesh faces, half edges, and vertices in the first mapping information, the degree of each vertex is first calculated, that is, the number of outgoing half edges connected to each vertex. Then, according to the number of outgoing half edges connected to each vertex, the mapping relationship between vertices and outgoing half edges is determined. The half edges starting from each vertex in the first mapping information are associated with the corresponding vertices, and finally the second mapping information containing each vertex and its corresponding half edge is formed. The entire construction process supports parallel computing.

[0025] S103. Based on the first mapping information and the second mapping information, determine the twin relationship information of each half of the three-dimensional model. The twin relationship information includes: half of the model and twin half of the model. The vertices connected to the twin half of the model are the same and opposite in direction.

[0026] Twin relationship information refers to the set of information on the correspondence between each half of a 3D model and its twin half. A twin half is a half that has the same starting and ending vertices as the original half, but points in the opposite direction.

[0027] It is worth noting that since the topological information of a single half-edge cannot meet the requirements of topological traversal of a 3D mesh, it needs to be improved into a bidirectional twin half-edge topology based on the first and second mapping information. This step is executed in parallel order based on the number of half-edges. First, the face index and the indices of the first and last vertices of the half-edge are calculated using the half-edge index in the first mapping information, thus establishing the association between the half-edge and the vertex pair. Combining the mapping relationship between vertices and radiating half-edges in the second mapping information, the half-edge with the same vertex pair connected to the current half-edge but in the opposite direction is found in the radiating half-edge of the last vertex of the current half-edge. This half-edge is the twin half-edge of the current half-edge. Each half-edge and its corresponding twin half-edge are associated and recorded to form twin relationship information containing the half-edge and its corresponding twin half-edge, thus completing the improvement from a single-sided half-edge topology to a bidirectional twin half-edge topology.

[0028] S104. Determine at least one non-manifold vertex and the number of sectors of each non-manifold vertex based on the first mapping information, the second mapping information, and the twin relationship information.

[0029] In this context, a sector refers to a single, continuous closed or open topological region formed by a ring neighborhood of a vertex, and is the basic building block of the local topological structure of a vertex. The number of sectors is the number of independent connected sectors into which a vertex's ring neighborhood is divided.

[0030] A nonmanifold vertex is a vertex in a 3D mesh model whose local neighborhood does not conform to the definition of a 2D manifold. A standard manifold vertex should satisfy the condition that its one-ring neighborhood forms a single, continuous closed or open sector. If a vertex connects two or more unconnected groups of faces, such as two cones intersecting at the vertex, then this vertex is a nonmanifold.

[0031] If vertex v is a non-manifold vertex, then its neighborhood is divided into k independent connected components (k>1), that is: .

[0032] Any two sectors and They are not connected topologically by edges, but share the coordinates of vertex v only in geometric space.

[0033] In one possible implementation, vertices can be used as the parallel master order, implemented through a bidirectional loop traversal strategy. Based on the first and second mapping information and twin relationship information, the outgoing half of each vertex is traversed and access labels are maintained. The access status of each outgoing half is recorded. After all outgoing half is accessed, the number of independent sector traversals of each vertex is recorded. Based on the number of traversals, it is determined whether the vertex is a non-manifold vertex, and finally, the identification of all non-manifold vertices and the corresponding sector count are completed.

[0034] It should be noted that the number of sectors of a non-manifold vertex is generally greater than 1. Based on this characteristic, after visiting all outgoing half-edges, all non-manifold vertices in the 3D model can be counted, and the number of sectors of the non-manifold vertices can be obtained.

[0035] S105. Based on the number of sectors of each non-manifold vertex and the second mapping information, repair each non-manifold vertex in the 3D model.

[0036] Repairing non-manifold vertices in a 3D model refers to the process of transforming the non-manifold topology of non-manifold vertices into a manifold topology.

[0037] In one possible implementation, non-manifold vertices connecting multiple independent sectors can be split into multiple spatially overlapping but logically independent vertices to achieve the repair of each non-manifold vertex in the 3D model.

[0038] This application's embodiments construct the association information between mesh faces and halves, vertices and halves, and halves and twin halves step by step, building complete data information for the 3D model mesh topology. Each information construction step supports parallelization, significantly improving topology construction efficiency. Based on the three types of mapping information, non-manifold vertices can be accurately identified and the number of sectors can be counted, with accurate and unbiased identification results. Finally, combining the number of sectors and the mapping information between vertices and halves, non-manifold vertices are repaired, transforming the non-manifold topology into a manifold topology. The repair logic aligns with the characteristics of 3D mesh topology, ensuring the repair effect. The method of this application is highly parallelized, effectively repairing non-manifold vertices while significantly improving the overall speed of mesh topology repair, providing stable and reliable topology data support for subsequent mesh processing tasks.

[0039] The following is a further explanation of how the first mapping information of the 3D model is constructed based on the mesh data of the 3D model, such as... Figure 3 As shown, the above step S101 includes: S301. Decompose each mesh face of the 3D model to obtain multiple half-sides corresponding to each mesh face.

[0040] The mesh faces of the 3D model are all triangular faces. According to the standard definition of computer graphics, each triangular mesh face is decomposed in a directed manner. For example, three half-edges can be generated in a counterclockwise direction. The generation of half-edges is based on the vertex connection relationship of the mesh face, ensuring that the direction of the half-edge is consistent with the connection logic of the vertices.

[0041] S302. Establish the correspondence between the mesh face and each half, and store each half in the array in the order of the corresponding mesh face to obtain the first mapping information.

[0042] Optionally, the arrangement order of the mesh faces refers to the inherent index order of the mesh faces in their storage array.

[0043] To meet the requirements of parallel processing, after decomposing each mesh face into half-edges, a one-to-one correspondence is first established between each triangular mesh face and its three counter-clockwise half-edges generated from the decomposition, clarifying the mesh face to which each half-edge belongs. Then, all half-edges are stored contiguously according to the order of their corresponding mesh faces in the mesh face storage array. This data is stored in the array, directly associating the storage index of the half-edge with the arrangement index of the mesh face. This enables fast mutual access between mesh faces and half-edges at the arrangement index level, ultimately forming the first mapping information containing the association between mesh faces and their corresponding half-edges.

[0044] This application embodiment decomposes the triangular mesh face counterclockwise according to the rules of computer graphics, which ensures the standardization and integrity of the half-edge generation. The half-edges are stored continuously in the order of the mesh face arrangement and a corresponding relationship is established. The constructed first mapping information realizes the index-level fast access of the mesh face and half-edge, adapts to the requirements of parallel processing, and provides ordered basic data for subsequent topology construction.

[0045] The following is a further explanation of determining the second mapping information of the 3D model based on the first mapping information of the 3D model, such as... Figure 4 As shown, the above step S102 includes: S401. Perform parallel traversal of each mesh face according to the first mapping information to obtain the degree of each vertex in the 3D model. The degree is the number of half-edges starting from the vertex.

[0046] The degree of a vertex refers to the number of radiating halves originating from that vertex (tail vertex), which is equivalent to the number of mesh faces connected to that vertex; parallel traversal refers to a processing method that uses the number of mesh faces as the parallel primary order to simultaneously perform data retrieval and analysis on multiple mesh faces.

[0047] The first mapping information establishes a precise association between the mesh face and the corresponding half-edge, and the half-edge is a directed structure starting from a vertex, with the face storing the arrangement index of its vertices.

[0048] In one possible implementation, the number of mesh faces can be ordered in parallel. All mesh faces in the first mapping information are traversed in parallel. The starting vertex indices of all half-edges corresponding to each mesh face are extracted. The degree of each vertex is obtained by counting the number of times each vertex appears as a starting point.

[0049] Another possible implementation is to use a block-parallel strategy, which divides the mesh face data into blocks according to the number of blocks, and performs vertex index extraction and degree statistics in each block simultaneously, and finally merges the block statistics results; or it can be based on GPU multi-threaded parallelism, which allocates an independent thread to each mesh face to synchronously complete the vertex degree statistics.

[0050] S402. Calculate the prefix sum of the degree of each vertex to obtain the starting offset of each vertex in the one-dimensional array.

[0051] The prefix sum calculation refers to the method of sequentially adding the degrees of the first n vertices in order of vertex index to obtain the cumulative value for each vertex. The starting offset refers to the starting position index of the outgoing half of each vertex in the one-dimensional array, which is used to divide the outgoing half of different vertices into continuous intervals in the array.

[0052] After calculating the vertex degree, in order to store the outgoing half of all vertices compactly in a one-dimensional array, the starting storage position of the outgoing half of each vertex needs to be determined by prefix sum calculation, so that the outgoing half of different vertices do not overlap and have no gaps in the array.

[0053] In one possible implementation, the degrees of the preceding vertices can be accumulated sequentially, starting from the first vertex, according to the global index order. The prefix sum of the current vertex is its starting offset in the one-dimensional array. For example, if vertex 0 has a degree of 3, vertex 1 has a degree of 4, and vertex 2 has a degree of 2, then the offset of vertex 0 is 0, the offset of vertex 1 is 3, and the offset of vertex 2 is 7.

[0054] In another possible implementation, a parallel prefix sum algorithm can be used. The vertex degree array is divided into blocks, and the local prefix sums of each block are calculated in parallel. Then, the global prefix sum is solved through synchronization between blocks, which improves the computational efficiency in scenarios with a large number of vertices. Alternatively, a recursive prefix sum calculation can be used, which continuously divides the vertex array into two parts, calculates the prefix sums of the subarrays separately, and then merges them, making it suitable for distributed computing scenarios.

[0055] S403. Based on the starting offset, map all half-edges starting from vertices in the first mapping information to a continuous interval of a one-dimensional array to obtain the second mapping information.

[0056] In this context, a continuous interval of a one-dimensional array refers to a dedicated storage range in the one-dimensional array determined by the starting offset and degree of a certain vertex. The offset is the starting point of the interval, and the offset plus the degree is the ending point of the interval. This interval only stores the outgoing half of the corresponding vertex.

[0057] The initial offset defines the starting position of the outgoing half of each vertex in the one-dimensional array, while the vertex degree determines the storage length of the outgoing half of that vertex in the array. Together, they define the continuous storage range of the outgoing half of each vertex.

[0058] In the first implementation, the number of mesh faces can be parallel master order. The starting vertex index of each half is extracted from the first mapping information. According to the starting offset of the vertex, the half is stored in its continuous interval in sequence to complete the accurate mapping between the half and the vertex. Finally, the second mapping information containing the relationship between the vertex and the corresponding half is formed, realizing fast mutual access between vertices and half based on array index.

[0059] In the second implementation, a batch mapping strategy can also be adopted, grouping by vertex index, extracting all outgoing half edges of the same vertex in batches, and mapping them to their dedicated continuous intervals at once. Alternatively, a memory mapping method can be used, associating the one-dimensional array with external storage data, and directly mapping the half edge data to the corresponding interval, reducing memory data copying overhead and adapting to ultra-large-scale grid data processing.

[0060] In this embodiment, the degree of vertices is calculated by traversing the mesh face in parallel, which greatly improves the efficiency of degree statistics under large data mesh. The prefix sum calculation accurately determines the storage offset of the vertex emanating half, providing a basis for array storage. Based on the offset, the half is mapped to a continuous interval of a one-dimensional array. The constructed second mapping information realizes fast index-level access between vertices and half, and supports parallel processing throughout, ensuring the parallel efficiency of mesh topology processing and data access speed.

[0061] After constructing and obtaining the first and second mapping information, the mapping relationship represented by the first and second mapping information can be associated and stored to obtain... Figure 5 The data structure shown is as follows. F0 represents a mesh face, which is a triangular face containing three halves, denoted as he0, he1, and he3. Each half has a corresponding vertex. For example... Figure 5 In the equation, half of he0 corresponds to vertex vi, half of he1 corresponds to vertex vj, and half of he2 corresponds to vertex vk.

[0062] The following is a further explanation of how the twin relationship information of each half of the 3D model is determined based on the first and second mapping information. Figure 6 As shown, step S103 above includes: S601. Generate edge key values ​​for each half edge. The edge key values ​​are obtained by unordering the starting vertex index and ending vertex index of the half edge. Two half edges with opposite directions and connected to the same pair of vertices have the same edge key values.

[0063] An edge key value is a unique identifier generated by unordering the start and end vertex indices of an edge. By unordering the start and end vertex indices, the influence of the index order on the key value can be eliminated, ensuring that opposite-direction edges with the same vertex pair generate the same key value. A vertex pair is a combination of the start and end vertices of an edge, used to determine whether two edges are twins.

[0064] Each half-edge has a unique starting vertex index and an ending vertex index, which together form a vertex pair for that half-edge. The core characteristic of twin half-edges is that the vertex pairs are the same but the directions are opposite. Therefore, by unordering the vertex indexes to generate edge key values, a unified identification of half-edges with the same vertex pair but different directions can be achieved.

[0065] For each face Its permutation index in the facet storage array is ,but The corresponding three half-edge indices They are respectively , , Starting vertex index and endpoint vertex index They can be calculated using the following formulas (1)-(3).

[0066] (1) (2) (3) In the first implementation, the starting vertex index and ending vertex index of the half can be extracted, and the two indices can be unordered, such as by taking the combination of index size values ​​or merging after hash operation, to generate the edge key value of the half, ensuring that the edge key values ​​of the same vertex in opposite directions are completely consistent.

[0067] In the second implementation method, a numerical combination method can be used, where the smaller vertex index is used as the high-order bit and the larger index is used as the low-order bit to concatenate and generate the edge key value; a hash algorithm can also be used, where the two vertex indices are used as input and a hash function is used to generate a fixed-length edge key value, which is suitable for scenarios with large index values; a summation and modulo method can also be used, where the two indices are summed and then the modulo of the fixed value is taken to generate the edge key value.

[0068] S602. Sort the edge key values ​​of all half edges in parallel to obtain the sorted half edge sequence.

[0069] Half-edges with the same edge key value are half-edges in different directions that connect the same pair of vertices, i.e., potential twin half-edges. By sorting the edge key values ​​of all half-edges, all potential twin half-edges can be arranged in a cluster adjacent to each other in the sequence, so as to facilitate the rapid matching of twin half-edges in the future.

[0070] Optionally, based on a parallel computing framework, the half-side data can be divided into blocks according to the number of sides. Each block simultaneously performs local sorting on the edge key values, and then merges the sorting results of each block through a merge operation to obtain a globally ordered half-side sequence. The entire process takes the number of sides as the main parallel order and supports parallel processing throughout.

[0071] As another possible implementation, parallel quicksort can be used, which allocates an independent computing unit to each half of the block and executes the partitioning and recursive operations of quicksort synchronously; parallel bucket sort can also be used, which divides the bucket interval according to the range of edge key values, and each bucket processes the sorting of the corresponding half of the block in parallel, which is suitable for scenarios where edge key values ​​are evenly distributed; GPU multi-threaded sort can also be used, which allocates a thread to each half of the block and implements high-speed parallel sorting of edge key values ​​based on shared memory.

[0072] S603. Traverse the sorted half-edge sequence. For the current half-edge, mark the half-edge that is adjacent to the current half-edge and has the same edge key value but opposite direction as the twin half-edge of the current half-edge, and obtain the twin relationship information of the current half-edge.

[0073] In the sorted sequence of half edges, half edges with the same edge key value are distributed adjacently, and only one of them is the half edge with the opposite direction to the current half edge, i.e., a twin half edge. By traversing this ordered sequence, the adjacent half edge with the same edge key value and opposite direction to the current half edge can be quickly located, thus completing the marking and association of twin half edges.

[0074] In this context, "opposite directions of the two halves" means that the starting and ending vertex indices of the two halves are reversed. For example, half A starts at v1 and ends at v2, while half B starts at v2 and ends at v1.

[0075] In one possible implementation, the sorted sequence of half edges can be traversed sequentially. For the current half edge, the half edge with the same edge key value at its adjacent position is retrieved, and it is checked whether the vertex indices of the two half edge are in opposite directions. If the condition is met, the half edge is marked as the twin half edge of the current half edge, and the correspondence between the two half edge is recorded. Finally, twin relationship information containing the twin correspondence of all half edges is formed.

[0076] For example, suppose the half-side index is represented as Then the twin half of one half can be represented as .

[0077] As another possible implementation, a batch traversal method can be used, which traverses the edge key value group by edge, and checks the direction of the half edge group with the same key value in batches and matches the twin half edge to reduce the number of traversals; a two-pointer traversal method can also be used, which sets the first and last pointers for each half edge group with key value, and checks and matches the twin half edge in both directions synchronously to improve the matching efficiency; a pre-filtering traversal method can also be used, which filters out the half edge with unique key value (without twin half edge) before traversing, and only traverses the half edge group with repeated key value to reduce the traversal complexity.

[0078] In this embodiment, edge key values ​​are generated by unordering vertex indexes, which enables accurate identification of twin halves and provides a unified basis for subsequent matching. Parallel sorting of edge key values ​​significantly improves sorting efficiency, making potential twin halves distributed adjacently and simplifying the matching logic. By traversing the ordered sequence to quickly mark twin halves, twin relationship information is efficiently constructed. Parallel processing is supported throughout the process, adapting to the needs of large-scale grid topology construction.

[0079] The following is a further explanation of the determination of at least one non-manifold vertex and the number of sectors for each non-manifold vertex based on the first mapping information, the second mapping information, and the twin relation information. Figure 7 As shown, step S104 above includes: S701. Determine the initial half of each vertex.

[0080] The initial half-edge refers to the first outgoing half-edge to be traversed for each vertex. It is the starting point for vertex sector traversal detection and serves as the seed half-edge for sector traversal.

[0081] In one possible implementation, the first half-edge can be directly selected as the starting outgoing half-edge based on the set of outgoing half-edges corresponding to the vertex, according to the ascending or descending order of the half-edge index; alternatively, an unmarked outgoing half-edge can be randomly selected as the starting outgoing half-edge.

[0082] S702. For the current vertex, perform a bidirectional loop traversal operation starting from the initial outgoing half. The bidirectional loop traversal operation includes: determining the twin half of the current half based on the twin relationship information, and locating the next outgoing half that rotates around the current vertex in the mesh face to which the twin half belongs based on the first mapping information.

[0083] Optionally, starting from the initial outgoing half, the twin half of the current half is found first through the twin relationship information. Then, based on the association between the mesh surface and the half in the first mapping information, the next outgoing half around the current vertex is located in the mesh surface to which the twin half belongs, according to the counterclockwise rotation rule, to complete a single traversal step. At the same time, the same traversal logic is executed in the opposite direction from the initial outgoing half to achieve bidirectional loop traversal and avoid sector misjudgment caused by mesh boundaries during unidirectional traversal.

[0084] As another possible implementation, a synchronous bidirectional traversal method can be adopted, which allocates independent parallel threads for the forward and reverse traversal directions to execute traversal operations synchronously and improve traversal speed. A traversal caching method can be adopted, which temporarily caches the twin half and the next outgoing half information obtained during the traversal process to avoid repeated querying of mapping information and reduce computational overhead. A boundary prediction method can also be adopted, which checks whether the half is a boundary half before traversal and marks the traversal termination condition in advance to improve traversal efficiency.

[0085] S703. Repeat the bidirectional loop traversal operation until returning to the initial outgoing half, forming a closed sector path.

[0086] A closed sector path is a closed loop traversal path that starts from the initial outgoing half, goes through a bidirectional loop, and returns to the initial half. This path corresponds to an independent continuous sector of the vertex.

[0087] A vertex's independent sector corresponds to a set of continuously connected outgoing half edges. A bidirectional loop traversal along this set of half edges eventually returns to the starting outgoing half edge, forming a closed traversal path. During the traversal, the operations of finding twin edges and locating the next outgoing half edge are continuously performed, and visited half edges are marked until the traversal path returns to the starting outgoing half edge, thus completing the construction of a closed sector path. This path constitutes an independent sector of the vertex.

[0088] In another possible implementation, it is also possible to check whether the current half is the starting outgoing half after each traversal step is completed, and to determine in real time whether a closed path is formed; or to mark the starting outgoing half, and to terminate the traversal immediately when the marked half is reached, thus forming a closed sector path; or to predict the sector path length based on the vertex degree, and to check whether to return to the starting half when the predicted length is reached, thereby improving the efficiency of closed path determination.

[0089] S704. If there are still unvisited outgoing half-edges at the current vertex, select a new unvisited outgoing half-edge as the starting point and repeat the bidirectional loop traversal operation until all outgoing half-edges have been visited.

[0090] The visit flag is a state flag added to the outgoing half of a vertex to record whether the half has been traversed.

[0091] The neighborhood of a non-manifold vertex is divided into multiple independent sectors. A single closed sector path covers only the outgoing half of one sector. By using access markers, we can determine whether the vertex still has untraversed outgoing half-sectors. If an untraversed outgoing half-sector exists, it means that the vertex still has unidentified independent sectors. At this point, a new untraversed outgoing half-sector is selected as the new starting point, and the bidirectional loop traversal operation is repeated to construct a new closed sector path. This process continues until all outgoing half-sectors of the vertex have been marked with access markers, completing the traversal and detection of all sectors of the vertex.

[0092] S705. Determine the number of closed sector paths for each vertex. If the number is greater than 1, determine that the current vertex is a non-manifold vertex and use the number as the sector number of the non-manifold vertex.

[0093] The number of sectors is the total number of closed sector paths formed after a vertex undergoes a bidirectional traversal. A standard manifold vertex's one-ring neighborhood consists of a single, continuous closed / open sector, forming only one closed sector path. In contrast, a non-manifold vertex's neighborhood is divided into multiple independent connected components, forming multiple independent closed sector paths. Therefore, by counting the number of closed sector paths for each vertex, if the number is greater than 1, the vertex can be determined as a non-manifold vertex, and this number represents the number of sectors for that non-manifold vertex.

[0094] For a half edge, it can be indexed by the half edge based on the following equations (4) and (5). Quickly obtain the index of its preceding half edge and the next half index : (4) (5) Based on the offset of the vertex outgoing half obtained during the topology construction mentioned above. We iterate through the outgoing half of each vertex and maintain a visit label to record whether each outgoing half has been visited.

[0095] When calculating the independent sector of each vertex, an unvisited outgoing half-edge is first selected as the seed edge. Based on the bidirectional loop traversal method described above, the outgoing half-edge of the vertex is rotated and traversed from both directions until the starting point or grid boundary is encountered, at which point the vertex sector count is incremented by 1. For example... Figure 8 As shown.

[0096] The purpose of bidirectional loop traversal is to eliminate the influence of randomly selecting a seed half on sector detection when boundaries exist. For example... Figure 9 As shown, when there is a boundary, if the selected seed half is not on the boundary, the rotation traversal logic will misjudge the number of sectors, which will lead to the incorrect identification of non-manifold vertices.

[0097] Repeat the bidirectional loop traversal method described above until all outgoing halves of the vertex have been visited. The number of independent traversals is the number of sectors. ,like If the value is greater than 1, it is determined to be a non-manifold vertex.

[0098] In this embodiment, a unified initial benchmark is provided for sector traversal by selecting a starting emanating half for each vertex; bidirectional cyclic traversal is implemented based on the twin relationship and the first mapping information, effectively eliminating the influence of misjudgment of mesh boundaries and accurately restoring the local topology of the vertex; through multiple traversals until all half-edges are visited, all independent sectors of the vertex are fully identified; non-manifold vertices are determined based on the number of closed sector paths, and the number of sectors is counted, with accurate determination results. Furthermore, this application supports parallel operation throughout, significantly improving the identification efficiency of non-manifold vertices.

[0099] The following is a further explanation of the repair of non-manifold vertices in the 3D model based on the number of sectors of each non-manifold vertex and the second mapping information, such as... Figure 10 As shown, step S105 above includes: S1001. Determine the total number of new vertices corresponding to non-manifold vertices based on the number of sectors of the non-manifold vertices.

[0100] Repairing non-manifold vertices is based on a splitting method, requiring the matching of a new vertex for each independent sector except for the original vertex's reserved sector. That is, the number of new vertices for a single non-manifold vertex is its sector count minus 1. Based on this, the sector count of all non-manifold vertices is calculated, and for each non-manifold vertex, the sector count minus 1 is calculated. Then, all results are reduced and summed to obtain the total number of new vertices required for repair.

[0101] S1002. Create new vertex indices and corresponding new vertex data for each sector of each non-manifold vertex based on the total number of newly added vertices. Set the geometric coordinates of the new vertex data to coincide with the geometric coordinates of the non-manifold vertices.

[0102] The new vertex index is a globally unique permutation index assigned to the newly added vertex. The new vertex data refers to all the attribute information of the newly added vertex, including geometric coordinates, and is the basic data for the existence of the new vertex in the 3D mesh.

[0103] The total number of new vertices determines the scale of storage resources that need to be allocated. First, the size of the global vertex array and attribute array is adjusted, adding slots to match the total number of new vertices, reserving storage space for the new vertices. Next, a prefix sum scan is performed on the number of sectors for each non-manifold vertex to determine the global permutation index of the new vertices split from each non-manifold vertex. A unique new vertex index is created for each sector to be split, and the new vertex data is initialized based on this index. The geometric coordinates of the new vertex data are directly copied to the geometric coordinates of the original non-manifold vertices, achieving spatial overlap, and the new vertices are defined independently only in terms of topological logic.

[0104] For each non-manifold vertex, one sector needs to be retained in the original vertex, and the rest... -1 sector needs to be migrated to the new vertex. Total number of newly added vertices. The following equation (6) can be used to calculate the value of each vertex. Perform reduction and summation calculations.

[0105] (6) Adjust the size of the global vertex array and attribute array, and increase... There are [number] slots. At this point, we have obtained the number of newly added vertices, and we need to further use the splitting method to determine the positions of these new vertices. Based on each vertex's [data / structure]... A prefix sum scan is performed to obtain a new vertex permutation index. .

[0106] Let the vertex The index offset is Then the m-th new vertex that splits from that vertex ( The global index of ) is: .

[0107] S1003. Repair each non-manifold vertex based on the new vertex data.

[0108] Repairing non-manifold vertices involves topological separation of the independent sectors of each non-manifold vertex. Based on newly created vertex indices and data, topological reconstruction can be performed on the independent sectors of each non-manifold vertex. This involves establishing topological associations between the remaining sectors (excluding those of the original vertex) and the corresponding new vertices, redirecting the common vertex indices of faces within these sectors to the new vertex indices, ensuring that each independent sector is associated with only one vertex (either the original or the new vertex), and making the 1-ring neighborhood of each vertex a single, continuous sector. Ultimately, the non-manifold topology is transformed into a manifold topology, resulting in the repaired target 3D model.

[0109] This application's embodiments accurately calculate the total number of newly added vertices based on the number of sectors, providing a basis for resource allocation and avoiding memory waste; create a unique index for each new vertex and set geometric coordinates that coincide with the original vertices, ensuring that the mesh geometry remains unchanged while achieving logical independence; and complete the topology reconstruction of non-manifold vertices based on the new vertex data, transforming the non-manifold topology into a manifold topology, resulting in accurate repair effects.

[0110] The process of repairing each non-manifold vertex based on the new vertex data includes: For non-manifold vertices, keep the starting vertex indices of all half edges in the first sector of the non-manifold vertex unchanged, and modify the starting vertex indices of all half edges in the remaining sectors of the non-manifold vertex to the new vertex indices assigned to the sectors.

[0111] The first sector is the first independently connected sector identified through bidirectional traversal when traversing and detecting independent sectors of non-manifold vertices; this sector is reserved for the original non-manifold vertices. The starting vertex index is the globally unique permutation index of a vertex when the half-edge has a certain vertex as its tail vertex (starting point). The remaining sectors are the independent connected sectors of non-manifold vertices identified through bidirectional traversal, excluding the first sector; these are the sectors that need to be mapped to the newly added vertices.

[0112] Non-manifold vertex repair is based on the splitting method, which requires retaining the original vertex in one independent sector and mapping the remaining sectors to the newly added vertex. Selecting the first sector to retain the original vertex index can maintain the basic stability of the original mesh topology and avoid the overall topology association disorder caused by the failure of the original vertex index.

[0113] In one possible implementation, based on the traversal order of non-manifold vertex sector detection, the first sector corresponding to the first identified closed sector path can be locked. All outgoing half-edges within this sector are traversed, keeping the starting vertex indices of these half-edges unchanged from the original non-manifold vertex indices, ensuring the topological association between this sector and the original vertex remains intact. Then, pre-assigned new vertex indices are matched to each of the remaining sectors of the non-manifold vertex. Next, all outgoing half-edges within each sector are traversed, and the original non-manifold vertex starting indices of these half-edges are uniformly modified to the new vertex indices of the corresponding sector, completing the topological association reconstruction between the sector and the newly added vertex.

[0114] When performing network topology repair on a 3D model, it is necessary to repair not only non-manifold vertices but also non-manifold edges, such as... Figure 11 As shown, the method of this application further includes: S1101. Determine the non-manifold edges based on the twin relationship information.

[0115] In a normal topology mesh, each half edge has only one unique twin half edge, and the twin half edge of the twin half edge is the original half edge. However, non-manifold edges, because they connect multiple triangles, may have an anomaly where one half edge corresponds to multiple twin half edges. Based on the twin relationship information, this type of topological anomaly can be identified, and non-manifold edges can be detected.

[0116] In one possible implementation, all half-edges can be traversed based on the twin relationship information, and the matching status of the twin half-edge of each half-edge can be checked. First, the number of successful matchings of the first and last vertices of a single half-edge is determined. If the number of matchings is greater than 1, it means that the half-edge corresponds to a non-manifold edge and is marked as an anomaly. Second, the bidirectional correspondence between the half-edge and its twin half-edge is checked. If the twin half-edge of a twin half-edge is not equal to the current half-edge, it is also determined to be a non-manifold edge and marked as an anomaly. This dual check achieves accurate determination of non-manifold edges.

[0117] S1102. Repair the non-manifold edges according to the first mapping information and the second mapping information.

[0118] Each half-edge corresponds to a unique mesh face. The anomaly of non-manifold edges is that they are associated with too many triangular faces. Therefore, the core of the repair is to remove the abnormal mesh faces associated with non-manifold edges, and then update the mesh topology association based on the first and second mapping information to restore the normal topology structure.

[0119] Optionally, based on the first mapping information, all corresponding mesh faces can be located according to the abnormal label of the half to which the non-manifold edge belongs, and the abnormal faces can be labeled for deletion. Then, the mesh faces with deletion labels are cleared and the face array size is readjusted. Finally, combined with the second mapping information, the topological information such as the relationship between vertices and half edges and the vertex degree is updated to complete the repair of non-manifold edges.

[0120] The following is a further explanation of the repair of non-manifold edges based on the first and second mapping information, such as... Figure 12 As shown, the above step S1102 includes: S1201. Obtain all mesh faces associated with non-manifold edges, and mark the other mesh faces except for the ones to be retained as faces to be deleted.

[0121] Non-manifold edge-associated mesh surfaces refer to all triangular mesh surfaces whose constituent edges are non-manifold edges. Non-manifold edges become topological defects because they connect two or more triangular surfaces. Their associated mesh surfaces include normal surfaces and abnormal surfaces. Retained surfaces are normal mesh surfaces selected from all non-manifold edge-associated mesh surfaces that need to be retained. Surfaces to be deleted are the remaining abnormal mesh surfaces in the non-manifold edge-associated mesh surfaces, excluding the retained surfaces.

[0122] Optionally, the essence of topological defects in non-manifold edges is that a single edge connects multiple triangular mesh faces. The core of repair is to remove redundant associated faces and retain only one valid face to restore the one-to-one topological correspondence between edges. Therefore, based on the unique correspondence between half-edges and mesh faces, we can first retrieve all half-edges to which the non-manifold edge belongs, and then obtain all the corresponding mesh faces through the half-edge index, that is, all the mesh faces associated with the non-manifold edge. From these mesh faces, we can select any one as the retained face and uniformly add a "to be deleted" label to all the remaining mesh faces to complete the marking of abnormal faces.

[0123] S1202. Based on the marking of the face to be deleted, remove the half-edge and mesh face data corresponding to the face to be deleted from the first mapping information, and update the vertex degree and offset in the second mapping information to repair the non-manifold edges.

[0124] The face to be deleted marks clearly identify the abnormal topological units that need to be cleaned up. Since each mesh face corresponds to three unique half-edges, it is necessary to remove the face to be deleted and its corresponding half-edge data simultaneously, and then update the vertex topological parameters that have changed due to data removal to complete the full repair of non-manifold edges.

[0125] Optionally, the mesh face data of the faces to be deleted can be cleared in batches in the first mapping information according to the face markers, and all half-edge data corresponding to these faces can be removed at the same time. The size of the face array and half-edge array can then be readjusted. Then, the change in the number of vertex radiating half-edges caused by the removal of half-edge data can be counted, the degree of the corresponding vertex in the second mapping information can be updated, and the prefix sum can be recalculated based on the updated vertex degree to correct the offset of each vertex. This completes the full update of the second mapping information, restoring the non-manifold edges to a compliant topology.

[0126] This application identifies the targets for cleaning up topological anomalies by obtaining the associated mesh faces of non-manifold edges and marking the faces to be deleted, thus avoiding the retention of invalid data. Simultaneously, it removes the faces to be deleted and their corresponding half-edge data, and updates the vertex degrees and offsets, achieving consistent topological data correction and completely eliminating topological defects in non-manifold edges. The operation process supports parallelization, significantly improving the efficiency of non-manifold edge repair.

[0127] Based on the same inventive concept, this application also provides a network topology repair device for a three-dimensional model corresponding to the network topology repair method for a three-dimensional model. Since the principle of the device in this application is similar to the network topology repair method for a three-dimensional model described above, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be described again.

[0128] The construction module is used to construct the first mapping information of the 3D model based on the mesh data of the 3D model. The first mapping information includes: multiple mesh faces of the 3D model and multiple half edges corresponding to each mesh face. Each half edge is generated based on the vertex connection relationship of the mesh face. The first determining module is used to determine the second mapping information of the three-dimensional model based on the first mapping information of the three-dimensional model. The second mapping information includes: each vertex of the three-dimensional model and the half-side corresponding to each vertex. The second determining module is used to determine the twin relationship information of each half of the three-dimensional model based on the first mapping information and the second mapping information. The twin relationship information includes: half of the model and twin half of the model that is twin of the half of the model. The twin half of the model and the half of the model have the same vertex pair connected to the half of the model and opposite directions. The third determining module is used to determine at least one non-manifold vertex and the number of sectors of each non-manifold vertex based on the first mapping information, the second mapping information and the twin relationship information. The repair module is used to repair each non-manifold vertex in the 3D model based on the number of sectors of each non-manifold vertex and the second mapping information.

[0129] Optionally, the building module is specifically used for: The mesh faces of the 3D model are decomposed to obtain multiple half-sides corresponding to each mesh face; Establish the correspondence between the mesh face and each half, and store each half in an array in the order of the corresponding mesh face to obtain the first mapping information.

[0130] Optionally, the first determining module is specifically used for: Based on the first mapping information, each mesh face is traversed in parallel to obtain the degree of each vertex in the 3D model. The degree is the number of half-edges starting from the vertex. Calculate the prefix sum of the degree of each vertex to obtain the starting offset of each vertex in the one-dimensional array; Based on the starting offset, all half-edges starting from vertices in the first mapping information are mapped to a continuous interval of a one-dimensional array to obtain the second mapping information.

[0131] Optionally, the second determining module is specifically used for: Generate edge key values ​​for each half edge. The edge key values ​​are obtained by unordering the starting vertex index and ending vertex index of the half edge. Two half edges with opposite directions and connecting the same pair of vertices have the same edge key values. Sort the edge key values ​​of all half edges in parallel to obtain the sorted half edge sequence; Traverse the sorted half-edge sequence. For the current half-edge, mark the half-edge that is adjacent to the current half-edge and has the same edge key value but opposite direction as the twin half-edge of the current half-edge, and obtain the twin relationship information of the current half-edge.

[0132] Optionally, the third determining module is specifically used for: Determine the initial half of each vertex; For the current vertex, a bidirectional loop traversal operation is performed starting from the initial outgoing half. The bidirectional loop traversal operation includes: determining the twin half of the current half based on the twin relationship information, and locating the next outgoing half that rotates around the current vertex in the mesh face to which the twin half belongs based on the first mapping information. Repeat the bidirectional loop traversal operation until returning to the initial outgoing half, forming a closed sector path; If there are still unvisited outgoing half edges at the current vertex, select a new unvisited outgoing half edge as the starting point and repeat the bidirectional loop traversal operation until all outgoing half edges have been visited. Determine the number of closed sector paths for each vertex. If the number is greater than 1, then the current vertex is determined to be a non-manifold vertex, and the number is taken as the number of sectors of that non-manifold vertex.

[0133] Optionally, the repair module is specifically used for: The total number of new vertices corresponding to non-manifold vertices is determined based on the number of sectors of the non-manifold vertices. Create new vertex indices and corresponding new vertex data for each sector of each non-manifold vertex based on the total number of newly added vertices. Set the geometric coordinates of the new vertex data to coincide with the geometric coordinates of the non-manifold vertices. Repair each non-manifold vertex based on the new vertex data.

[0134] Optionally, the repair module is specifically used for: For non-manifold vertices, keep the starting vertex indices of all half edges in the first sector of the non-manifold vertex unchanged, and modify the starting vertex indices of all half edges in the remaining sectors of the non-manifold vertex to the new vertex indices assigned to the sectors.

[0135] Optionally, the repair module is also specifically used for: Determine non-manifold edges based on twin relationship information; The non-manifold edges are repaired based on the first and second mapping information.

[0136] Optionally, the repair module is also specifically used for: Get all mesh faces associated with non-manifold edges, and mark the other mesh faces except the ones to be kept as faces to be deleted; Based on the marker of the face to be deleted, remove the half-edge and mesh face data corresponding to the face to be deleted from the first mapping information, and update the vertex degree and offset in the second mapping information to repair non-manifold edges.

[0137] This application's embodiments construct the association information between mesh faces and halves, vertices and halves, and halves and twin halves step by step, building complete data information for the 3D model mesh topology. Each information construction step supports parallelization, significantly improving topology construction efficiency. Based on the three types of mapping information, non-manifold vertices can be accurately identified and the number of sectors can be counted, with accurate and unbiased identification results. Finally, combining the number of sectors and the mapping information between vertices and halves, non-manifold vertices are repaired, transforming the non-manifold topology into a manifold topology. The repair logic aligns with the characteristics of 3D mesh topology, ensuring the repair effect. The method of this application is highly parallelized, effectively repairing non-manifold vertices while significantly improving the overall speed of mesh topology repair, providing stable and reliable topology data support for subsequent mesh processing tasks.

[0138] Figure 13 This illustration shows a schematic diagram of an electronic device provided in an embodiment of this application, including: a processor 1301, a storage medium 1302, and a bus 1303. The storage medium 1302 stores machine-readable instructions executable by the processor 1301. When the electronic device runs a network topology repair method for a three-dimensional model as described in the embodiment, the processor 1301 communicates with the storage medium 1302 via the bus 1303. The processor 1301 executes the machine-readable instructions. The preamble of the method item of the processor 1301 executes the steps in the network topology repair method for the three-dimensional model described above.

[0139] This application also provides a computer-readable storage medium storing a computer program that is executed by a processor, which performs the steps in the network topology repair method for the three-dimensional model described above.

[0140] In this embodiment, the computer program, when run by the processor, can also execute other machine-readable instructions to perform other methods as described in the embodiments. For details on the specific execution steps and principles, please refer to the description of the embodiments, which will not be repeated here.

[0141] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some communication interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms.

[0142] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0143] In addition, the functional units in the embodiments provided in this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0144] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0145] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. In addition, the terms "first", "second", "third", etc. are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.

[0146] Finally, it should be noted that the above-described embodiments are merely specific implementations of this application, used to illustrate the technical solutions of this application, and not to limit them. The protection scope of this application is not limited thereto. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features, within the scope of the technology disclosed in this application; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application. All should be covered within the protection scope of this application. Therefore, the protection scope of this application should be determined by the protection scope of the claims.

Claims

1. A method for repairing network topology in a three-dimensional model, characterized in that, include: Based on the mesh data of the 3D model, a first mapping information of the 3D model is constructed. The first mapping information includes: multiple mesh faces of the 3D model and multiple half-edges corresponding to each mesh face. Each half-edge is generated based on the vertex connection relationship of the mesh face. Based on the first mapping information of the three-dimensional model, the second mapping information of the three-dimensional model is determined, and the second mapping information includes: each vertex of the three-dimensional model and the half-side corresponding to each vertex; Based on the first mapping information and the second mapping information, the twin relationship information of each half of the three-dimensional model is determined. The twin relationship information includes: half of the model and twin half of the model. The twin half of the model and the half of the model are connected to the same pair of vertices but in opposite directions. Based on the first mapping information, the second mapping information, and the twin relationship information, at least one non-manifold vertex and the number of sectors for each non-manifold vertex are determined; Based on the number of sectors of each non-manifold vertex and the second mapping information, each non-manifold vertex in the 3D model is repaired.

2. The method according to claim 1, characterized in that, The step of constructing the first mapping information of the 3D model based on the mesh data of the 3D model includes: The mesh faces of the three-dimensional model are decomposed to obtain multiple half-sides corresponding to each mesh face; Establish the correspondence between the mesh face and each half, and store each half in an array in the order of the corresponding mesh face to obtain the first mapping information.

3. The method according to claim 1, characterized in that, Determining the second mapping information of the three-dimensional model based on the first mapping information of the three-dimensional model includes: Based on the first mapping information, each of the mesh faces is traversed in parallel to obtain the degree of each vertex in the three-dimensional model. The degree is the number of half-edges starting from the vertex. The degree of each vertex is calculated by prefix sum to obtain the starting offset of each vertex in the one-dimensional array; Based on the starting offset, all half-edges in the first mapping information that start from the vertex are mapped to a continuous interval of the one-dimensional array to obtain the second mapping information.

4. The method according to claim 1, characterized in that, The step of determining the twin relationship information of each half of the 3D model based on the first mapping information and the second mapping information includes: For each half-edge, an edge key value is generated. The edge key value is obtained by unordering the starting vertex index and ending vertex index of the half-edge. Two half-edges with opposite directions and connected to the same pair of vertices have the same edge key value. Sort the edge key values ​​of all half edges in parallel to obtain the sorted half edge sequence; After traversing the sorted half-edge sequence, for the current half-edge, mark the half-edge that is adjacent to the current half-edge and has the same edge key value but opposite direction as the twin half-edge of the current half-edge, and obtain the twin relationship information of the current half-edge.

5. The method according to claim 1, characterized in that, The step of determining at least one non-manifold vertex and the number of sectors for each non-manifold vertex based on the first mapping information, the second mapping information, and the twin relationship information includes: Determine the initial half of each vertex; For the current vertex, a bidirectional loop traversal operation is performed starting from the initial outgoing half. The bidirectional loop traversal operation includes: determining the twin half of the current half according to the twin relationship information, and locating the next outgoing half that rotates around the current vertex in the mesh face to which the twin half belongs according to the first mapping information. Repeat the bidirectional loop traversal operation until returning to the initial outgoing half, forming a closed sector path; If there are still unvisited outgoing half edges at the current vertex, select a new unvisited outgoing half edge as the starting point and repeat the bidirectional loop traversal operation until all outgoing half edges have been visited. Determine the number of closed sector paths for each vertex. If the number is greater than 1, then the current vertex is determined to be a non-manifold vertex, and the number is taken as the sector number of the non-manifold vertex.

6. The method according to claim 1, characterized in that, The step of repairing each non-manifold vertex in the 3D model based on the number of sectors of each non-manifold vertex and the second mapping information includes: The total number of new vertices corresponding to the non-manifold vertex is determined based on the number of sectors of the non-manifold vertex. Based on the total number of newly added vertices, create new vertex indices for each sector of each non-manifold vertex and new vertex data corresponding to the new vertex indices, and set the geometric coordinates of the new vertex data to coincide with the geometric coordinates of the non-manifold vertex; Repair each of the non-manifold vertices based on the new vertex data.

7. The method according to claim 6, characterized in that, The repair of each non-manifold vertex based on the new vertex data includes: For the non-manifold vertex, keep the starting vertex indices of all half edges in the first sector of the non-manifold vertex unchanged, and modify the starting vertex indices of all half edges in the remaining sectors of the non-manifold vertex to the new vertex indices assigned to the sectors.

8. The method according to claim 1, characterized in that, The method further includes: The non-manifold edges are determined based on the twin relationship information; The non-manifold edges are repaired based on the first mapping information and the second mapping information.

9. The method according to claim 8, characterized in that, The step of repairing the non-manifold edge based on the first mapping information and the second mapping information includes: Obtain all mesh faces associated with the non-manifold edge, and mark the other mesh faces except the ones to be retained as faces to be deleted; Based on the marker of the face to be deleted, the half-edge and mesh face data corresponding to the face to be deleted are removed from the first mapping information, and the vertex degree and offset in the second mapping information are updated to repair the non-manifold edge.

10. An electronic device, characterized in that, include: The device includes a processor, a storage medium, and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the storage medium via the bus, and the processor executes the machine-readable instructions to perform the steps of a network topology repair method for a three-dimensional model as described in any one of claims 1 to 9.