Method, device, equipment and readable storage medium for simplifying triangular mesh model

By calculating the triangle plane error distance and preset error threshold judgment, efficient simplification of the triangle grid model is achieved, the problems of insufficient simplification and inefficiency in the prior art are solved, and the maximum retention of model features is ensured.

CN115115801BActive Publication Date: 2024-12-13GLODON CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110303692.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-03-22
Publication Date
2024-12-13
Estimated Expiration
2041-03-22

AI Technical Summary

Technical Problem

When the prior art simplifies the triangular grid model, it is easy to lead to excessive simplification or insufficient simplification, loss of building feature information, and the manual simplification ratio is inefficient, requiring a large amount of test parameters adjustment.

Method used

By calculating the triangle plane error distance in the field of the two vertices and one ring of the edge to be folded, the error distance of the folding point is calculated, and whether to continue to simplify based on the preset error threshold is determined to ensure that the original model features are retained to the maximum extent within the allowable error range. .

Benefits of technology

It realizes efficient and rapid simplification of the triangular grid model within the allowable error range, retaining the characteristic information of the building information model to the maximum extent, and reducing the amount of data and calculation complexity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115115801B_ABST
    Figure CN115115801B_ABST
Patent Text Reader

Abstract

The present invention discloses a method, device, equipment and readable storage medium for simplifying a triangular mesh model. The method comprises: in the process of simplifying a first triangular mesh model into a second triangular mesh model, simplifying the to-be-folded edge in the first triangular mesh model into a folding point in the second triangular mesh model; calculating the face error distance of each triangular face in a one-ring neighborhood of two vertices of the to-be-folded edge according to the face error distance of each triangular face in a one-ring neighborhood of the folding point; calculating the model error distance of the second triangular mesh model relative to the initial triangular mesh model according to the face error distance of all triangular faces in a one-ring neighborhood of the folding point; judging whether the model error distance is greater than a preset error threshold, if so, stopping the simplification operation on the second triangular mesh model, if not, continuing the simplification operation on the second triangular mesh model; the BIM model can be simplified efficiently and quickly.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer graphics processing technology, and in particular to a method, device, equipment and readable storage medium for simplifying a triangular mesh model. Background Art

[0002] Building Information Modeling (BIM) can be regarded as a parametric 3D geometric model of a building. BIM contains a variety of information that can be used to display the entire life cycle of a building, such as: the spatial relationship of building components, regional information, the number and characteristics of building components, budget costs, material inventory, and project schedules. Through BIM, the quantity and common characteristics of materials can be known in real time, the scope of the project can be easily distinguished and defined, the systems, components, and processes of the entire facility or facility group can be displayed in relative proportion, and various construction industry documents, including drawings, procurement details, application procedures, and other specifications, can be collected. Usually, BIM is a triangular mesh model, that is, the smallest component unit of BIM is a triangular face, so the data volume of BIM will be very large. For this reason, a model simplification algorithm is proposed in the prior art. The model simplification algorithm refers to representing a model with a larger data volume with a model with a smaller data volume, and the model with a smaller data volume can retain the characteristics of the original model to the maximum extent. The existing model simplification algorithm simplifies the building information model (BIM) by setting a unified simplification ratio; however, there are problems such as over-simplification, loss of significant building feature information, and insufficient simplification, resulting in a large amount of data. In addition, professionals are required to manually set the corresponding simplification ratio for different building information models (BIM). However, the manual setting of the simplification ratio requires a lot of testing and parameter adjustment, which requires a lot of repetitive work and is inefficient. Summary of the invention

[0003] The purpose of the present invention is to provide a method, device, equipment and readable storage medium for simplifying a triangular mesh model, which can efficiently and quickly simplify a building information model (BIM) and can maximize the retention of characteristic information of the building information model (BIM).

[0004] According to one aspect of the present invention, a method for simplifying a triangular mesh model is provided, the method comprising:

[0005] In the process of simplifying the first triangular mesh model into the second triangular mesh model, simplifying the to-be-folded edges in the first triangular mesh model into folding points in the second triangular mesh model;

[0006] Calculate the surface error distance of each triangular face in a ring area of ​​the folding point according to the surface error distance of each triangular face in a ring neighborhood of two vertices of the edge to be folded;

[0007] Calculating a model error distance of the second triangular mesh model relative to the initial triangular mesh model according to the surface error distances of all triangular faces within a ring region of the folding point;

[0008] It is determined whether the model error distance is greater than a preset error threshold. If so, the simplification operation on the second triangular mesh model is stopped; if not, the simplification operation on the second triangular mesh model is continued.

[0009] Optionally, the step of calculating the surface error distance of each triangular face within a ring region of the folding point according to the surface error distance of each triangular face within a ring neighborhood of two vertices of the edge to be folded includes:

