Model topology detection methods, devices, electronic equipment and storage media
By comparing and analyzing the cyclic edge information of the model, the problems of large data volume and low efficiency in the existing model topology detection technology are solved, and fast and efficient topology difference detection is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NETEASE (HANGZHOU) NETWORK CO LTD
- Filing Date
- 2023-06-28
- Publication Date
- 2026-05-26
AI Technical Summary
In existing technologies, model topology detection requires traversing all faces for inspection, resulting in large data volume and low efficiency.
By acquiring the cyclic edge information of the model and comparing and analyzing the cyclic edge information, the differences in the model's topological structure can be determined.
It enables rapid determination of the location of differences in model topology, reduces the amount of detection data, and improves detection efficiency.
Smart Images

Figure CN116805306B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of 3D modeling technology, and more specifically, to a model topology detection method, device, electronic device, and storage medium. Background Technology
[0002] Topology is a general term used in 3D modeling to reconstruct the points, lines, and surfaces of a model. Planes with the same appearance may have vastly different topological structures. How to quickly determine whether the topological structures of two models are consistent has become a concern in model making.
[0003] In existing technologies, to check the differences in the model before and after modification, it is usually necessary to traverse all the faces of the model, obtain the vertex numbers, serialize the vertex numbers, and then check them using MD5 masks to determine the differences in the topology.
[0004] However, existing technologies require traversing all faces of the model and performing topology checks on each one, which results in a large amount of data to be checked and low efficiency. Summary of the Invention
[0005] This application addresses the shortcomings of the prior art by providing a model topology detection method, apparatus, electronic device, and storage medium to solve the problems of large data volume and low efficiency in model topology detection in the prior art.
[0006] The technical solution adopted in this application is as follows:
[0007] Firstly, this application provides a model topology detection method, the method comprising:
[0008] Obtain the topology information of the first model and the topology information of the second model;
[0009] Based on the topology information of the first model, the first cyclic edge information of the first model is determined, and based on the topology information of the second model, the second cyclic edge information of the second model is determined. The first cyclic edge information is used to indicate the first cyclic edge in the first model and the first point sequence passing through the first cyclic edge, and the second cyclic edge information is used to indicate the second cyclic edge in the second model and the second point sequence passing through the second cyclic edge.
[0010] The first cyclic edge information of the first model and the second cyclic edge information of the second model are compared and analyzed to obtain the topological information detection results of the first model and the second model.
[0011] Secondly, this application provides a model topology detection device, the device comprising:
[0012] The acquisition module is used to acquire the topology information of the first model and the topology information of the second model;
[0013] The determining module is used to determine the first cyclic edge information of the first model based on the topology information of the first model, and to determine the second cyclic edge information of the second model based on the topology information of the second model, wherein the first cyclic edge information is used to indicate the first cyclic edge in the first model and the first point sequence passing through the first cyclic edge, and the second cyclic edge information is used to indicate the second cyclic edge in the second model and the second point sequence passing through the second cyclic edge.
[0014] The comparison module is used to compare and analyze the first cyclic edge information of the first model and the second cyclic edge information of the second model to obtain the topological information detection results of the first model and the second model.
[0015] Thirdly, this application provides 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 model topology detection method as described in the first aspect.
[0016] Fourthly, this application provides a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the model topology detection method as described in the first aspect.
[0017] The beneficial effects of this application are: by comparing and analyzing the information of cyclic edges, the positions in two models with differences in topology can be quickly determined. Compared with the existing technology that compares the faces of the model one by one to determine the differences in the topology, the amount of data detected by the topology detection based on the information of cyclic edges in this application is smaller, and therefore the detection efficiency is also higher.
[0018] 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
[0019] 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.
[0020] Figure 1This illustration shows a schematic diagram of a patch with a different topology provided in an embodiment of this application;
[0021] Figure 2 This illustration shows an application scenario provided by an embodiment of this application.
[0022] Figure 3 A flowchart of a model topology detection method provided in an embodiment of this application is shown;
[0023] Figure 4 A schematic diagram of a model loop edge provided in an embodiment of this application is shown;
[0024] Figure 5 This document illustrates a flowchart illustrating a method for comparing cyclic edge information to determine whether the topology is consistent, as provided in an embodiment of this application.
[0025] Figure 6 This document illustrates a flowchart of a method for comparing cyclic edge information according to an embodiment of this application.
[0026] Figure 7 This document illustrates a flowchart illustrating the process of comparing loop edge information according to an embodiment of this application.
[0027] Figure 8 This document illustrates a flowchart of a method for determining cyclic edge information according to an embodiment of this application.
[0028] Figure 9 This paper shows a schematic diagram of the structure of a model topology detection device provided in an embodiment of this application;
[0029] Figure 10 A schematic diagram of the structure of an electronic device provided in an embodiment of this application is shown. Detailed Implementation
[0030] 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.
[0031] 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.
[0032] In the scenario of model making, some reverse processes can change the structure of the model. For example, if the model structure is modified again after the effect binding is completed, it will cause a deviation between the previously submitted and bound model structure and the latest model structure. At this time, it is necessary to accurately determine the difference between the model before and after the modification. This requires timely comparison and detection of the model structure before and after the modification.
[0033] The simplest way to detect model differences is to examine the changes in the number of points, lines, and polygons between the two models. However, in some cases, even if two models have the same number of points, lines, and polygons, their topological structures may differ. Figure 1 As shown, there are two facets with the same number of points, lines, and faces but different topologies. In this case, it is obviously not possible to simply determine whether there are differences between the models by the number of points, lines, and faces. Instead, the topology of the models should be further examined.
[0034] In response to this situation, the existing technology uses the following method to detect whether the topological structures of two models are consistent: traversing all the faces of the model, obtaining the vertex numbers of the model, serializing the vertex numbers, and then using MD5 mask for detection, thereby determining the differences in the topological structures between the two models.
[0035] For example, if we need to detect whether the topological structures of models A and B are consistent, using existing technology requires first comparing face A in model A with every face in model B to check for the existence of faces with the same topological structure. For the next face B in model A, it is still necessary to compare it with every face in model B, until all faces have been compared. Therefore, existing technology suffers from problems such as large data volume and low efficiency.
[0036] It is evident that how to efficiently detect the differences in topological structure between two models has become an urgent problem to be solved.
[0037] Based on the above problems, this application proposes a model topology detection method, such as... Figure 2 The diagram illustrates an application scenario for model topology detection according to this application. After a user inputs two models requiring topology detection into an electronic device, the device can use the model topology detection method of this application to detect the point sequences of cyclic edges in the two models, identify the differences in their topological structures, and return the detected differences to the user. Compared to existing technologies that traverse all faces of the model for topology difference detection, the method of this application requires less data and has higher detection efficiency.
[0038] Next, combine Figure 3To further explain the model topology detection method of this application, the subject executing this method can be an electronic device, such as... Figure 3 As shown, the method includes:
[0039] S301: Obtain the topology information of the first model and the topology information of the second model.
[0040] Optionally, the first model and the second model can be any two 3D models that the user needs to compare in terms of topology to determine differences in topology. For example, the first model and the second model are two topology models corresponding to the same object (e.g., virtual character, pet, building, vehicle, etc.).
[0041] Topology refers to the layout, structure, and connection of points, lines, and surfaces in a polygonal mesh model. The topology information in this application may include point information, line information, and surface information in the model.
[0042] The point information can include the number of points in the model and the position of each point in the model, while the line information can include the number of edges in the model and the position of each edge in the model.
[0043] S302: Based on the topology information of the first model, determine the first cyclic edge information of the first model, and based on the topology information of the second model, determine the second cyclic edge information of the second model, wherein the first cyclic edge information is used to indicate the first cyclic edge in the first model and the first point sequence passing through the first cyclic edge, and the second cyclic edge information is used to indicate the second cyclic edge in the second model and the second point sequence passing through the second cyclic edge.
[0044] In this application, the first model and the second model can each be composed of multiple cyclic edges. A cyclic edge can be an edge that connects the beginning and end of the model. That is, taking any point on the cyclic edge as the starting point, all points are traversed along any direction of the cyclic edge, and the point after the last point traversed is still the starting point of the cyclic edge.
[0045] Optionally, the topological information of the first model can indicate the first cyclic edge information in the first model. The first model may include multiple first cyclic edges, and the first cyclic edge information can indicate each first cyclic edge in the first model and the sequence of first points passing through the first cyclic edge. The topological information of the second model can indicate the second cyclic edge information in the second model. The second model may include multiple second cyclic edges, and the second cyclic edge information can indicate each second cyclic edge in the second model and the sequence of second points passing through the cyclic edge.
[0046] It is worth noting that the model may include cyclic edges, triangular faces, and polygonal faces. The first and second models in this application are both composed of cyclic edges, and the detection is also a topological structure detection performed on the cyclic edges. When the model includes triangular faces or polygonal faces, the triangular faces and polygonal faces can be converted into cyclic edges first, and then topological detection can be performed according to the method of this application.
[0047] For example, suppose the first model or the second model is Figure 4 The sphere shown is composed of multiple cyclic edges. Figure 4 The dashed line in the diagram represents the cyclic edge A. As you can see, the edge includes multiple points. Suppose we number these points as 1, 2, 3, ..., 19, we can form the point sequence of cyclic edge A (1, 2, 3, ..., 19, 1), where point 1 is connected to point 2 and point 19 respectively.
[0048] In this application, the electronic device can traverse the cyclic edges in the first model and the second model respectively, determine the point sequence of each cyclic edge, and thus determine the first cyclic edge information of the first model and the second cyclic edge information of the second model.
[0049] S303: Compare and analyze the first cyclic edge information of the first model with the second cyclic edge information of the second model to obtain the topological information detection results of the first model and the second model.
[0050] Optionally, the first cyclic edge information of the first model can characterize the topological structure of the first model, and the second cyclic edge information of the second model can characterize the topological structure of the second model. Therefore, if every first cyclic edge of the first model can be found to have the exact same second cyclic edge in the second model, it can be said that all the cyclic edge information of the first model and the second model are completely consistent, that is, the topological structure of the first model and the second model is consistent. Conversely, it can be said that the topological structure of the first model and the second model is inconsistent. At this time, the electronic device can determine the location where there is a topological difference between the first model and the second model based on the cyclic edge information of the first model and the cyclic edge information of the second model.
[0051] Optionally, the topology information detection results can indicate whether the topology of the first model and the second model are consistent, and when there are differences in the topology of the first model and the second model, indicate the location of the differences in the topology of the first model and the second model.
[0052] In this embodiment, the first cyclic edge information of the first model and the second cyclic edge information of the second model are determined based on the topological information of the first model and the second model. The cyclic edge information of the first and second models is then compared and analyzed to determine the final topological information detection results for the first and second models. By comparing and analyzing the cyclic edge information, the locations in the two models with topological differences can be quickly identified. Compared to the prior art method of comparing each face of the model to determine the topological differences, the amount of data detected in this application based on cyclic edge information is smaller, thus resulting in higher detection efficiency.
[0053] Next, combine Figure 5 The steps described above for comparing and analyzing the first cyclic edge information of the first model with the second cyclic edge information of the second model to obtain the topological information detection results of the first and second models are further explained, such as... Figure 5 As shown, the above step S303 includes:
[0054] S501: Based on the first cyclic edge information and the second cyclic edge information, determine whether the first cyclic edge indicated by the first cyclic edge information and the second cyclic edge indicated by the second cyclic edge information are the same.
[0055] Optionally, the first cyclic edge information can indicate the first cyclic edge in the first model and the point sequence of the cyclic edge, and the second cyclic edge information can indicate the second cyclic edge in the second model and the point sequence of the cyclic edge.
[0056] Optionally, if the first cyclic edge indicated by the first cyclic edge information and the second cyclic edge information indicated by the second cyclic edge information are the same, it can be said that the topological structure of the first cyclic edge and the second cyclic edge is the same, or that the first cyclic edge and the second cyclic edge are corresponding edges whose topological structure has not changed before and after the model modification.
[0057] For example, assuming the first cyclic edge is cyclic edge A in the first model, the electronic device can take any cyclic edge in the second model as the second cyclic edge, compare the point sequence of cyclic edge A with the point sequence of the second cyclic edge to determine whether the first cyclic edge and the second cyclic edge are cyclic edges with the same topological structure.
[0058] It should be understood that step S501 can be performed multiple times to ensure that all cyclic edges in the first model are compared with the cyclic edges in the second model.
[0059] S502: If for all first cyclic edges in the first model, there are identical second cyclic edges in the second model, then the topology of the first model and the second model is determined to be consistent; otherwise, the topology information of the first model and the second model is determined to be different.
[0060] As one possible implementation, when determining multiple cyclic edge information in step S302 above, the electronic device can record the multiple cyclic edge information of the first model in a set according to the traversal order, and traverse the cyclic edges of the second model in the same order to obtain a set of cyclic edge information of the second model. When comparing and analyzing the cyclic edge information, if a corresponding set of first and second cyclic edges is found, the next cyclic edge of the first cyclic edge and the next cyclic edge of the second cyclic edge in the set can be compared and analyzed according to the order of the cyclic edge information in the set, so as to improve the efficiency of the comparison and analysis.
[0061] For example, suppose that both the first and second models obtain the cyclic edge information by traversing in a counter-clockwise order. The cyclic edge information of the first model includes {A(1, 2, 3, 4, 5, 1), B(6, 7, 8, 9, 6), C(10, 11, 12, 10), D(13, 14, 13)}, indicating that the cyclic edges in the first model include A, B, C, and D in traversal order. Taking cyclic edge A as an example, its point sequence is (1, 2, 3, 4, 5, 1). The cyclic edge information of the second model includes: {E(11, 12, 13, 14, 15, ..., ...
[0062] 11), F(16, 17, 18, 19, 16), G(20, 21, 22, 20), H(23, 24, 23)}, then after determining that the cyclic edge A in the first model and the cyclic edge E in the second model are the same cyclic edge, we can continue to compare and analyze the point sequence of the cyclic edge B in the first model and the point sequence of the cyclic edge F in the second model.
[0063] As another possible implementation, when determining multiple cyclic edge information in step S302 above, the electronic device can also traverse the cyclic edges in the model in any order and put the obtained cyclic edge information into a set. When performing comparison analysis of cyclic edge information, any cyclic edge in the first model can be taken as the first cyclic edge, and then the cyclic edges in the second model can be taken as the second cyclic edges and the above S501 step can be executed to determine whether there is a cyclic edge in the second model that is the same as the first cyclic edge. After completing the comparison of the current first cyclic edge, if there is a cyclic edge in the second model that is the same as the first cyclic edge, these two cyclic edges can be taken as a pair of corresponding edges, and the comparison analysis of the remaining cyclic edges in the first and second models can continue until the comparison analysis of all cyclic edges in the first and second models is completed.
[0064] For example, suppose the cyclic edge information of the first model includes {A(1,2,3,4,5,1), B(6,7,8,9,6), C(10,11,12,10), D(13,14,13)}, indicating that the cyclic edges in the first model include A, B, C, and D, and the order of each cyclic edge is unknown. The cyclic edge information of the second model includes: {E(11,12,13,14,15,11), F(16,17,18,19,16), G(20,21,22,20), H(23,24,23)}. After determining that the cyclic edge A in the first model and the cyclic edge E in the second model are the same cyclic edge, we can continue to compare and analyze the point sequence of the cyclic edge B in the first model and the point sequences of the cyclic edges F, G, and H in the second model in turn.
[0065] Optionally, if for each cyclic edge in the first model, there exists a cyclic edge in the second model with exactly the same cyclic edge information, it can be said that the first model and the second model have exactly the same topological structure. If one or more cyclic edges in the first model do not have the same cyclic edge in the second model, it can be said that there is a difference in the topological information of the first model and the second model.
[0066] Furthermore, such as Figure 6 As shown, in S501 above, the step of determining whether the first cycle edge indicated by the first cycle edge information and the second cycle edge information are the same includes:
[0067] S601: Determine the number of first points and the sequence of first points based on the information of the first cyclic edge.
[0068] Optionally, the first cyclic edge information can indicate the number of points and the sequence of points of the first cyclic edge. For example, the first point sequence of the first cyclic edge A can be (1, 2, 3, 4, 5, 1), and the number of points of the first cyclic edge is 5.
[0069] Among them, the number of points describes the number of points on the first cycle edge, the point sequence describes the arrangement order of the points on the first cycle edge, each value in the first point sequence represents the number of the points on the cycle edge, and the number of items in the first point sequence is the same as the number of points on the first cycle edge.
[0070] S602: Determine the number of second points and the sequence of second points based on the information of the second cyclic edge.
[0071] Optionally, the second cyclic edge information can indicate the number of points and the point sequence included in the second cyclic edge. The point sequence can indicate the connection relationship between the points. For example, in the point sequence (1, 2, 3, 4, 5, 1), the points connected to point 1 include points 2 and 5, and the points connected to point 4 include points 5 and 3.
[0072] S603: If the number of first points is the same as the number of second points, and the connection relationship between each point in the first point sequence is the same as the connection relationship between each point in the second point sequence, determine that the first cyclic edge indicated by the first cyclic edge information is the same as the second cyclic edge indicated by the second cyclic edge information; otherwise, determine that the cyclic edge indicated by the first cyclic edge information is different from the cyclic edge indicated by the second cyclic edge information.
[0073] It is worth noting that when traversing the cyclic edges in the model to obtain cyclic edge information, the electronic device may not obtain the point sequence in exactly the same ordering method. Therefore, the two models may have the same number of points, but the arrangement of the point numbers may not be the same. Thus, it is not possible to determine whether the topological structure of the models is consistent by simply comparing whether the numbers in the two models correspond one-to-one.
[0074] In response to the above situation, this application does not simply compare the serial numbers, but when the number of points is the same, it further compares the connection relationships of each point in the first sequence and the connection relationships of each point in the second sequence to determine whether the first sequence and the second sequence have the same topological structure.
[0075] For example, suppose the first point sequence includes 10 points from 10 to 19, and the second point sequence includes 10 points from 110 to 119. First, the first and second point sequences have the same number of points. Then, we can further compare their connection relationships. For example, we can compare which point the first point in the first point sequence is connected to, and compare whether the first point in the second point sequence has the same connection relationship. For example, the first point 10 in the first point sequence is connected to the last point 19 and the next point 11, and the point 110 in the second point sequence is connected to the last point 119 and the next point 112. At this time, we can consider that the connection relationship between points 10 and points 110 is the same, and then compare whether the remaining points have the same connection relationship.
[0076] If all other points have the same connection relationship, then the first and second cyclic edge information indicate the same cyclic edge; if the number of points is the same but the connection relationship is different, the number of points is different, or the number of points and the connection relationship of the point sequence are both different, then the first and second cyclic edges are different cyclic edges.
[0077] After determining the topological inconsistency between the first model and the second model as described above, the topology detection in this application further includes:
[0078] If for a first target cyclic edge in the first model, there is no identical second target cyclic edge in the second model, then the cyclic edge information corresponding to the first target cyclic edge in the first model is used as topological difference information.
[0079] Optionally, if for a cyclic edge A in the first model, there is no second cyclic edge in the second model with the same cyclic edge information, then cyclic edge A can be determined to be a cyclic edge with a different topology, and its cyclic edge information can be used as topological difference information.
[0080] It should be understood that the information on loop edges can indicate the location of loop edges and the sequence of points on the loop edges. Therefore, after the electronic device marks the information on loop edges, it can determine the location of all loop edges in the model where the topology has changed. This allows users to modify the binding effect of the model in a timely manner based on the differences in location, avoiding inaccurate model binding effects caused by model changes, and improving the accuracy and efficiency of user operations.
[0081] It is worth noting that in existing technologies, the traversal and comparison of the model's surfaces involves repeatedly comparing several edges on the surface, resulting in a lot of repetitive work. In contrast, this application compares only the edges, thus requiring less data and achieving higher detection efficiency compared to existing technologies.
[0082] In this embodiment, by comparing the cyclic edge information in the first model and the second model, it is possible to quickly determine whether the edges of the model have changed and to determine the position of the changed edges. At the same time, since the cyclic edges in this application are represented by point sequences, it is also possible to quickly find the specific point sequence position that has changed on the cyclic edge.
[0083] It is worth noting that when the number of points, lines, and faces in a model differs, it can be directly determined that there are differences in the model's topology. However, in actual topology difference detection, users often find it difficult to detect structural differences in models with identical points, lines, and faces. (Refer to...) Figure 1 The two given patches have the same number of points, lines, and faces, but different topologies. Therefore, we can first determine the number of points, lines, and faces. When the number of points, lines, and faces in the model is the same, we can then perform the above step S302 to detect the model's topology, thereby further improving the detection efficiency.
[0084] like Figure 7 The above describes the steps of determining multiple cyclic edge information of the first model based on the topological information of the first model, and determining multiple cyclic edge information of the second model based on the topological information of the second model. The topological information in this application includes point information, line information, and surface information.
[0085] Reference Figure 7 The above-mentioned step S302 includes:
[0086] S701: Determine the point information, line information, and surface information of the first model based on the topology information of the first model, and determine the point information, line information, and surface information of the second model based on the topology information of the second model.
[0087] Optionally, point information can be the number of points contained in the model, line information can be the number of edges contained in the model, and surface information can be the number of surfaces contained in the model graph. This application only uses the number of points, lines, and surfaces as examples for illustration. It should be understood that point information and surface information can also be other information, such as coordinate information representing the position of points, lines, and surfaces in the model. This application does not impose any restrictions on these.
[0088] In this application, the electronic device can determine the number of points, lines, and surfaces of the first model based on the topology information of the first model, and determine the number of points, lines, and surfaces of the second model based on the topology information of the second model.
[0089] S702: If the point information of the first model is the same as the point information of the second model, and the line information of the first model is the same as the line information of the second model, and the surface information of the first model is the same as the surface information of the second model, then based on the topology information of the first model, determine the multiple cyclic edge information of the first model, and based on the topology information of the second model, determine the multiple cyclic edge information of the second model.
[0090] Optionally, the electronic device can first compare the number of points, lines, and surfaces of the first model and the second model. As a possible implementation, if the number of points, lines, and surfaces of the first model and the second model are the same, the above-mentioned step S302 can be continued to traverse and compare the loop edges of the first model and the second model to obtain the topology detection results of the first model and the second model.
[0091] As another possible implementation, after determining the number of points in the first model based on the topology information of the first model and determining the number of points in the second model based on the topology information of the second model, the above-described S701 further includes:
[0092] If the number of points in the first model is different from the number of points in the second model, or the number of lines in the first model is different from the number of lines in the second model, or the number of faces in the first model is different from the number of faces in the second model, then it is determined that there is a difference in the topological information of the first model and the second model. Based on the point information, line information and face information of the first model, and the point information, line information and face information of the second model, the topological difference information of the first model and the second model is determined.
[0093] Optionally, if the number of points, lines, and faces in the first model and the second model is different, it indicates that there is a difference in the topological information of the first model and the second model. In this case, the electronic device can traverse the faces in the first model and the second model, determine any face to be detected in the first model, and determine the face corresponding to the face to be detected in the second model, determine the difference between the two faces, and compare the lines on the two faces with differences to determine the faces, lines, and vertices with differences in the first model and the second model. The positions of the points, lines, and faces with differences obtained from the comparison are used as the topological difference information of the first model and the second model.
[0094] The following is an explanation of the process for determining cyclic edge information, such as... Figure 8 As shown, step S302 above includes:
[0095] S801: Based on the line information of the first model, traverse the first model to obtain multiple edges in the first model.
[0096] Optionally, the line information of the first model can indicate how many edges are included in the first model and indicate the type of each edge, such as a circular edge, a triangular edge, or a polygonal edge.
[0097] It should be noted that when the edge type encountered is a triangular face or a polygonal face, the electronic device can first convert the edge into a loop edge.
[0098] Optionally, the electronic device can traverse the edges of the model in a preset order and store the information of the traversed edges in a set in the order of traversal. The electronic device can also traverse the edges in any order. This application does not limit the traversal method of the electronic device.
[0099] S802: Determine the sequence of points that pass through the edge based on the point information of the first model.
[0100] Optionally, each edge can correspond to multiple points, see reference. Figure 4 In the model, edge A includes multiple points. Point information can indicate which edges a point is located on and its position, for example... Figure 4 Point a exists on both edges simultaneously. Its point information can indicate that point a is located on both cyclic edge A and cyclic edge B, and indicate the position of point a on the model.
[0101] S803: Treat the edge to which the point sequence with a cycle belongs as a cycle edge, and treat the point sequence with a cycle and the cycle edge as a cycle edge information of the first model.
[0102] Optionally, the electronic device can take the edge to which the cyclic point sequence belongs as a cyclic edge, traverse the points on the cyclic edge, sort the points according to the traversal order, obtain the index of each point, arrange the indexes of each point on the cyclic edge according to the traversal order to form the point sequence of the cyclic edge, and finally combine the point sequence and the cyclic edge to form a cyclic edge information of the first model.
[0103] Reference Figure 4 Suppose we want to find the sequence of points along a cyclic edge A, from its first point to its last. This yields 20 points, from 0 to 19. This sequence is recorded in a set where A is the key and the 20 point names are the values. Similarly, if edge B also has a sequence of points 10-19, we record it in a set where B is the key and the 10 point names are the values. We iterate through all edges in this way, obtaining a set of point sequences for each edge. For example, the cyclic edge information for edge A could be A-(1, 2, 3, ..., 17, 18, 19, 1), indicating that the point sequence of edge A is (1, 2, 3, ..., 17, 18, 19, 1).
[0104] In this embodiment, by traversing the cyclic edges to obtain multiple cyclic edge information of the model, it is possible to quickly determine whether two models with the same number of points, lines, and surfaces have the same topological structure by comparing the point sequence of the cyclic edges during comparison analysis, thereby improving the efficiency of model topology detection.
[0105] Based on the same inventive concept, this application also provides a model topology detection device corresponding to the model topology detection method. Since the principle of the device in this application is similar to the model topology detection method described above in this application, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be described again.
[0106] Reference Figure 9 The diagram shown is a schematic representation of a model topology detection device provided in an embodiment of this application. The device includes: an acquisition module 901, a determination module 902, and a comparison module 903, wherein:
[0107] In one feasible implementation, the acquisition module 901 is used to acquire the topology information of the first model and the topology information of the second model;
[0108] In one feasible implementation, the determining module 902 is used to determine the first cyclic edge information of the first model based on the topology information of the first model, and to determine the second cyclic edge information of the second model based on the topology information of the second model, wherein the first cyclic edge information is used to indicate the first cyclic edge in the first model and the first point sequence passing through the first cyclic edge, and the second cyclic edge information is used to indicate the second cyclic edge in the second model and the second point sequence passing through the second cyclic edge.
[0109] In a feasible implementation, the comparison module 903 is used to compare and analyze the first cyclic edge information of the first model and the second cyclic edge information of the second model to obtain the topological information detection results of the first model and the second model.
[0110] In one feasible implementation, the comparison module 903 is specifically used for:
[0111] Based on the first cyclic edge information and the second cyclic edge information, determine whether the first cyclic edge indicated by the first cyclic edge information and the second cyclic edge indicated by the second cyclic edge information are the same;
[0112] If for the first cyclic edge in the first model, there is the same second cyclic edge in the second model, then the topology of the first model and the second model is determined to be consistent; otherwise, the topology information of the first model and the second model is determined to be different.
[0113] In one feasible implementation, the comparison module 903 is further specifically used for:
[0114] Based on the information of the first cyclic edge, determine the number of first points and the sequence of first points;
[0115] Based on the information of the second cyclic edge, determine the number of second points and the sequence of second points;
[0116] If the number of first points is the same as the number of second points, and the connection relationship between each point in the first point sequence is the same as the connection relationship between each point in the second point sequence, it is determined that the first cyclic edge indicated by the first cyclic edge information is the same as the second cyclic edge indicated by the second cyclic edge information; otherwise, it is determined that the cyclic edge indicated by the first cyclic edge information is different from the cyclic edge indicated by the second cyclic edge information.
[0117] In one feasible implementation, the comparison module 903 is further specifically used for:
[0118] If for a first target cyclic edge in the first model, there is no identical second target cyclic edge in the second model, then the cyclic edge information corresponding to the first target cyclic edge in the first model is used as topological difference information.
[0119] In one feasible implementation, module 902 is specifically used for:
[0120] The point information, line information, and surface information of the first model are determined based on the topological information of the first model, and the point information, line information, and surface information of the second model are determined based on the topological information of the second model.
[0121] If the point information of the first model is the same as the point information of the second model, and the line information of the first model is the same as the line information of the second model, and the surface information of the first model is the same as the surface information of the second model, then the cyclic edge information of the first model is determined based on the topological information of the first model, and the cyclic edge information of the second model is determined based on the topological information of the second model.
[0122] In one feasible implementation, the determining module 902 is further specifically used for:
[0123] If the number of points in the first model is different from the number of points in the second model, or the number of lines in the first model is different from the number of lines in the second model, or the number of faces in the first model is different from the number of faces in the second model, then it is determined that there is a difference in the topological information of the first model and the second model. Based on the point information, line information and face information of the first model, and the point information, line information and face information of the second model, the topological difference information of the first model and the second model is determined.
[0124] In one feasible implementation, the determining module 902 is further specifically used for:
[0125] Based on the line information of the first model, the first model is traversed to obtain the edges in the first model;
[0126] Based on the point information of the first model, determine the sequence of points that have passed through the edge;
[0127] The edges belonging to a point sequence with a cycle are designated as cycle edges, and the point sequence with a cycle and the cycle edges are used as the cycle edge information of the first model.
[0128] The processing flow of each module in the device and the interaction flow between each module can be referred to the relevant descriptions in the above method embodiments, and will not be detailed here.
[0129] This application embodiment can quickly determine the locations with topological differences between two models by comparing and analyzing the information of cyclic edges. Compared with the prior art, which compares the faces of the model one by one to determine the differences in the topological structure, the amount of data detected by topological structure detection based on cyclic edge information in this application is smaller, and therefore the detection efficiency is also higher.
[0130] Figure 10This illustration shows a schematic diagram of an electronic device provided in an embodiment of this application, including: a processor 1001, a storage medium 1002, and a bus. The storage medium 1002 stores machine-readable instructions executable by the processor 1001. When the electronic device runs the model topology detection method as described in the embodiment, the processor 1001 communicates with the storage medium 1002 via the bus. The processor 1001 executes the machine-readable instructions. The preamble of the method item in the processor 1001 performs the following steps:
[0131] In one feasible implementation, the processor 1001, when executing the model topology detection method, is specifically used for:
[0132] Obtain the topology information of the first model and the topology information of the second model;
[0133] Based on the topological information of the first model, the first cyclic edge information of the first model is determined, and based on the topological information of the second model, the second cyclic edge information of the second model is determined. The first cyclic edge information is used to indicate the first cyclic edge in the first model and the first point sequence passing through the first cyclic edge, and the second cyclic edge information is used to indicate the second cyclic edge in the second model and the second point sequence passing through the second cyclic edge.
[0134] The first cyclic edge information of the first model and the second cyclic edge information of the second model are compared and analyzed to obtain the topological information detection results of the first model and the second model.
[0135] In one feasible implementation, the processor 1001, when executing the model topology detection method, is specifically used for:
[0136] Based on the first cyclic edge information and the second cyclic edge information, determine whether the first cyclic edge indicated by the first cyclic edge information and the second cyclic edge indicated by the second cyclic edge information are the same;
[0137] If for the first cyclic edge in the first model, there is the same second cyclic edge in the second model, then the topology of the first model and the second model is determined to be consistent; otherwise, the topology information of the first model and the second model is determined to be different.
[0138] In one feasible implementation, when executing the model topology detection method, the processor 1001 is specifically used for:
[0139] Based on the information of the first cyclic edge, determine the number of first points and the sequence of first points;
[0140] Based on the information of the second cyclic edge, determine the number of second points and the sequence of second points;
[0141] If the number of first points is the same as the number of second points, and the connection relationship between each point in the first point sequence is the same as the connection relationship between each point in the second point sequence, it is determined that the first cyclic edge indicated by the first cyclic edge information is the same as the second cyclic edge indicated by the second cyclic edge information; otherwise, it is determined that the cyclic edge indicated by the first cyclic edge information is different from the cyclic edge indicated by the second cyclic edge information.
[0142] In one feasible implementation, when executing the model topology detection method, the processor 1001 is specifically used for:
[0143] If for a first target cyclic edge in the first model, there is no identical second target cyclic edge in the second model, then the cyclic edge information corresponding to the first target cyclic edge in the first model is used as topological difference information.
[0144] In one feasible implementation, when executing the model topology detection method, the processor 1001 is specifically used for:
[0145] The point information, line information, and surface information of the first model are determined based on the topological information of the first model, and the point information, line information, and surface information of the second model are determined based on the topological information of the second model.
[0146] If the point information of the first model is the same as the point information of the second model, and the line information of the first model is the same as the line information of the second model, and the surface information of the first model is the same as the surface information of the second model, then the cyclic edge information of the first model is determined based on the topological information of the first model, and the cyclic edge information of the second model is determined based on the topological information of the second model.
[0147] In one feasible implementation, when executing the model topology detection method, the processor 1001 is specifically used for:
[0148] If the number of points in the first model is different from the number of points in the second model, or the number of lines in the first model is different from the number of lines in the second model, or the number of faces in the first model is different from the number of faces in the second model, then it is determined that there is a difference in the topological information of the first model and the second model. Based on the point information, line information and face information of the first model, and the point information, line information and face information of the second model, the topological difference information of the first model and the second model is determined.
[0149] In one feasible implementation, when executing the model topology detection method, the processor 1001 is specifically used for:
[0150] Based on the line information of the first model, the first model is traversed to obtain the edges in the first model;
[0151] Based on the point information of the first model, determine the sequence of points that have passed through the edge;
[0152] The edges belonging to a point sequence with a cycle are designated as cycle edges, and the point sequence with a cycle and the cycle edges are used as the cycle edge information of the first model.
[0153] This application embodiment also provides a computer-readable storage medium storing a computer program, which is executed by a processor, wherein the processor performs the following steps:
[0154] In one feasible implementation, the processor, when executing the model topology detection method, is used to:
[0155] Obtain the topology information of the first model and the topology information of the second model;
[0156] Based on the topological information of the first model, the first cyclic edge information of the first model is determined, and based on the topological information of the second model, the second cyclic edge information of the second model is determined. The first cyclic edge information is used to indicate the first cyclic edge in the first model and the first point sequence passing through the first cyclic edge, and the second cyclic edge information is used to indicate the second cyclic edge in the second model and the second point sequence passing through the second cyclic edge.
[0157] The first cyclic edge information of the first model and the second cyclic edge information of the second model are compared and analyzed to obtain the topological information detection results of the first model and the second model.
[0158] In one feasible implementation, the processor, when executing the model topology detection method, is specifically used for:
[0159] Based on the first cyclic edge information and the second cyclic edge information, determine whether the first cyclic edge indicated by the first cyclic edge information and the second cyclic edge indicated by the second cyclic edge information are the same;
[0160] If for the first cyclic edge in the first model, there is the same second cyclic edge in the second model, then the topology of the first model and the second model is determined to be consistent; otherwise, the topology information of the first model and the second model is determined to be different.
[0161] In one feasible implementation, the processor, when executing the model topology detection method, is specifically used for:
[0162] Based on the information of the first cyclic edge, determine the number of first points and the sequence of first points;
[0163] Based on the information of the second cyclic edge, determine the number of second points and the sequence of second points;
[0164] If the number of first points is the same as the number of second points, and the connection relationship between each point in the first point sequence is the same as the connection relationship between each point in the second point sequence, it is determined that the first cyclic edge indicated by the first cyclic edge information is the same as the second cyclic edge indicated by the second cyclic edge information; otherwise, it is determined that the cyclic edge indicated by the first cyclic edge information is different from the cyclic edge indicated by the second cyclic edge information.
[0165] In one feasible implementation, the processor, when executing the model topology detection method, is specifically used for:
[0166] If for a first target cyclic edge in the first model, there is no identical second target cyclic edge in the second model, then the cyclic edge information corresponding to the first target cyclic edge in the first model is used as topological difference information.
[0167] In one feasible implementation, the processor, when executing the model topology detection method, is specifically used for:
[0168] The point information, line information, and surface information of the first model are determined based on the topological information of the first model, and the point information, line information, and surface information of the second model are determined based on the topological information of the second model.
[0169] If the point information of the first model is the same as the point information of the second model, and the line information of the first model is the same as the line information of the second model, and the surface information of the first model is the same as the surface information of the second model, then the cyclic edge information of the first model is determined based on the topological information of the first model, and the cyclic edge information of the second model is determined based on the topological information of the second model.
[0170] In one feasible implementation, the processor, when executing the model topology detection method, is specifically used for:
[0171] If the number of points in the first model is different from the number of points in the second model, or the number of lines in the first model is different from the number of lines in the second model, or the number of faces in the first model is different from the number of faces in the second model, then it is determined that there is a difference in the topological information of the first model and the second model. Based on the point information, line information and face information of the first model, and the point information, line information and face information of the second model, the topological difference information of the first model and the second model is determined.
[0172] In one feasible implementation, the processor, when executing the model topology detection method, is specifically used for:
[0173] Based on the line information of the first model, the first model is traversed to obtain the edges in the first model;
[0174] Based on the point information of the first model, determine the sequence of points that have passed through the edge;
[0175] The edges belonging to a point sequence with a cycle are designated as cycle edges, and the point sequence with a cycle and the cycle edges are used as the cycle edge information of the first model.
[0176] By comparing and analyzing the cyclic edge information in the above manner, the locations with topological differences between the two models can be quickly identified. Compared with the existing technology that compares each face of the model to determine the topological differences, the amount of data detected by topological structure detection based on cyclic edge information in this application is smaller, and therefore the detection efficiency is also higher.
[0177] 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.
[0178] 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.
[0179] 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.
[0180] 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.
[0181] 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.
[0182] 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.
[0183] 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 detecting model topology, characterized in that, include: Obtain the topology information of the first model and the topology information of the second model. The first model and the second model are 3D models, and the first model and the second model are two topology models corresponding to the same object. Based on the topology information of the first model, the first cyclic edge information of the first model is determined, and based on the topology information of the second model, the second cyclic edge information of the second model is determined. The first cyclic edge information is used to indicate the first cyclic edge in the first model and the first point sequence passing through the first cyclic edge. The second cyclic edge information is used to indicate the second cyclic edge in the second model and the second point sequence passing through the second cyclic edge. The first cyclic edge is a closed loop edge connecting the first endpoint and the last endpoint in the first model. The second cyclic edge is a closed loop edge connecting the first endpoint and the last endpoint in the second model. The next adjacent point of the last point in the first point sequence is the first point in the first point sequence. The first point sequence is used to indicate the connection relationship of each point. The first cyclic edge information of the first model and the second cyclic edge information of the second model are compared and analyzed to obtain the topological information detection results of the first model and the second model; Determining the first cyclic edge information of the first model based on the topological information of the first model includes: Based on the line information of the first model, the first model is traversed to obtain the edges in the first model; Based on the point information of the first model, determine the sequence of points that pass through the edge; The edges belonging to the point sequence with a cycle are designated as cycle edges, and the point sequence with a cycle and the cycle edges are used as the cycle edge information of the first model.
2. The method according to claim 1, characterized in that, The step of comparing and analyzing the first cyclic edge information of the first model with the second cyclic edge information of the second model to obtain the topology information detection results of the first model and the second model includes: Based on the first cyclic edge information and the second cyclic edge information, determine whether the first cyclic edge indicated by the first cyclic edge information and the second cyclic edge indicated by the second cyclic edge information are the same; If for the first cyclic edge of the first model, there exists the same second cyclic edge in the second model, then the topology of the first model and the second model is determined to be consistent; otherwise, the topology information of the first model and the second model is determined to be different.
3. The method according to claim 2, characterized in that, The step of determining whether the first cyclic edge indicated by the first cyclic edge information and the second cyclic edge information are the same, based on the first cyclic edge information and the second cyclic edge information, includes: Based on the first cyclic edge information, determine the number of first points and the sequence of first points; Based on the second cyclic edge information, determine the number of second points and the sequence of second points; If the number of the first point is the same as the number of the second point, and the connection relationship between the points in the first point sequence is the same as the connection relationship between the points in the second point sequence, it is determined that the first cyclic edge indicated by the first cyclic edge information is the same as the second cyclic edge indicated by the second cyclic edge information; otherwise, it is determined that the cyclic edge indicated by the first cyclic edge information is different from the cyclic edge indicated by the second cyclic edge information.
4. The method according to claim 2, characterized in that, After determining that there is a difference in the topological information between the first model and the second model, the method further includes: If for a first target cyclic edge in the first model, there is no identical second target cyclic edge in the second model, then the cyclic edge information corresponding to the first target cyclic edge in the first model is used as topological difference information.
5. The method according to claim 1, characterized in that, The topological information includes point information, line information, and surface information. The step of determining the first cyclic edge information of the first model based on its topological information, and determining the second cyclic edge information of the second model based on its topological information, includes: The point information, line information, and surface information of the first model are determined based on the topology information of the first model, and the point information, line information, and surface information of the second model are determined based on the topology information of the second model. If the point information of the first model is the same as the point information of the second model, and the line information of the first model is the same as the line information of the second model, and the surface information of the first model is the same as the surface information of the second model, then the cyclic edge information of the first model is determined according to the topology information of the first model, and the cyclic edge information of the second model is determined according to the topology information of the second model.
6. The method according to claim 5, characterized in that, After determining the point information, line information, and surface information of the first model based on the topology information of the first model, and determining the point information, line information, and surface information of the second model based on the topology information of the second model, the method further includes: If the number of points in the first model is different from the number of points in the second model, or the number of lines in the first model is different from the number of lines in the second model, or the number of faces in the first model is different from the number of faces in the second model, then it is determined that there is a difference in the topological information of the first model and the second model, and the topological difference information between the first model and the second model is determined based on the point information, line information and face information of the first model, and the point information, line information and face information of the second model.
7. A model topology detection device, characterized in that, include: The acquisition module is used to acquire the topological information of the first model and the topological information of the second model. The first model and the second model are 3D models, and the first model and the second model are two topological models corresponding to the same object. The determining module is used to determine the first cyclic edge information of the first model based on the topology information of the first model, and to determine the second cyclic edge information of the second model based on the topology information of the second model. The first cyclic edge information is used to indicate the first cyclic edge in the first model and the first point sequence passing through the first cyclic edge. The second cyclic edge information is used to indicate the second cyclic edge in the second model and the second point sequence passing through the second cyclic edge. The first cyclic edge is a closed loop edge connecting the first endpoint and the last endpoint in the first model. The second cyclic edge is a closed loop edge connecting the first endpoint and the last endpoint in the second model. The next adjacent point of the last point in the first point sequence is the first point in the first point sequence. The first point sequence is used to indicate the connection relationship of each point. The comparison module is used to compare and analyze the first cyclic edge information of the first model and the second cyclic edge information of the second model to obtain the topological information detection results of the first model and the second model. The determining module is used for: Based on the line information of the first model, the first model is traversed to obtain the edges in the first model; Based on the point information of the first model, determine the sequence of points that pass through the edge; The edges belonging to the point sequence with a cycle are designated as cycle edges, and the point sequence with a cycle and the cycle edges are used as the cycle edge information of the first model.
8. An electronic device, characterized in that, include: The device includes a processor, a storage medium, and a bus, wherein the storage medium stores program 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 program instructions to perform the model topology detection method as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, performs the model topology detection method as described in any one of claims 1 to 6.