A method and device for difference analysis of 3D geometric models
Patent Information
- Application Number
- CN202610916127.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-24
- Publication Date
- 2026-10-09
AI Technical Summary
[0002]现有的三维模型差异分析大多基于网格顶点或几何度量进行,基于网格顶点或几何度量的三维模型差异评估方法通常依赖于模型间网格顶点的一一对应关系,当待比对模型与参考模型在拓扑结构、网格划分方式或设计版本上存在差异时,上述方法难以直接适用,存在适用范围受限的问题
[0038]通过同时获取采样点在两个方向上的距离,并取二者中的较大值作为该采样点的对称距离,从而构建完整的几何模型差异度量指标,上述方式能够同时反映两个几何模型之间的正向差异与反向差异,避免单向距离计算可能产生的遗漏问题,此外,采样过程根据三角面片面积进行加权随机采样,从而保证采样点在几何模型表面的分布均匀,降低了小面片区域因采样不足而被忽略,而大面片区域的过度采样的风险。
Smart Images

Figure CN122888280A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of engineering drawing technology, and more specifically, this invention relates to a method and apparatus for difference analysis of 3D geometric models. Background Technology
[0002] Existing 3D model difference analysis is mostly based on mesh vertices or geometric metrics. 3D model difference assessment methods based on mesh vertices or geometric metrics usually rely on the one-to-one correspondence between mesh vertices of the models. When the model to be compared and the reference model differ in topology, meshing method, or design version, the above methods are difficult to apply directly and have limited applicability.
[0003] Furthermore, the above method only calculates distance information at the vertices of the mesh, without covering the non-vertice areas of the mesh surface. This results in a decrease in the spatial resolution of the difference assessment and makes it easy to overlook subtle local deformations or small-scale geometric deviations. Therefore, it still has significant limitations in practical engineering applications. Summary of the Invention
[0004] In view of this, this application provides a 3D geometric model difference analysis method, which aims to improve at least one of the above-mentioned problems.
[0005] Specifically, the following technical solutions are included:
[0006] On the one hand, embodiments of this application provide a method for difference analysis of 3D geometric models, the method being as follows:
[0007] (1) Spatial alignment of the two geometric models to be analyzed;
[0008] (2) Mesh the two geometric models and perform weighted random sampling on the corresponding triangular facets based on their areas;
[0009] (3) Calculate the distance between a sampling point on one geometric model and the nearest triangular facet on another geometric model;
[0010] (4) Map the sampling point distance of one geometric model to the sampling point of another geometric model, and take the maximum distance between the two distances of the same sampling point as the symmetrical distance of the corresponding sampling point.
[0011] In some embodiments of the present invention, the same number of sampling points are formed on the surfaces of the two geometric models.
[0012] In some embodiments of the present invention, the sampling process is as follows:
[0013] (21) Traverse the triangular facets on the geometric model, calculate the area of each triangular facet and its area ratio in the geometric model, and use the area ratio as the sampling probability of the corresponding triangular facet.
[0014] (22) Generate a random number Find the cumulative sampling probability that satisfies the cumulative distribution function. The index k of the triangle will select the triangle. Add the sample set and repeat step (22) to obtain the sample set of the geometric model;
[0015] (23) For each triangular facet in the sample set, randomly generate sampling points inside the triangular facet and record the attributes of the corresponding sampling points.
[0016] In some embodiments of the present invention, the attributes of the sampling point include: the coordinates of the sampling point, the index of the triangular facet to which it belongs, and the unit normal vector of the triangular facet to which it belongs.
[0017] In some embodiments of the present invention, the process of obtaining the distance from a sampling point to the nearest triangular facet on another geometric model is as follows:
[0018] (31) Voxelize the geometric model and map the triangular facets of the geometric model to each voxel mesh;
[0019] (32) Map the sampling point to the voxel mesh of another geometric model, determine the target voxel mesh where the sampling point is located and the neighboring voxel meshes of the target voxel mesh, and take the triangular facets corresponding to the target voxel mesh and the neighboring voxel meshes as candidate triangular facets;
[0020] (33) Read the unit normal vector n1 of the triangular facet to which the sampling point belongs and the unit normal vector n2 of each candidate triangular facet. Calculate the angle between the unit normal vector n1 and the unit normal vector n2 of each candidate triangular facet. Retain the candidate triangular facets whose angle is less than the set angle threshold. Calculate the distance between the sampling point and each retained candidate triangular facet. Take the minimum distance as the distance of the corresponding sampling point.
[0021] In some embodiments of the present invention, a spatial index structure for voxel meshes in a geometric model is constructed based on a KD tree, and neighboring voxel meshes of the target voxel mesh are found based on the spatial index structure.
[0022] In some embodiments of the present invention, the method includes:
[0023] Based on the symmetrical distance, the triangular facets containing the corresponding sampling points are classified into different levels of difference, and different colors are used to color the point cloud within the corresponding triangular facets for different levels of difference.
[0024] On the other hand, embodiments of this application provide a 3D geometric model difference analysis device, the device comprising:
[0025] Alignment cells are used to spatially align two geometric models to be analyzed.
[0026] The sampling unit is used to mesh the geometric model and perform weighted random sampling on the corresponding triangular facets based on their area.
[0027] The bidirectional distance calculation unit is used to calculate the distance between a sampling point on one geometric model and the nearest triangular facet on another geometric model;
[0028] The symmetric distance determination unit is used to map the distance of sampling points of one geometric model to sampling points of another geometric model, and takes the maximum distance of the two distances of the same sampling point as the symmetric distance of the corresponding sampling point.
[0029] In some embodiments of the present invention, the sampling unit includes:
[0030] The sampling probability generation module is used to calculate the sampling probability of each triangular facet, and uses the area ratio of the triangular facet as the sampling probability of the corresponding triangular facet.
[0031] The sampling module is used to extract triangular patches whose cumulative sampling probability satisfies a random number, and to form sampling points inside the extracted triangular patches.
[0032] The recording module is used to record the attributes of each sampling point.
[0033] In some embodiments of the present invention, the bidirectional distance calculation unit includes:
[0034] The mapping module is used to map triangular faces in the geometric model onto the divided voxel mesh;
[0035] The index structure building module is used to construct the spatial index structure of the voxel grid using a KD tree.
[0036] The candidate triangle selection module is used to map the sampling point to the voxel mesh of another geometric model, determine the target voxel mesh where the sampling point is located and the neighboring voxel meshes of the target voxel mesh, and use the triangles corresponding to the target voxel mesh and the neighboring voxel meshes as candidate triangles.
[0037] The distance calculation module is used to select candidate triangular faces that are aligned with the unit normal vector direction of the sampling point, and to take the minimum distance between the sampling point and each candidate triangular face as the distance of the sampling point.
[0038] By simultaneously obtaining the distances of sampling points in two directions and taking the larger of the two values as the symmetrical distance of the sampling point, a complete geometric model difference metric is constructed. This method can simultaneously reflect the positive and negative differences between two geometric models, avoiding the omission problem that may occur in unidirectional distance calculation. In addition, the sampling process performs weighted random sampling based on the area of the triangular facets, thereby ensuring that the sampling points are evenly distributed on the surface of the geometric model and reducing the risk of small facet areas being ignored due to insufficient sampling, while large facet areas are oversampled. Attached Figure Description
[0039] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0040] Figure 1 A flowchart of a method for difference analysis of 3D geometric models provided in an embodiment of the present invention;
[0041] Figure 2 A schematic diagram of the structure of the 3D geometric model difference analysis device provided in an embodiment of the present invention;
[0042] The accompanying drawings have illustrated specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to specific embodiments. Detailed Implementation
[0043] 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, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0044] Unless otherwise defined, all technical terms used in the embodiments of this application have the same meaning as commonly understood by one of ordinary skill in the art.
[0045] This invention proposes a symmetry difference analysis method for 3D geometric models. It simultaneously obtains the distances of sampling points in two directions and takes the larger of the two values as the symmetry distance of that point, thereby constructing a complete geometric model difference metric. This method can simultaneously reflect the positive and negative differences between two geometric models, avoiding the omission problem that may occur in unidirectional distance calculation. In addition, the sampling process uses weighted random sampling based on the area of triangular facets to ensure that the sampling points are evenly distributed on the surface of the geometric model, reducing the risk of small facet areas being ignored due to insufficient sampling and large facet areas being oversampled. Furthermore, by establishing a spatial index structure, it is possible to quickly realize the query of neighboring voxel meshes of the target voxel mesh of the mapped sampling point and the mapping of subsequent sampling points, improving the accuracy, visualization intuitiveness and engineering practicality of difference detection between complex geometric models.
[0046] Figure 1 A flowchart of a method for difference analysis of 3D geometric models provided in an embodiment of the present invention is shown below:
[0047] (1) Spatial alignment of the two geometric models to be analyzed;
[0048] In this embodiment of the invention, the two geometric models to be analyzed are referred to as the first geometric model and the second geometric model, respectively. In order to eliminate the initial positional deviation between the first geometric model and the second geometric model, the first geometric model and the second geometric model are spatially aligned. Specifically, the initial translation vector between the first geometric model and the second geometric model, which are located in the same coordinate system, is calculated based on the centroid of the point set of the two geometric models. By iteratively adjusting the translation vector, the overall geometric distance error between the two geometric models is minimized, thereby obtaining the optimal alignment result.
[0049] (2) Mesh the two geometric models and perform weighted random sampling on the corresponding triangular facets based on their area;
[0050] The first and second geometric models are meshed, and the vertex coordinates of each triangular facet are extracted from the first and second geometric models respectively. The triangular facets on the surfaces of the first and second geometric models are sampled respectively. Since there are too many point clouds in the geometric models, and the number of point clouds in the first and second geometric models is different, the number of points participating in the difference analysis is reduced by sampling. At the same time, the number of samples in the first and second geometric models is the same, that is, the same number of sampling points are formed, which facilitates the difference comparison between the first and second geometric models.
[0051] In this embodiment of the invention, after the geometric model is meshed, the first and second geometric models are uniformly sampled respectively. The sampling process uses weighted random sampling based on the area of the triangular facets to ensure that the sampling points are evenly distributed on the surface of the geometric model, reducing the risk of small facets being ignored due to insufficient sampling and large facets being oversampled. The specific sampling strategy for the geometric model is as follows:
[0052] (21) Traverse the triangular facets on the geometric model, calculate the area of each triangular facet and its area ratio in the geometric model. In order to achieve a better probability of sampling triangular facets with larger areas, the area ratio is used as the sampling probability of the corresponding triangular facet.
[0053] In this embodiment of the invention, the formula for calculating the area of the i-th triangular facet is as follows:
[0054] ;
[0055] in, , , Let represent the coordinates of the three vertices of the i-th triangular facet. Represents the cross product of vectors. This represents the Euclidean norm.
[0056] In this embodiment of the invention, the sampling probability of the i-th triangular facet... The specific calculation formula is as follows:
[0057] ;
[0058] in, This represents the total number of triangular facets on the geometric model.
[0059] (22) Generate a random number Find the cumulative probability that satisfies the cumulative distribution function. The index k of the selected triangle is used to determine the triangle's index. Place them into the corresponding sample set, and repeat step (22) N times (e.g., N=1000000) to obtain a sample set containing all the triangular faces to be sampled.
[0060] By using a large number of independent random samples, the statistical results are used to approximate the true spatial distribution, thereby meeting the needs of practical applications.
[0061] In this embodiment of the invention, the cumulative distribution function (CDF) is expressed as follows:
[0062] ;
[0063] in, This represents the cumulative probability corresponding to index k;
[0064] (23) For each triangular facet in the sample set, randomly generate sampling points inside the triangular facet.
[0065] For each selected triangular facet, a random sampling point is generated within it. The sampling points are uniformly distributed using the centroid coordinate method, and the specific generation process is as follows:
[0066] Generate two independent random numbers , The centroid coordinates and the coordinates of the sampling points under the centroid coordinates are determined based on two random numbers, and the attributes of the sampling points are recorded.
[0067] In an embodiment of the present invention, if Then let , First, map the point back to the interior of the triangular facet, then calculate the centroid coordinates. The specific coordinates of the centroid are as follows:
[0068] , , ;
[0069] like Then, the centroid coordinates can be calculated directly based on the above formula.
[0070] The coordinates of the sampling point are:
[0071] ;
[0072] in, , , This indicates the coordinates of the vertex of the selected triangular facet. The above method ensures that the sampling points are evenly distributed across the area of the triangle, without edge clustering or center bias.
[0073] After determining the sampling points in the three-dimensional surface patch, record the attributes of the corresponding sampling points, including: the coordinates of the sampling points. The index k of the triangular facet and the unit normal vector n of the triangular facet are calculated by normalizing the cross product of the vertices of the triangular facet in counterclockwise order.
[0074] Based on the above steps (31) to (23), the sampling of the surfaces of the first geometric model and the second geometric model is completed respectively.
[0075] (3) Calculate the Euclidean distance between a sampling point on one geometric model and the nearest triangular facet on another geometric model;
[0076] In this embodiment of the invention, after sampling the first geometric model and the second geometric model based on step (2), the triangular facets are mapped to voxel units according to their spatial positions, and a spatial index structure of the voxel grid is constructed based on the KD tree, thereby providing efficient data structure support for subsequent nearest neighbor search.
[0077] Calculate the first minimum bounding box of the first geometric model and the second minimum bounding box of the second geometric model. Divide the first and second minimum bounding boxes into voxels based on the set voxel mesh resolution. Map the triangular faces in the first geometric model to the voxel mesh of the first geometric model. Add the index k of the triangular face to the candidate list of the voxel mesh. Since a triangular face may exist in multiple voxel meshes, add the index of the triangular face to the candidate list of the multiple voxel meshes. Traverse all triangular faces in the first geometric model to form a first mapping table. Similarly, map the triangular faces in the second geometric model to the voxel mesh of the second geometric model. Add the index k of the triangular face to the candidate list of the voxel mesh. Traverse all triangular faces in the second geometric model to form a second mapping table.
[0078] In this embodiment of the invention, the Euclidean distance between a sampling point on the first geometric model and the nearest triangular facet on the second geometric model, and the Euclidean distance between a sampling point at a corresponding position on the second geometric model and the nearest triangular facet on the first geometric model are calculated. This yields the distances in two directions between sampling points at the same position on the two geometric models. The method for determining the Euclidean distance between a sampling point on the first geometric model and the nearest triangular facet on the second geometric model is as follows:
[0079] (31) Map the sampling points in the first geometric model to the voxel mesh of the second geometric model, determine the target voxel mesh to which the sampling points belong, determine the neighboring voxel mesh of the target voxel mesh based on the spatial index structure, read the triangular facets corresponding to the target voxel mesh and the neighboring voxel mesh of the target voxel mesh from the second mapping table, and use the read triangular facets as candidate triangular facets.
[0080] (32) Read the unit normal vector n1 of the triangular facet to which the sampling point belongs in the first geometric model, and the unit normal vector n2 of each candidate triangular facet in the second model. Calculate the angle between the unit normal vector n1 and the unit normal vector n2 of each candidate triangular facet. Retain the candidate triangular facets whose angle is less than the set angle threshold (e.g., 36°). Calculate the Euclidean distance between the sampling point and each retained candidate triangular facet. Use the minimum Euclidean distance as the distance between the corresponding sampling point in the first geometric model and the second geometric model.
[0081] When the angle between two unit normal vectors is less than a set angle threshold, the triangular facet containing the sampling point is considered to have the same orientation as the candidate triangular facet. If the angle between the two unit normal vectors is greater than or equal to the set angle threshold, the triangular facet containing the sampling point is considered to be a cross-structure or back-facing match with the candidate triangular facet and is therefore excluded. Similarly, the Euclidean distance between the sampling point on the second geometric model and the nearest triangular facet on the first geometric model is obtained.
[0082] (4) Map the distance of the sampling points of one geometric model to the sampling points of another geometric model, and take the maximum distance value in the same sampling point as the symmetrical distance of the corresponding sampling point.
[0083] After step (3) above, the distances from each sampling point in the first geometric model to the second geometric model and the distances from each sampling point in the second geometric model to the first geometric model are determined. Based on the spatial index structure constructed above, the distances of the sampling points in the second geometric model are mapped to the sampling points in the first geometric model, or the distances of the sampling points in the first geometric model are mapped to the sampling points in the second geometric model. At this time, each sampling point has two distances in different directions. The maximum value of the two distances is taken as the corresponding sampling point to the symmetrical distance. This symmetrical distance constructs a complete geometric model difference measurement index. In this way, the positive and negative differences between the two geometric models can be reflected at the same time, and the omissions that may occur in the unidirectional distance calculation can be reduced as much as possible.
[0084] In this embodiment of the invention, the method further includes:
[0085] (5) Difference levels are divided into triangular patches containing corresponding sampling points based on symmetrical distance, and different colors are used to color the point cloud in the corresponding triangular patch for different difference levels.
[0086] In this embodiment of the invention, the triangular facets are divided into multiple difference levels, including a first difference level to a fourth difference level. The larger the symmetry distance, the higher the difference level of the corresponding triangular facet. Different colors are used to color the point cloud within the corresponding triangular facet for different difference levels. If the symmetry distance is <1e-6mm, the corresponding triangular facet is identified as being in the first difference level, with essentially no difference; if the symmetry distance is ≤5mm, the corresponding triangular facet is identified as being in the second difference level, with a small difference; if the symmetry distance is between 5 and 20mm, the corresponding triangular facet is considered to be in the third difference level, with some difference; if the symmetry distance is ≥20mm, the corresponding triangular facet is identified as being in the fourth difference level, with a large difference.
[0087] Figure 2This is a schematic diagram of the structure of a 3D geometric model difference analysis device provided in an embodiment of the present invention. For ease of explanation, only the parts related to the embodiment of the present invention are shown. The device includes:
[0088] The system consists of an alignment unit, a sampling unit, a bidirectional distance calculation unit, and a symmetric distance determination unit, connected sequentially. The alignment unit is used to spatially align two geometric models to be analyzed. The sampling unit is used to mesh the geometric models and perform weighted random sampling of the corresponding triangular faces based on their areas. The bidirectional distance calculation unit is used to calculate the Euclidean distance between a sampling point on one geometric model and the nearest triangular face on another geometric model. The symmetric distance determination unit is used to map the distance of a sampling point on one geometric model to a sampling point on another geometric model, and uses the maximum distance value among the same sampling points as the symmetric distance of the corresponding sampling points.
[0089] In this embodiment of the invention, the two geometric models to be analyzed are referred to as the first geometric model and the second geometric model, respectively. In order to eliminate the initial positional deviation between the first geometric model and the second geometric model, the first geometric model and the second geometric model are spatially aligned by an alignment unit. Specifically, the initial translation vector between the first geometric model and the second geometric model, which are located in the same coordinate system, is calculated based on the centroid of the point set of the two geometric models. By iteratively adjusting the translation vector, the overall geometric distance error between the two geometric models is minimized, thereby obtaining the optimal alignment result.
[0090] The sampling unit meshes the first and second geometric models, extracts the vertex coordinates of each triangular facet from the first and second geometric models respectively, and samples the triangular facets on the surfaces of the first and second geometric models respectively. Since there are too many point clouds in the geometric models, and the number of point clouds in the first and second geometric models is different, sampling reduces the number of points participating in the difference analysis. At the same time, the number of samples in the first and second geometric models is the same, that is, the same number of sampling points are formed, which facilitates the difference comparison between the first and second geometric models.
[0091] In this embodiment of the invention, after the geometric model is meshed, the first geometric model and the second geometric model are uniformly sampled respectively. The sampling process is weighted random sampling based on the area of the triangular facets, thereby ensuring that the sampling points are evenly distributed on the surface of the geometric model and reducing the risk of small facet areas being ignored due to insufficient sampling, while large facet areas are oversampled.
[0092] In this embodiment of the invention, the sampling unit includes: a sampling probability generation module, a sampling module, and a recording module. The sampling probability generation module is used to calculate the sampling probability of each triangular facet and use the area ratio of the triangular facet as the sampling probability of the corresponding triangular facet. The sampling module is used to extract triangular facets whose cumulative sampling probability satisfies a random number and form sampling points inside the extracted triangular facets. The recording module is used to record the attributes of each sampling point.
[0093] The sampling probability generation module iterates through the triangular faces on the geometric model, calculating the area of each triangular facet and its area proportion within the geometric model. To ensure a higher probability of sampling larger triangular faces, the area proportion is used as the sampling probability for the corresponding triangular facet. The specific formula for calculating the area of the i-th triangular facet is as follows:
[0094] ;
[0095] in, , , Let represent the coordinates of the three vertices of the i-th triangular facet. Represents the cross product of vectors. Let Euclidean norm be the sampling probability of the i-th triangular facet. The specific calculation formula is as follows:
[0096] ;
[0097] in, This represents the total number of triangular facets on the geometric model.
[0098] The sampling module generates a random number. Find the cumulative probability that satisfies the cumulative distribution function. The index k of the selected triangle is used to determine the triangle's index. Place them into the corresponding sample set and repeat the process N times (e.g., N=1000000) to obtain a sample set containing all the triangular faces to be sampled. Through a large number of independent random samplings, the statistical results are used to approximate the real spatial distribution, thereby meeting the needs of practical applications.
[0099] In this embodiment of the invention, the cumulative distribution function (CDF) is expressed as follows:
[0100] ;
[0101] in, This represents the cumulative probability corresponding to index k;
[0102] For each triangular facet in the sample set, sampling points are randomly generated inside the facet. The centroid coordinate method is used to generate uniformly distributed sampling points. The specific generation process is as follows:
[0103] Generate two independent random numbers , The centroid coordinates and the coordinates of the sampling points under the centroid coordinates are determined based on two random numbers, and the attributes of the sampling points are recorded.
[0104] In an embodiment of the present invention, if Then let , First, map the point back to the interior of the triangular facet, then calculate the centroid coordinates. The specific coordinates of the centroid are as follows:
[0105] , , ;
[0106] like Then, the centroid coordinates can be calculated directly based on the above formula.
[0107] The coordinates of the sampling point are:
[0108] ;
[0109] in, , , This indicates the coordinates of the vertex of the selected triangular facet. The above method ensures that the sampling points are evenly distributed across the area of the triangle, without edge clustering or center bias.
[0110] After determining the sampling points in the three-dimensional surface patch, the recording module records the attributes of the corresponding sampling points, including: the coordinates of the sampling points. The system uses the index k of the triangular facet and the unit normal vector n of the triangular facet. The unit normal vector n of the triangular facet is calculated by normalizing the cross product of the vertices of the triangular facet in counterclockwise order. Sampling of the surfaces of the first and second geometric models is performed based on the sampling units.
[0111] In this embodiment of the invention, the bidirectional distance calculation unit includes:
[0112] The mapping module is used to map triangular faces in the geometric model onto the divided voxel mesh;
[0113] The index structure building module is used to construct the spatial index structure of the voxel grid using a KD tree.
[0114] The candidate triangle selection module is used to determine the target voxel grid where the sampling point should be set in another geometric model, determine the neighboring voxel grids of the target voxel grid based on the spatial index structure, read the triangles corresponding to the target voxel grid and the neighboring voxel grids of the target voxel grid, and use the read triangles as candidate triangles.
[0115] The distance calculation module is used to select candidate triangular faces that are aligned with the unit normal vector direction of the sampling point, and to take the minimum distance between the sampling point and the selected candidate triangular faces as the distance of the sampling point.
[0116] After sampling the first and second geometric models, the mapping unit maps the triangular facets to the voxel units according to their spatial positions.
[0117] The mapping module calculates the first minimum bounding box of the first geometric model and the second minimum bounding box of the second geometric model, and performs voxel subdivision of the first and second minimum bounding boxes based on the set voxel mesh resolution. It maps the triangular faces in the first geometric model to the voxel mesh of the first geometric model, adding the index k of the triangular face to the candidate list of its respective voxel mesh. Since a triangular face may exist in multiple voxel meshes, its index is added to the candidate lists of all the voxel meshes it resides in. This process iterates through all the triangular faces in the first geometric model to form a first mapping table. Similarly, it maps the triangular faces in the second geometric model to the voxel mesh of the second geometric model, adding the index k of the triangular face to the candidate list of its respective voxel mesh. This process iterates through all the triangular faces in the second geometric model to form a second mapping table.
[0118] In this embodiment of the invention, the distance calculation module calculates the Euclidean distance between a sampling point on the first geometric model and the nearest triangular facet on the second geometric model, as well as the Euclidean distance between a sampling point at a corresponding position on the second geometric model and the nearest triangular facet on the first geometric model. The distance calculation module reads the unit normal vector n1 of the triangular facet to which the sampling point belongs in the first geometric model, and the unit normal vector n2 of each candidate triangular facet in the second model. It calculates the angle between the unit normal vector n1 and the unit normal vector n2 of each candidate triangular facet, retaining candidate triangular facets with angles less than a set threshold (e.g., 36°). It then calculates the Euclidean distance between the sampling point and each retained candidate triangular facet, using the minimum Euclidean distance as the distance from the corresponding sampling point in the first geometric model to the second geometric model. When the angle between the two unit normal vectors is less than the set threshold, it is determined that the triangular facet containing the sampling point and the candidate triangular facet are facing the same direction. If the angle between the two unit normal vectors is greater than or equal to the set threshold, it is considered that the triangular facet containing the sampling point and the candidate triangular facet are cross-structure or back-facing matches, and are therefore excluded. The distance calculation module obtains the Euclidean distance between the sampling point on the second geometric model and the nearest triangular facet on the first geometric model based on the above method.
[0119] After determining the distances from each sampling point in the first geometric model to the second geometric model and the distances from each sampling point in the second geometric model to the first geometric model, the symmetric distance determination unit maps the distances of sampling points in the second geometric model to sampling points in the first geometric model based on the spatial index structure constructed above, or maps the distances of sampling points in the first geometric model to sampling points in the second geometric model. At this time, each sampling point has two distances in different directions. The maximum value of the two distances is taken as the symmetric distance from the corresponding sampling point. This symmetric distance constructs a complete geometric model difference metric. In this way, both the positive and negative differences between the two geometric models can be reflected simultaneously, minimizing the omissions that may occur in the unidirectional distance calculation.
[0120] In this embodiment of the invention, the device further includes:
[0121] The display unit is used to classify the difference levels of the triangular facets where the corresponding sampling points are located according to the symmetrical distance, and to color the point cloud in the corresponding triangular facets with different colors for different difference levels.
[0122] In this embodiment of the invention, the display unit divides the triangular facets into multiple difference levels, including a first difference level to a fourth difference level. The larger the symmetry distance, the higher the difference level of the corresponding triangular facet. Different colors are used to color the point cloud within the corresponding triangular facet for different difference levels. If the symmetry distance is <1e-6mm, the corresponding triangular facet is identified as being in the first difference level, with essentially no difference; if the symmetry distance is ≤5mm, the corresponding triangular facet is identified as being in the second difference level, with a small difference; if the symmetry distance is between 5 and 20mm, the corresponding triangular facet is considered to be in the third difference level, with some difference; if the symmetry distance is ≥20mm, the corresponding triangular facet is identified as being in the fourth difference level, with a large difference.
[0123] It should be noted that the apparatus provided in the above embodiments is only illustrated by the division of the above functional modules when implementing its functions. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the apparatus and method embodiments provided in the above embodiments belong to the same concept, and the specific implementation process can be found in the method embodiments, which will not be repeated here.
[0124] This device constructs a complete geometric model difference metric by simultaneously acquiring the distances of sampling points in two directions and taking the larger of the two values as the symmetrical distance of the sampling point. This method can simultaneously reflect the positive and negative differences between two geometric models, avoiding the omission problems that may occur in unidirectional distance calculation. In addition, the sampling process performs weighted random sampling based on the area of triangular facets, thereby ensuring that the sampling points are evenly distributed on the surface of the geometric model and reducing the risk of small facet areas being ignored due to insufficient sampling and large facet areas being oversampled. Furthermore, by establishing a spatial index structure, it is possible to quickly realize the query of neighboring voxel meshes of the target voxel mesh of the mapped sampling point and the mapping of subsequent sampling points, thereby improving the accuracy, visualization intuitiveness and engineering practicality of difference detection between complex geometric models.
[0125] One embodiment of this application provides a terminal device including a processor and a memory. The processor may include one or more processing cores, such as a quad-core processor, an octa-core processor, etc. The processor may be implemented using at least one hardware form selected from Digital Signal Processing (DSP), Field Programmable Gate Array (FPGA), and Programmable Logic Array (PLA). The processor may also include a main processor and a coprocessor. The main processor is used to process data in the wake-up state, also known as a central processing unit (CPU); the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, the processor may integrate a Graphics Processing Unit (GPU), which is responsible for rendering and drawing the content required to be displayed on the screen. In some embodiments, the processor may also include an AI processor, which is used to handle computational operations related to machine learning. The memory may include one or more computer-readable storage media, which may be non-transitory. The memory may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In some embodiments, a non-transitory computer-readable storage medium in the memory is used to store a computer program configured to be executed by one or more processors to implement the above-described method for difference analysis of 3D geometric models.
[0126] In some embodiments, the terminal device may also optionally include: a peripheral device interface and at least one peripheral device. The processor, memory, and peripheral device interface can be connected via a bus or signal lines. Each peripheral device can be connected to the peripheral device interface via a bus, signal lines, or a circuit board. Specifically, the peripheral device includes at least one of: radio frequency circuitry, a display screen, audio circuitry, and a power supply. Those skilled in the art will understand that the above structure does not constitute a limitation on the terminal device, and may include more or fewer components than illustrated, or combine certain components, or employ different component arrangements.
[0127] In an exemplary embodiment, a computer-readable storage medium is also provided, wherein a computer program is stored in the storage medium, and the computer program, when executed by a processor, implements the above-described method for differential analysis of 3D geometric models. Optionally, the computer-readable storage medium may include: read-only memory (ROM), random access memory (RAM), solid-state drive (SSD), or optical disk, etc. The random access memory may include resistive random access memory (ReRAM) and dynamic random access memory (DRAM).
[0128] In an exemplary embodiment, a computer program product is also provided, the computer program product including a computer program stored in a computer-readable storage medium. A processor of a terminal device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, causing the terminal device to perform the aforementioned 3D geometric model difference analysis method.
[0129] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the application disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only.
[0130] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.
Claims
1. A method for difference analysis of 3D geometric models, characterized in that, The method is as follows: (1) Spatial alignment of the two geometric models to be analyzed; (2) Mesh the two geometric models and perform weighted random sampling on the corresponding triangular facets based on their areas; (3) Calculate the distance between a sampling point on one geometric model and the nearest triangular facet on another geometric model; (4) Map the sampling point distance of one geometric model to the sampling point of another geometric model, and take the maximum distance between the two distances of the same sampling point as the symmetrical distance of the corresponding sampling point.
2. The difference analysis method for 3D geometric models as described in claim 1, characterized in that, The same number of sampling points are formed on the surfaces of the two geometric models.
3. The difference analysis method for 3D geometric models as described in claim 2, characterized in that, The sampling process is as follows: (21) Traverse the triangular facets on the geometric model, calculate the area of each triangular facet and its area ratio in the geometric model, and use the area ratio as the sampling probability of the corresponding triangular facet. (22) Generate a random number Find the cumulative sampling probability that satisfies the cumulative distribution function. The index k of the triangle will select the triangle. Add the sample set and repeat step (22) to obtain the sample set of the geometric model; (23) For each triangular facet in the sample set, randomly generate sampling points inside the triangular facet and record the attributes of the corresponding sampling points.
4. The difference analysis method for 3D geometric models as described in claim 3, characterized in that, The attributes of a sampling point include: the coordinates of the sampling point, the index of the triangle to which it belongs, and the unit normal vector of the triangle to which it belongs.
5. The difference analysis method for 3D geometric models as described in claim 1, characterized in that, The process of obtaining the distance from the sampling point to the nearest triangular facet on another geometric model is as follows: (31) Voxelize the geometric model and map the triangular facets of the geometric model to each voxel mesh; (32) Map the sampling point to the voxel mesh of another geometric model, determine the target voxel mesh where the sampling point is located and the neighboring voxel meshes of the target voxel mesh, and take the triangular facets corresponding to the target voxel mesh and the neighboring voxel meshes as candidate triangular facets; (33) Read the unit normal vector n1 of the triangular facet to which the sampling point belongs and the unit normal vector n2 of each candidate triangular facet. Calculate the angle between the unit normal vector n1 and the unit normal vector n2 of each candidate triangular facet. Retain the candidate triangular facets whose angle is less than the set angle threshold. Calculate the distance between the sampling point and each retained candidate triangular facet. Take the minimum distance as the distance between the corresponding sampling point and the nearest triangular facet on another geometric model.
6. The difference analysis method for 3D geometric models as described in claim 5, characterized in that, A spatial index structure for voxel meshes in the geometric model is constructed based on a KD tree, and neighboring voxel meshes of the target voxel mesh are found based on the spatial index structure.
7. The difference analysis method for 3D geometric models as described in claim 1, characterized in that, The method includes: Based on the symmetrical distance, the triangular facets containing the corresponding sampling points are classified into different levels of difference, and different colors are used to color the point cloud within the corresponding triangular facets for different levels of difference.
8. A device for analyzing the differences in 3D geometric models, characterized in that, The device includes: Alignment cells are used to spatially align two geometric models to be analyzed. The sampling unit is used to mesh the geometric model and perform weighted random sampling on the corresponding triangular facets based on their area. The bidirectional distance calculation unit is used to calculate the distance between a sampling point on one geometric model and the nearest triangular facet on another geometric model; The symmetric distance determination unit is used to map the distance of sampling points of one geometric model to sampling points of another geometric model, and takes the maximum distance of the two distances of the same sampling point as the symmetric distance of the corresponding sampling point.
9. The 3D geometric model difference analysis device as described in claim 8, characterized in that, The sampling unit includes: The sampling probability generation module is used to calculate the sampling probability of each triangular facet, and uses the area ratio of the triangular facet as the sampling probability of the corresponding triangular facet. The sampling module is used to extract triangular patches whose cumulative sampling probability satisfies a random number, and to form sampling points inside the extracted triangular patches. The recording module is used to record the attributes of each sampling point.
10. The 3D geometric model difference analysis device as described in claim 8, characterized in that, The two-way distance calculation unit includes: The mapping module is used to map triangular faces in the geometric model onto the divided voxel mesh; The index structure building module is used to construct the spatial index structure of the voxel grid using a KD tree. The candidate triangle selection module is used to map the sampling point to the voxel mesh of another geometric model, determine the target voxel mesh where the sampling point is located and the neighboring voxel meshes of the target voxel mesh, and use the triangles corresponding to the target voxel mesh and the neighboring voxel meshes as candidate triangles. The distance calculation module is used to select candidate triangular faces that are aligned with the unit normal vector direction of the sampling point, and to take the minimum distance between the sampling point and each candidate triangular face as the distance of the sampling point.