[0010] Determine each triangle face f in a ring neighborhood of two vertices of the edge to be folded i The surface error distance dist(f i ); wherein the triangular face f i The surface error distance dist(f i ) has an initial value of 0;

[0011] Calculate the value of each triangle f in the neighborhood of the folding point v′ to the two vertices of the edge to be folded i The first distance dist(v′,f i );

[0012] Determine each triangular face f within a ring area of ​​the folding point v′ i ′ and each triangular face f in a ring neighborhood of the two vertices of the edge to be folded i The mapping relationship;

[0013] According to the mapping relationship, the value of each triangle face f in the ring area of ​​the folding point v′ is calculated. i ′ surface error distance dist(f i ′) = dist(f i )+dist(v′,f i ), where the triangle face f i ′ and the triangle face f i Have a mapping relationship.

[0014] Optionally, the calculation of each triangular face f in a ring neighborhood from the folding point v′ to the two vertices of the edge to be folded i The first distance dist(v′,f i ), including:

[0015] The first distance dist(v′,f i ):

[0016]

[0017] Among them, C v′ is the homogeneous vector of the folding point v′, C v′ =(x,y,z,1) T , and x, y, z are the three-dimensional coordinates of the folding point v′;

[0018] is the triangular face f i The Q matrix of the plane, And a, b, c, d are the triangular faces f i The plane coefficient of the plane.

[0019] Optionally, the calculating the model error distance of the second triangular mesh model relative to the initial triangular mesh model according to the surface error distances of all triangular faces within a ring region of the folding point includes:

[0020] Determine all the triangular faces f within a ring of the folding point v′ i ′ surface error distance dist(f i ′), and setting the maximum value as the model error distance.

[0021] Optionally, the calculating the model error distance of the second triangular mesh model relative to the initial triangular mesh model according to the surface error distances of all triangular faces within a ring region of the folding point includes:

[0022] Get each triangle f in the ring area of ​​the folding point v′ i ′ surface error distance dist(f i ′) and weight value w i ;

[0023] The model error distance D is calculated according to the following formula:

[0024]

[0025] Wherein, N is the total number of triangular faces within a ring area of ​​the folding point.

[0026] Optionally, after calculating the model error distance of the second triangular mesh model relative to the initial triangular mesh model based on the surface error distances of all triangular faces within a ring region of the folding point, the method further includes:

[0027] When the vertex of the edge to be folded is a boundary point of the first triangular mesh model, construct a virtual plane containing the vertex, and the normal of the virtual plane is perpendicular to the normal of the triangular face containing the edge to be folded;

[0028] Calculating a second distance from the to-be-folded point to the virtual plane;

[0029] When the second distance is greater than the model error distance, the second distance is set as the model error distance.

[0030] In order to achieve the above object, the present invention also provides a device for simplifying a triangular mesh model, and the device specifically comprises the following components:

[0031] A simplification module, configured to simplify the edges to be folded in the first triangular mesh model into folding points in the second triangular mesh model during the process of simplifying the first triangular mesh model into the second triangular mesh model;

[0032] A first calculation module is used to calculate the surface error distance of each triangular face within a ring area of ​​the folding point according to the surface error distance of each triangular face within a ring neighborhood of two vertices of the edge to be folded;

[0033] A second calculation module, configured to calculate a model error distance of the second triangular mesh model relative to the initial triangular mesh model according to the surface error distances of all triangular faces within a ring region of the folding point;

[0034] The judging module is used to judge whether the model error distance is greater than a preset error threshold, and if so, stop performing the simplification operation on the second triangular mesh model; if not, continue performing the simplification operation on the second triangular mesh model.

[0035] Optionally, the first computing module includes:

[0036] A determination unit is used to determine each triangular face f in a ring neighborhood of two vertices of the edge to be folded i The surface error distance dist(f i ); wherein the triangular face f i The surface error distance dist(f i ) has an initial value of 0;

[0037] The first processing unit is used to calculate the value of each triangle face f in a ring neighborhood from the folding point v′ to the two vertices of the edge to be folded. i The first distance dist(v′,f i );

[0038] A mapping unit is used to determine each triangular face f within a ring area of ​​the folding point v′i ′ and each triangular face f in a ring neighborhood of the two vertices of the edge to be folded i The mapping relationship;

[0039] The second processing unit is used to calculate the value of each triangular face f in a ring area of ​​the folding point v′ according to the mapping relationship. i ′ surface error distance dist(f i ′) = dist(f i )+dist(v′,f i ), where the triangle face f i ′ and the triangle face f i Have a mapping relationship.

[0040] In order to achieve the above-mentioned purpose, the present invention also provides a computer device, which specifically includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the steps of the method for simplifying the triangular mesh model introduced above when executing the computer program.

[0041] In order to achieve the above object, the present invention also provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the method for simplifying a triangular mesh model introduced above are implemented.

[0042] The method, device, equipment and readable storage medium for simplifying a triangular mesh model provided by the present invention attach the error distance of the simplified triangular mesh model relative to the initial triangular mesh model to the triangular faces of the local area during the simplification of the triangular mesh model. Each time the edge to be folded is folded, only the error information of the triangular faces within the one-ring domain of the two vertices of the edge to be folded is collected, and there is no need to collect the error information of all the triangular faces in the entire original triangular mesh model, so the data volume is small; in addition, during the simplification process, each time the edge to be folded is folded, only the distance from the folding point to the triangular faces within the one-ring domain of the two vertices of the edge to be folded is calculated, and the time complexity is small. The present invention can retain the characteristics of the original triangular mesh model to the maximum extent within the allowable error range, and can simplify the original triangular mesh model to the minimum number of facets. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:

[0044] Figure 1An optional flow chart of the method for simplifying a triangular mesh model provided in the first embodiment;

[0045] Figure 2 A partial schematic diagram of the first triangular mesh model before simplification in the first embodiment;

[0046] Figure 3 A partial schematic diagram of the simplified second triangular mesh model in the first embodiment;

[0047] Figure 4 is another partial schematic diagram of the first triangular mesh model before simplification in the first embodiment;

[0048] Figure 5 is another partial schematic diagram of the simplified second triangular mesh model in the first embodiment;

[0049] Figure 6 A schematic diagram of an optional composition structure of the device for simplifying the triangular mesh model provided in the second embodiment;

[0050] Figure 7 A schematic diagram of an optional hardware architecture of a computer device provided in Example 3. DETAILED DESCRIPTION

[0051] In order to make the purpose, technical scheme and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0052] Embodiment 1

[0053] The embodiment of the present invention provides a method for simplifying a triangular mesh model. Figure 1 As shown, the method specifically comprises the following steps:

[0054] Step S105: in the process of simplifying the first triangular mesh model into the second triangular mesh model, simplifying the edges to be folded in the first triangular mesh model into folding points in the second triangular mesh model.

[0055] Among them, the first triangular mesh model and the second triangular mesh model are different forms of the same building information model BIM; preferably, when the first triangular mesh model is an initial triangular mesh model of the building information model BIM, the second triangular mesh model is a simplified model of the initial triangular mesh model; in addition, when the first triangular mesh model is a simplified model of the building information model BIM, the second triangular mesh model is a model after the model is further simplified.

[0056] Specifically, before step S105, the method further includes:

[0057] Step S101: obtaining an initial triangular mesh model of a building information model BIM, and setting the initial triangular mesh model as a first triangular mesh model.

[0058] Step S102: Calculate the Q matrix of all nodes in the first triangular mesh model.

[0059] Among them, a node is the intersection of multiple edges in a triangular mesh model, and the definition of the Q matrix of a node is to calculate the sum of the distances from the target node to the planes where all triangular faces in a ring neighborhood around the target node are located. It should be noted that the triangular faces in a ring neighborhood around the target node refer to the triangular faces containing the target node, that is, one vertex in the triangular face is the target node.

[0060] Further, step S102 specifically includes:

[0061] Step A1: Calculate the homogeneous vector C of the target node v according to the three-dimensional coordinates (x, y, z) of the target node v v =(x,y,z,1) T ;

[0062] Step A2: Calculate the triangle f within the ring area from the target node v i The distance dist(v,f i ):

[0063]

[0064] in, is the triangular face f i The Q matrix of the plane, And a, b, c, d are the triangular faces f i The plane coefficient of the plane, i∈[1,N], N is the total number of triangles in the neighborhood around the target node v.

[0065] Step A3: Calculate the Q matrix Q of the target node v according to the following formula: v :

[0066]

[0067] The Q matrix of all nodes in the first triangular mesh model is calculated according to the above steps A1 to A3; it should also be noted that the Q matrix of the node can also be called the quadratic error matrix of the node.

[0068] Step S103: According to the Q matrix of all nodes, the error measure (quadric error metrics) of each edge in the first triangular mesh model and the position coordinates of each edge simplified to the folding point are calculated.

[0069] Further, step S103 specifically includes:

[0070] Step B1: Based on the Q matrix of the two vertices v1 and v2 of the target edge It is calculated that if the target edge is folded into a folding point v′, the Q matrix of the folding point v′ is

[0071] Among them, k is the length of the target edge, that is,

[0072] Step B2: Calculate the formula (C v′ ) T *Q v′ *C v′ The position coordinates of the folding point v′ corresponding to the minimum.

[0073] It should be noted that the formula (C v′ ) T *Q v′ *C v′ That is, the error measure of the target edge. In this embodiment, the position coordinates of the folding point v′ need to be calculated so that the formula (C v′ ) T *Q v′ *C v′ To achieve the minimum, it is necessary to minimize the quadratic error measure, which means that when the target edge is folded into a folding point, the lost geometric features are minimized.

[0074] Preferably, the position coordinates of the folding point v′ are calculated as follows:

[0075] Let the Q matrix of the folding point v′ be

[0076] The minimization of the quadratic error measure should be such that the partial differential results of the measure equation for x, y, and z should all be 0, that is:

[0077]

[0078] We get the equation:

[0079]

[0080] Then the position coordinates of the folding point v′ are:

[0081]

[0082] Step B3: Calculate the error measure δ of the target edge according to the position coordinates of the folding point v′ = (C v′ ) T *Q v′ *C v′ Among them, C v′ is the homogeneous vector of the folding point v′.

[0083] According to the above steps B1 to B3, the error measure of each edge in the first triangular mesh model and the position coordinates of the folding point corresponding to each edge after being folded are calculated; that is, each edge has a corresponding error measure and the position coordinates of the folding point.

[0084] Step S104: sort all edges in ascending order according to the error measure of each edge.

[0085] In this embodiment, after obtaining the error measure δ of each edge, all edges need to be sorted from small to large according to the error measure. The sorting method is to use the heap data structure heap. When an edge is inserted into the heap, the insertion position is determined according to the size of its error measure. Therefore, after traversing all edges, the obtained heap is sorted and sorted from small to large according to the error measure.

[0086] Furthermore, the step S105 specifically includes:

[0087] According to the sorting result, the edge with the smallest error measure is set as the edge to be folded, and the second triangular mesh model is generated according to the position coordinates of the folding point corresponding to the edge to be folded.

[0088] In this embodiment, according to the sorting result, the first triangular mesh model is simplified starting from the edge with the smallest error measure, and one edge is simplified each time. The simplification process is a process of aggregating two vertices of an edge into one point; Figure 2 As shown in FIG. 1 , it is a local schematic diagram of the first triangular mesh model before simplification. Figure 3FIG. 1 is a partial schematic diagram of the simplified second triangular mesh model; the two vertices of the edge to be folded in the first triangular mesh model are v1 and v2, and the folding point in the second triangular mesh model is v′; the specific simplification process is divided into two steps: (1) deleting all the triangular faces within the one-ring area of ​​vertices v1 and v2 to form a hollow area; (2) reconstructing the triangular faces using the edge points of the hollow area and the folding point v′.

[0089] Step S106: Calculate the surface error distance of each triangular face within a ring neighborhood of the two vertices of the edge to be folded according to the surface error distance of each triangular face within a ring neighborhood of the folding point.

[0090] Specifically, step S106 includes:

[0091] Step C1: Determine each triangular face f in a ring neighborhood of two vertices of the edge to be folded i The surface error distance dist(f i ); wherein the triangular face f i The surface error distance dist(f i ) has an initial value of 0 and i is a positive integer.

[0092] In step C1, the surface error distance of the triangular surface within a ring area of ​​each vertex needs to be determined respectively; it should be noted that, if Figure 2 As shown, the triangles in the ring area of ​​two vertices will be repeated. Figure 2 In the figure, the two gray triangles are both within the ring area of ​​vertex v1 and within the ring area of ​​vertex v2. When the simplification operation is performed on the initial triangular mesh model for the first time, the initial value of the face error distance of each triangle in the initial triangular mesh model is 0, but as the simplification operation continues, the face error distance of each triangle will continue to accumulate.

[0093] Step C2: Calculate the value of each triangle face f in a ring neighborhood from the folding point v′ to the two vertices of the edge to be folded. i The first distance dist(v′,f i );

[0094] Furthermore, step C2 specifically includes:

[0095] The first distance dist(v′,f i ):

[0096]

[0097] Among them, C v′ is the homogeneous vector of the folding point v′, C v′ =(x,y,z,1)T , and x, y, z are the three-dimensional coordinates of the folding point v′;

[0098] is the triangular face f i The Q matrix of the plane, And a, b, c, d are the triangular faces f i The plane coefficient of the plane.

[0099] Step C3: Determine each triangular face f within a ring region of the folding point v′ i ′ and each triangular face f in a ring neighborhood of the two vertices of the edge to be folded i The mapping relationship;

[0100] For example, Figure 2 and Figure 3 As shown, the vertices of the edge to be folded are v1 and v2, and the folding point is v′; wherein the triangular face f in the first triangular mesh model has a mapping relationship with the triangular face f′ in the second triangular mesh model. It should also be noted that, Figure 2 and Figure 3 As shown, there are no triangular faces in the second triangular mesh model that have a mapping relationship with the gray triangular faces in the first triangular mesh model.

[0101] Step C4: According to the mapping relationship, calculate the value of each triangle face f in a ring area of ​​the folding point v′. i ′ surface error distance dist(f i ′) = dist(f i )+dist(v′,f i ), where the triangle face f i ′ and the triangle face f i Have a mapping relationship.

[0102] It should be noted that when the first triangular mesh model is the initial triangular mesh model of the building, the face error distance of each triangular face in the initial triangular mesh model is 0. As the simplification operation continues, the errors generated by each edge to be folded will be accumulated, and the face error distance of each triangular face will continue to change, thereby obtaining a result value that is closer to the actual error. It should also be noted that the first distance dist(v′,f i ) represents the error distance from the second triangular mesh model to the first triangular mesh model, and the triangular face f i ′ surface error distance dist(f i ′) has a cumulative component, which represents the error distance from the second triangular mesh model to the initial triangular mesh model.

[0103] Step S107: Calculate the model error distance of the second triangular mesh model relative to the initial triangular mesh model according to the surface error distances of all triangular faces within a ring region of the folding point.

[0104] Specifically, in step S107, the model error distance may be calculated in the following two ways:

[0105] Method 1: Determine all triangular faces f within a ring of the folding point v′ i ′ surface error distance dist(f i ′), and setting the maximum value as the model error distance.

[0106] Method 2: Get each triangle f within a ring of the folding point v′ i ′ surface error distance dist(f i ′) and weight value w i ;

[0107] The model error distance D is calculated according to the following formula:

[0108]

[0109] Wherein, N is the total number of triangular faces within a ring area of ​​the folding point.

[0110] Preferably, the weight value w of each triangle is i You can take the area weight, that is, the triangle face f i The area of ​​′ can also be taken as the angle weight, that is, the triangle face f i The internal angle at the vertex v′ in ′ can also take a uniform weight value of 1.0.

[0111] In addition, the model error distance of the second triangular mesh model relative to the initial triangular mesh model may also be calculated in the existing manner, as follows:

[0112] Initialize the face collection as well as For each node in the first triangular mesh model, use the face set fset(v i ) represents the vertex v i All triangular faces within a ring domain; when an edge collapse is performed, the face set A = A∪fset(v1)∪fset(v2) is updated, and the face set B = fset(v′) is updated, and finally the model error distance D = max(H(A, B), H(B, A)) is calculated; where H(A, B) represents the Hausdorff distance between the face set A and the face set B, and ||f1-f2|| represents the distance between triangle face f1 and triangle face f2. It is necessary to calculate the distances from the three vertices of f1 to triangle face f2 respectively and take the maximum value or average value. However, this calculation method will make the size of face set A larger and larger as the number of edge folding increases, and eventually reach the scale of O(n), where n is the total number of triangle faces in the original mesh, making the data volume particularly large. In addition, each time an edge is folded, the Hausdorff distance between the simplified model and the original model needs to be recalculated. The characteristic is that when the size of the original model is large, the calculation efficiency decreases rapidly and the time cost will be very high.

[0113] Furthermore, after step S107, the method further includes:

[0114] Step D1: when the vertex of the edge to be folded is a boundary point of the first triangular mesh model, construct a virtual plane containing the vertex, and the normal of the virtual plane is perpendicular to the normal of the triangular face containing the edge to be folded;

[0115] For example, Figure 4 As shown, it is a local schematic diagram of the first triangular mesh model before simplification, wherein the two vertices of the edge to be folded are v1 and v2, and vertices v0 and v1 are boundary points of the first triangular mesh model; the dotted box is a constructed virtual plane, which is perpendicular to the only triangular face related to the edge.

[0116] Step D2: calculating a second distance from the to-be-folded point to the virtual plane;

[0117] For example, Figure 5 As shown, it is a local schematic diagram of the simplified second triangular mesh model, wherein the folding point is v′. At this time, it is also necessary to calculate the distance from the folding point v′ to the virtual plane.

[0118] Step D3: When the second distance is greater than the model error distance, the second distance is set as the model error distance.

[0119] The general model simplification algorithm has unstable calculation results and does not provide special protection for the model boundaries. When folding the boundary edges, large geometric errors may occur with the original triangular mesh model.

[0120] Step S108: determining whether the model error distance is greater than a preset error threshold, if so, stopping the simplification operation on the second triangular mesh model, if not, continuing the simplification operation on the second triangular mesh model.

[0121] In this embodiment, when the model error distance is less than the preset error threshold, the second triangular mesh model is re-used as the first triangular mesh model, and step S102 is re-executed. When the edge to be folded is folded, a new folding point is generated, resulting in a change in the plane where all triangular faces in a ring around the folding point are located. Therefore, it is necessary to recalculate the secondary error matrix Q for the vertices involved in these triangular faces, and the calculation method still uses the method described in step S102. After the Q matrix of these vertices is updated, it is necessary to update the error measure of the edges involved in these vertices and calculate the new folding points, and reinsert them into the heap. The method used is still the method described in step S103.

[0122] In this embodiment, when simplifying the triangular mesh model, an edge to be folded in the triangular mesh model is folded into a folding point, and a triangular face is reconstructed based on the folding point, thereby reducing the number of edges in the triangular mesh model, and then reducing the number of triangular faces in the triangular mesh model, so as to achieve the purpose of simplifying the data volume of the building information model BIM. It should also be noted that in each simplification process, only one edge is folded into a point, and multiple edges are not folded at one time.

[0123] In this embodiment, when a folding is completed, it is necessary to determine whether the simplified triangular mesh model meets the simplification standard. If it meets the simplification standard, the simplification process is exited. If it does not meet the simplification standard, the process returns to step S102 and continues to fold the edges with the minimum error measure until the simplification standard is met and the simplification process is exited. In addition to the simplification standard of step S108, the simplification standard can also be any of the following: (1) There are no triangular faces in the second triangular mesh model; (2) The total number of triangular faces in the second triangular mesh model is less than the preset threshold input by the user; (3) The minimum error measure of all edges in the second triangular mesh model is infinite.

[0124] In this embodiment, by attaching the error distance of the simplified second triangular mesh model relative to the initial triangular mesh model to each triangular face, each time the edge is folded, only the triangular faces within the range of two vertices and one ring of the folded edge are collected, and the amount of data is relatively small; each time the edge is folded, only the distance from the folding point to the triangular faces within the range of two vertices and one ring of the folded edge is calculated, and the distances are accumulated and attached to these triangular faces, and the time complexity is relatively low; in addition, when the folded edge is a boundary edge, the distance from the folding point to the virtual plane where the folded edge is located is additionally calculated, thereby improving the error accuracy.

[0125] In summary, this embodiment provides a method for adaptively judging the quality of a simplified triangular mesh model, and quickly calculating the error distance between the simplified triangular mesh model and the original triangular mesh model, thereby automatically calculating the optimal solution for model simplification.

[0126] Embodiment 2

[0127] The embodiment of the present invention provides a device for simplifying a triangular mesh model, such as Figure 6 As shown, the device specifically includes the following components:

[0128] A simplification module 601 is used for simplifying the to-be-folded edges in the first triangular mesh model into folding points in the second triangular mesh model during the process of simplifying the first triangular mesh model into the second triangular mesh model;

[0129] A first calculation module 602 is used to calculate the surface error distance of each triangular face within a ring area of ​​the folding point according to the surface error distance of each triangular face within a ring neighborhood of two vertices of the edge to be folded;

[0130] A second calculation module 603 is used to calculate the model error distance of the second triangular mesh model relative to the initial triangular mesh model according to the surface error distances of all triangular faces within a ring area of ​​the folding point;

[0131] The judgment module 604 is used to judge whether the model error distance is greater than a preset error threshold. If so, the simplification operation on the second triangular mesh model is stopped; if not, the simplification operation on the second triangular mesh model is continued.

[0132] Specifically, the first calculation module 602 includes:

[0133] A determination unit is used to determine each triangular face f in a ring neighborhood of two vertices of the edge to be folded i The surface error distance dist(f i ); wherein the triangular face f i The surface error distance dist(f i ) has an initial value of 0;

[0134] The first processing unit is used to calculate the value of each triangle face f in a ring neighborhood from the folding point v′ to the two vertices of the edge to be folded. i The first distance dist(v′,f i );

[0135] A mapping unit is used to determine each triangular face f within a ring area of ​​the folding point v′ i ′ and each triangular face f in a ring neighborhood of the two vertices of the edge to be folded i The mapping relationship;

[0136] The second processing unit is used to calculate the value of each triangular face f in a ring area of ​​the folding point v′ according to the mapping relationship. i ′ surface error distance dist(fi ′) = dist(f i )+dist(v′,f i ), where the triangle face f i ′ and the triangle face f i Have a mapping relationship.

[0137] Furthermore, the first processing unit is specifically configured to:

[0138] The first distance dist(v′,f i ):

[0139]

[0140] Among them, C v′ is the homogeneous vector of the folding point v′, C v′ =(x,y,z,1) T , and x, y, z are the three-dimensional coordinates of the folding point v′;

[0141] is the triangular face f i The Q matrix of the plane, And a, b, c, d are the triangular faces f i The plane coefficient of the plane.

[0142] Furthermore, the second calculation module 603 is specifically configured to:

[0143] Determine all the triangular faces f within a ring of the folding point v′ i ′ surface error distance dist(f i ′), and setting the maximum value as the model error distance.

[0144] Furthermore, the second calculation module 603 is further used for:

[0145] Get each triangle f in the ring area of ​​the folding point v′ i ′ surface error distance dist(f i ′) and weight value w i ;

[0146] The model error distance D is calculated according to the following formula:

[0147]

[0148] Wherein, N is the total number of triangular faces within a ring area of ​​the folding point.

[0149] Furthermore, the method further comprises:

[0150] A correction module is used for, before triggering the judgment module 604, when the vertex of the edge to be folded is a boundary point of the first triangular mesh model, constructing a virtual plane containing the vertex, and the normal of the virtual plane is perpendicular to the normal of the triangular face containing the edge to be folded; calculating a second distance from the point to be folded to the virtual plane; when the second distance is greater than the model error distance, setting the second distance to the model error distance.

[0151] Embodiment 3

[0152] This embodiment also provides a computer device, such as a smart phone, tablet computer, laptop computer, desktop computer, rack server, blade server, tower server or cabinet server (including an independent server or a server cluster composed of multiple servers) that can execute programs. Figure 7 As shown, the computer device 70 of this embodiment includes at least but not limited to: a memory 701 and a processor 702 that can be interconnected through a system bus. It should be noted that Figure 7 Only computer device 70 is shown with components 701 - 702 , but it should be understood that implementing all of the components shown is not a requirement, and more or fewer components may alternatively be implemented.

[0153] In this embodiment, the memory 701 (i.e., a readable storage medium) includes a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., an SD or DX memory, etc.), a random access memory (RAM), a static random access memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the memory 701 may be an internal storage unit of the computer device 70, such as a hard disk or a memory of the computer device 70. In other embodiments, the memory 701 may also be an external storage device of the computer device 70, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the computer device 70. Of course, the memory 701 may also include both the internal storage unit and the external storage device of the computer device 70. In this embodiment, the memory 701 is generally used to store the operating system and various application software installed on the computer device 70. In addition, the memory 701 may also be used to temporarily store various types of data that have been output or are to be output.

[0154] In some embodiments, the processor 702 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips. The processor 702 is generally used to control the overall operation of the computer device 70 .

[0155] Specifically, in this embodiment, the processor 702 is used to execute the program of the method for simplifying the triangular mesh model stored in the memory 701, and the program of the method for simplifying the triangular mesh model implements the following steps when being executed:

[0156] In the process of simplifying the first triangular mesh model into the second triangular mesh model, simplifying the to-be-folded edges in the first triangular mesh model into folding points in the second triangular mesh model;

[0157] Calculate the surface error distance of each triangular face in a ring area of ​​the folding point according to the surface error distance of each triangular face in a ring neighborhood of two vertices of the edge to be folded;

[0158] Calculating a model error distance of the second triangular mesh model relative to the initial triangular mesh model according to the surface error distances of all triangular faces within a ring region of the folding point;

[0159] It is determined whether the model error distance is greater than a preset error threshold. If so, the simplification operation on the second triangular mesh model is stopped; if not, the simplification operation on the second triangular mesh model is continued.

[0160] The specific implementation process of the above method steps can be found in the first embodiment, and this embodiment will not be repeated here.

[0161] Embodiment 4

[0162] This embodiment also provides a computer-readable storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory (for example, an SD or DX memory, etc.), a random access memory (RAM), a static random access memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a disk, an optical disk, a server, an App application store, etc., on which a computer program is stored. When the computer program is executed by a processor, the following method steps are implemented:

[0163] In the process of simplifying the first triangular mesh model into the second triangular mesh model, simplifying the to-be-folded edges in the first triangular mesh model into folding points in the second triangular mesh model;

[0164] Calculate the surface error distance of each triangular face in a ring area of ​​the folding point according to the surface error distance of each triangular face in a ring neighborhood of two vertices of the edge to be folded;

[0165] Calculating a model error distance of the second triangular mesh model relative to the initial triangular mesh model according to the surface error distances of all triangular faces within a ring region of the folding point;

[0166] It is determined whether the model error distance is greater than a preset error threshold. If so, the simplification operation on the second triangular mesh model is stopped; if not, the simplification operation on the second triangular mesh model is continued.

[0167] The specific implementation process of the above method steps can be found in the first embodiment, and this embodiment will not be repeated here.

[0168] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.

[0169] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0170] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method.

[0171] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A method for simplifying a triangular mesh model, characterized in that: The method comprises: In the process of simplifying the first triangular mesh model into the second triangular mesh model, simplifying the to-be-folded edges in the first triangular mesh model into folding points in the second triangular mesh model; Calculate the surface error distance of each triangular face in a ring area of ​​the folding point according to the surface error distance of each triangular face in a ring neighborhood of two vertices of the edge to be folded; Calculating a model error distance of the second triangular mesh model relative to the initial triangular mesh model according to the surface error distances of all triangular faces within a ring region of the folding point; Determine whether the model error distance is greater than a preset error threshold, if so, stop performing the simplification operation on the second triangular mesh model, if not, continue performing the simplification operation on the second triangular mesh model; Wherein, after calculating the model error distance of the second triangular mesh model relative to the initial triangular mesh model according to the surface error distances of all triangular faces within a ring region of the folding point, the method further includes: When the vertex of the edge to be folded is a boundary point of the first triangular mesh model, construct a virtual plane containing the vertex, and the normal of the virtual plane is perpendicular to the normal of the triangular face containing the edge to be folded; Calculating a second distance from the folding point to the virtual plane; When the second distance is greater than the model error distance, the second distance is set as the model error distance.

2. The method for simplifying a triangular mesh model according to claim 1, characterized in that: The step of calculating the surface error distance of each triangular face within a ring region of the folding point according to the surface error distance of each triangular face within a ring region of two vertices of the edge to be folded includes: Determine each triangle face f in a ring neighborhood of two vertices of the edge to be folded i The surface error distance dist(f i ); wherein the triangular face f i The surface error distance dist(f i ) has an initial value of 0; Calculate the value of each triangle f in the neighborhood of the folding point v′ to the two vertices of the edge to be folded i The first distance dist(v′,f i ); Determine each triangular face f' within a ring area of ​​the folding point v' i Each triangular face f in a ring neighborhood of two vertices of the edge to be folded i The mapping relationship of According to the mapping relationship, the value of each triangle face f in the ring area of ​​the folding point v′ is calculated. i ′ surface error distance dist(f′ i )=dist(f i )+dist(v′,f i ), where the triangle face f′ i With the triangle face f i Have a mapping relationship.

3. The method for simplifying a triangular mesh model according to claim 2, characterized in that: The calculation is as follows: each triangular face f in a ring neighborhood from the folding point v′ to the two vertices of the edge to be folded i The first distance dist(v′,f i ), including: The first distance dist(v′,f i ): Among them, C v′ is the homogeneous vector of the folding point v′, C v′ =(x,y,z,1) T , and x, y, z are the three-dimensional coordinates of the folding point v′; is the triangular face f i The Q matrix of the plane, And a, b, c, d are the triangular faces f i The plane coefficient of the plane.

4. The method for simplifying a triangular mesh model according to claim 2, characterized in that: The step of calculating the model error distance of the second triangular mesh model relative to the initial triangular mesh model according to the surface error distances of all triangular faces within a ring region of the folding point comprises: Determine all the triangular faces f within a ring of the folding point v′ i ′ surface error distance dist(f i ′), and setting the maximum value as the model error distance.

5. The method for simplifying a triangular mesh model according to claim 2, characterized in that: The step of calculating the model error distance of the second triangular mesh model relative to the initial triangular mesh model according to the surface error distances of all triangular faces within a ring region of the folding point comprises: Get each triangle f' in the ring area of ​​the folding point v' i The surface error distance dist(f′ i ) and weight value w i ; The model error distance D is calculated according to the following formula: Wherein, N is the total number of triangular faces within a ring area of ​​the folding point.

6. A device for simplifying a triangular mesh model, characterized in that: The device comprises: A simplification module, configured to simplify the edges to be folded in the first triangular mesh model into folding points in the second triangular mesh model during the process of simplifying the first triangular mesh model into the second triangular mesh model; A first calculation module is used to calculate the surface error distance of each triangular face within a ring area of ​​the folding point according to the surface error distance of each triangular face within a ring neighborhood of two vertices of the edge to be folded; A second calculation module, used for calculating the model error distance of the second triangular mesh model relative to the initial triangular mesh model according to the surface error distances of all triangular faces within a ring area of ​​the folding point; a judging module, configured to judge whether the model error distance is greater than a preset error threshold, and if so, stop performing the simplification operation on the second triangular mesh model; if not, continue performing the simplification operation on the second triangular mesh model; Wherein, the device further comprises: A correction module is used to, before triggering the judgment module, construct a virtual plane containing the vertex when the vertex of the edge to be folded is a boundary point of the first triangular mesh model, and the normal of the virtual plane is perpendicular to the normal of the triangular face containing the edge to be folded; calculate the second distance from the folding point to the virtual plane; when the second distance is greater than the model error distance, set the second distance to the model error distance.

7. The device for simplifying a triangular mesh model according to claim 6, characterized in that: The first calculation module includes: A determination unit is used to determine each triangular face f in a ring neighborhood of two vertices of the edge to be folded i The surface error distance dist(f i ); wherein the triangular face f i The surface error distance dist(f i ) has an initial value of 0; The first processing unit is used to calculate the value of each triangle face f in a ring neighborhood from the folding point v′ to the two vertices of the edge to be folded. i The first distance dist(v′,f i ); A mapping unit is used to determine each triangular face f within a ring area of ​​the folding point v′ i ′ and each triangular face f in a ring neighborhood of the two vertices of the edge to be folded i The mapping relationship of The second processing unit is used to calculate each triangular face f′ within a ring area of ​​the folding point v′ according to the mapping relationship. i The surface error distance dist(f′ i )=dist(f i )+dist(v′,f i ), where the triangle face f′ i With the triangle face f i Have a mapping relationship.

8. A computer device, comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method according to any one of claims 1 to 5 when executing the computer program.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.