A large-scale scene face reduction optimization method, device and equipment based on a clustering algorithm
By using multi-condition fusion detection and optimization based on clustering algorithms, the problems of unscientific region selection and insufficient global optimization in the optimization of triangular patch models in large-scale scenes are solved. A balance is achieved between reducing the number of patches and preserving model details, thereby improving the running performance and display effect of 3D models.
Patent Information
- Application Number
- CN202510496858.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-21
- Publication Date
- 2025-11-18
- Estimated Expiration
- 2045-04-21
AI Technical Summary
Existing optimization methods for triangular patch models struggle to balance detail preservation and resource optimization when dealing with large-scale scenes. Furthermore, their unscientific selection of optimization regions and lack of global optimization capabilities result in unsatisfactory optimization outcomes.
A clustering-based approach is adopted, which integrates multi-condition fusion of planar region detection, contour point detection, and K-Means clustering, combined with Delaunay triangulation, to optimize the triangular patch model. This includes obtaining vertex coordinates and normal vectors, constructing topological relationships, performing multi-condition planar region determination and topology optimization, preserving contour points, and performing K-Means clustering and triangulation.
It achieves the goal of reducing the number of facets while maintaining the key features and details of the model, improving the model's running performance and display effect, avoiding the limitations and misjudgments of a single method, and adapting to the automatic adjustment of different model complexities.
Smart Images

Figure CN120472115B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of triangular facet model optimization technology in 3D models, and in particular to a method, apparatus and device for large-scale scene facet reduction optimization based on clustering algorithm. Background Technology
[0002] In 3D modeling and scene rendering, especially in the construction and visualization of large-scale scenes, triangular facet models are widely used to represent complex 3D surface structures. However, as the model size and scene complexity increase, the number of facets increases dramatically, leading to problems such as high storage space requirements, long rendering times, and decreased computational performance. Therefore, optimizing the model to reduce system resource consumption without significantly reducing visual quality has become an important research direction in this field.
[0003] Existing methods for optimizing triangular patch models mainly include vertex simplification, edge folding, and topology optimization. However, when dealing with large-scale scenes, these methods often struggle to balance detail preservation and resource optimization. Many algorithms, during model compression, excessively smooth the model's edges, affecting the model's contour precision. Therefore, there is an urgent need for a method that can intelligently optimize triangular patch models, reducing the number of patches while maintaining the model's key features and details.
[0004] The current related technologies have the following limitations: (1) Unscientific selection of optimization region: Previous optimization algorithms may optimize regions that should not be optimized, while omitting regions that need to be optimized, resulting in unsatisfactory optimization results. (2) Incomplete optimization: Traditional methods focus on local optimization and lack the ability to optimize globally, which may result in a local optimum rather than a global optimum.
[0005] For example, the invention application with application number 202410102833.2 discloses a three-dimensional reconstruction method, device and terminal. The three-dimensional reconstruction method of this application, which combines point cloud maps with visual images, can generate a high-fidelity, high-detail three-dimensional reconstruction model. However, its solution has the following problems: (1) lacks smoothing processing of abrupt areas of the model, resulting in poor display effect; (2) does not detect planar areas, resulting in poor accuracy and robustness of planar area detection. Summary of the Invention
[0006] To address the aforementioned problems, the present invention aims to provide a method, apparatus, and device for large-scale scene reduction optimization based on clustering algorithms, which optimizes the calculation of triangular facet models and improves the model's performance.
[0007] This invention provides a method, apparatus, and device for large-scale scene reduction optimization based on a clustering algorithm.
[0008] First aspect: A large-scale scene polygon reduction optimization method based on clustering algorithm, including:
[0009] S1. Obtain the vertex coordinates of the triangular facet model, calculate the vertex normal vectors, and construct the topological relationships of the triangular facets;
[0010] S2. Based on topological relationships, determine the multi-condition planar regions of the model, and merge and perform topological optimization processing on planar regions that meet at least two conditions;
[0011] S3. Perform multi-method detection on the processed triangular patch model, and make a comprehensive judgment on the contour points of the triangular patch model based on the detection results;
[0012] S4. Preserve the contour points and perform K-Means clustering on the non-contour points. The contour points and the clustered non-contour points form a point set.
[0013] S5. Triangulate the point set and reconstruct it to generate a new triangular facet model.
[0014] Further, in step S1, the vertex normal vector is calculated using the following formula:
[0015]
[0016] Where P1, P2, and P3 are the three vertices of the triangular facet, and f is the vertex p i The triangular facet to which it belongs, n f Let A be the normal vector of the triangular facet. f n is the area of the patch. i For vertex p i Normal vector, F i For vertex p i The set of triangular facets to which it belongs.
[0017] Furthermore, the multi-condition planar region determination of the model includes:
[0018] Local planar region determination based on PCA;
[0019] Local planar region determination based on normal vector consistency;
[0020] Local planar region determination is based on local planar fitting error.
[0021] Furthermore, the formula for determining local planar regions based on PCA is expressed as follows:
[0022]
[0023] in, It is the local center point, N iIt is the set of local neighborhood vertices, where p is a local neighborhood vertex and ∑ is the set of local neighborhood vertices N. i The covariance matrix is λ1, λ2 and λ3, the eigenvalues of the covariance matrix are λ1, λ2 and λ3, and δ1 is the eigenvalue threshold.
[0024] The formula for determining local planar regions based on normal vector consistency is expressed as follows:
[0025] cosθ ij =n i ·n j
[0026] θ ij <δ2
[0027] Where, θ ij The normal vector n of the neighboring vertices i The angle between them, δ2 is the threshold of the angle between the normal vectors.
[0028] The method of determining local planar regions based on local planar fitting errors includes:
[0029] The least squares method is used to fit a plane, and the formula is expressed as follows:
[0030] ax + by + cz + d = 0
[0031] Where p(x,y,z) are local neighborhood vertices, the average distance from each vertex to the plane is calculated by the formula:
[0032]
[0033] d avg <δ3
[0034] Where, p i (x i ,y i ,z i Let d be one of the vertices. avg The average distance from the vertex to the plane, where δ3 is the distance threshold.
[0035] Among them, the thresholds δ1, δ2, and δ3 are dynamically adjusted to adapt to the needs of models with different complexities.
[0036] Furthermore, the topology optimization includes:
[0037] The local triangles are reconstructed to maintain the regularity of the mesh structure; the adjacency relationship of the boundary points is calculated, and the transition region is optimized by Laplacian smoothing.
[0038] Furthermore, the processed triangular facet model is subjected to multi-mode detection, including: normal abrupt change detection, curvature detection, and side length ratio detection;
[0039] The formula for detecting normal mutations is as follows:
[0040] θ ij =arccos(n i ·n j )
[0041] θ ij The normal vector n of the neighboring vertices i The angle between them, θ ij When the value is greater than γ1, the vertex is determined to be a contour point, where γ1 is the threshold for the angle between the normal changes.
[0042] Curvature detection, expressed by the formula:
[0043]
[0044] Where A is the area of the domain, θ jk From a domain perspective, K i >γ2 determines the vertex as a contour point, where γ2 is the curvature threshold.
[0045] The formula for side length ratio detection is as follows:
[0046]
[0047] in, The neighborhood edge length, R > γ3, determines the vertex as a contour point, and γ3 is the ratio threshold.
[0048] Among them, the contour points of the triangular patch model are judged based on the results of normal change detection, curvature detection and side length ratio detection.
[0049] Furthermore, the K-Means clustering of non-contour points is expressed by the following formula:
[0050]
[0051] Among them, C k It is the point set of the k-th cluster, where K is the number of clusters.
[0052] Further, S5 includes the following steps:
[0053] S51. Use the Delaunay triangulation algorithm to triangulate the point set and obtain the reconstructed triangular facet model.
[0054] S52. Optimize the model contour points to make their connection relationship consistent with the original model;
[0055] S53. Optimize the reconstructed model using a grid smoothing algorithm.
[0056] The second aspect: a large-scale scene reduction optimization device based on a clustering algorithm, comprising:
[0057] The preprocessing module is used to calculate the vertex coordinates and vertex normals of the triangular facet model and to construct the topological relationships of the triangular facets.
[0058] The detection and merging module is used to determine the planar regions of the model and to merge and perform topology optimization on the planar regions that meet the conditions.
[0059] The contour detection module is used to perform multi-method detection on the processed triangular patch model and to comprehensively judge the contour points of the triangular patch model based on the detection results.
[0060] The clustering optimization module is used to preserve contour points and perform K-Means clustering on non-contour points; the contour points and the clustered non-contour points form a point set;
[0061] The topology reconstruction module is used to triangulate a set of points and reconstruct it to generate a new triangular patch model.
[0062] Third aspect: An electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, performs the steps of the method provided in the first aspect.
[0063] Fourth aspect: A non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method provided in the first aspect.
[0064] The beneficial effects of this invention are:
[0065] 1. This invention optimizes the calculation of triangular facet models to smooth out abrupt areas of the model. As a result, after optimization, abnormal point protrusions and facet redundancy are reduced, maintaining a better display effect. The model's running performance is greatly improved, ensuring the effect and smoothness of realistic 3D rendering and demonstration.
[0066] 2. This invention employs a multi-condition fusion approach for planar region detection, proposing a combination of three methods: PCA planarity assessment, normal vector consistency detection, and local plane fitting error. It also stipulates that planar regions are merged only if at least two conditions are met. This multi-condition fusion strategy improves the accuracy and robustness of planar region detection, avoiding the limitations of a single method.
[0067] 3. This invention proposes to combine three methods—normal change detection, curvature detection, and side length ratio detection—to determine contour points and retain these points to enhance contour details. This comprehensive strategy can capture the contour features of the model more comprehensively and dynamically adjust the threshold parameters to adapt to the complexity of different models.
[0068] 4. In simplifying the model, this invention clearly distinguishes between planar regions and contour regions, and adopts different processing strategies for them (planar regions are merged, and contour regions are protected). This balanced strategy can reduce the amount of model data while retaining key geometric features, achieving a balance between planar region merging and contour protection.
[0069] 5. This invention optimizes non-contour regions through K-Means clustering while preserving contour points, reducing abnormal point protrusions and facet redundancy, thus maintaining better display effects. At the same time, it introduces an automated parameter adjustment mechanism to dynamically adjust the threshold parameters (such as δ1, δ2, δ3, γ1, γ2, γ3) of each step according to the geometric features of the model. This automated mechanism can improve the versatility and adaptability of the method.
[0070] 6. This invention is suitable for detecting sharp corners in normal change detection, but it is prone to misjudgment in flat areas. Therefore, it is combined with curvature detection to supplement information. Curvature detection is suitable for detecting curved areas, but it may not be able to detect areas with extremely small curvature. Therefore, it is combined with side length ratio detection for further screening. This combination strategy makes contour point detection more accurate and avoids the misjudgment problem caused by a single detection method. Attached Figure Description
[0071] Figure 1 This is a flowchart illustrating a large-scale scene reduction optimization method based on a clustering algorithm according to the present invention.
[0072] Figure 2 This is a schematic diagram of the structure of a large-scale scene reduction optimization device based on a clustering algorithm according to the present invention.
[0073] Figure 3 This is a schematic diagram of the structure of the electronic device of the present invention. Detailed Implementation
[0074] Embodiments of the present invention are described in detail below. Examples of these embodiments are illustrated in the accompanying drawings, wherein the same or similar symbols denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.
[0075] Existing optimization methods for triangular facet models often struggle to balance detail preservation and resource optimization. Many algorithms, during model compression, can cause excessive smoothing of the model's edges, affecting the precision of the model's contours.
[0076] To address the aforementioned problems, this invention provides a large-scale scene polygon reduction optimization method based on a clustering algorithm. Figure 1This is a flowchart illustrating a large-scale scene reduction optimization method based on a clustering algorithm provided in an embodiment of the present invention. The method includes:
[0077] S1. Obtain the vertex coordinates of the triangular facet model, calculate the vertex normal vectors, and construct the topological relationship of the triangular facet.
[0078] First, number the vertices and obtain their coordinates. Then, read all the vertices in the triangular facet model and record the coordinates P of each vertex. i =(x i ,y i ,z i Each vertex is assigned a unique number.
[0079] Then, calculate the vertex normal vector using the following formula:
[0080]
[0081] Where P1, P2, and P3 are the three vertices of the triangular facet, and f is the vertex p i The triangular facet to which it belongs, n f Let A be the normal vector of the triangular facet. f n is the area of the patch. i For vertex p i Normal vector, F i For vertex p i The set of triangular facets to which it belongs.
[0082] S2. Based on topological relationships, determine the multi-condition planar regions of the model, and merge and perform topological optimization processing on planar regions that meet at least two conditions.
[0083] Multi-condition planar region determination includes: local planar region determination based on PCA, local planar region determination based on normal vector consistency, and local planar region determination based on local planar fitting error.
[0084] First, based on PCA, we determine whether a local neighborhood belongs to a planar region and select an appropriate neighborhood radius r to avoid the neighborhood being too large or too small.
[0085] Calculate the local neighborhood set N of each vertex i (Taking all vertices within radius r), calculate the neighborhood point set N. i Covariance matrix:
[0086]
[0087] in, It is the center point of the domain, N i It is the set of local neighborhood vertices, where p is a local neighborhood vertex and ∑ is the set of local neighborhood vertices N. iThe covariance matrix.
[0088] Then, calculate the eigenvalues λ1, λ2, and λ3 of the covariance matrix ∑, if:
[0089]
[0090] The local neighborhood can then be considered as a planar region, where δ1 is the feature threshold.
[0091] Secondly, based on the consistency of normal vectors, the local planar region is determined, and the normal vector n of the neighboring vertices is calculated. i The included angle between them:
[0092] cosθ ij =n i ·n j
[0093] If all neighboring vertices satisfy:
[0094] θ ij <δ2
[0095] This region can then be considered a planar region. The flatness of the local region can be determined by the angle between the normal vectors. δ2 is the threshold of the angle between the normal vectors, which can be set to 5° to 10°, and adjusted according to the model requirements.
[0096] Then, based on the local plane fitting error, the local plane region is determined, and the plane is fitted using the least squares method:
[0097] ax + by + cz + d = 0
[0098] And calculate the average distance from the point to the plane:
[0099]
[0100] like
[0101] d avg <δ3
[0102] Where, p i (x i ,y i ,z i Let d be one of the vertices. avg The average distance from the vertex to the plane, where δ3 is the distance threshold.
[0103] The criteria for merging local neighborhoods are determined by ensuring that at least two conditions (PCA, normal vector consistency, and plane fitting error) are met before merging, thus guaranteeing the accuracy of the planeness determination.
[0104] Simultaneously, by analyzing the local geometric features of the model, the thresholds δ1, δ2, and δ3 are dynamically adjusted to adapt to models of varying complexity. This adaptive parameter adjustment...
[0105] For example, for high-detail models (such as buildings): increase thresholds δ1, δ2, and δ3 to reduce over-merging and retain more detail.
[0106] For low-detail models (such as terrain): reduce thresholds δ1, δ2, and δ3 to achieve higher optimization efficiency.
[0107] Finally, topology optimization is performed on the merged local neighborhoods. After merging planar regions, topology optimization methods (such as local triangle reconstruction) are used to maintain the regularity of the mesh structure and avoid the appearance of elongated triangles or non-uniform patch distributions. The adjacency relationships of boundary points can also be calculated, and the transition region can be optimized using Laplacian smoothing to make its visual effect more natural.
[0108] S3. Perform multi-method detection on the processed triangular patch model, and make a comprehensive judgment on the contour points of the triangular patch model based on the detection results.
[0109] First, perform normal abrupt change detection by detecting contour points using the included normal angle between adjacent facets. The formula is:
[0110] θ ij =arccos(n i ·n j )
[0111] like
[0112] θ ij >γ1
[0113] Then vertex p i These might be contour points. The threshold γ1 for the angle between normal changes can be set to 30°–45°, adjusted according to the model complexity. Detected contour points are marked to prevent them from being merged in subsequent steps.
[0114] Then, curvature detection is performed. Contour points (inflection points) are detected using Gaussian curvature, and the Gaussian curvature formula is calculated as follows:
[0115]
[0116] Where A is the area of the domain, θ jk From a domain perspective, if:
[0117] K i >γ2
[0118] If the point is considered a contour point (inflection point), it should be retained. The curvature threshold γ2 can be dynamically adjusted according to the curvature distribution of the model. Points in areas with large curvature can be densified to enhance contour details.
[0119] Then, the side length ratio is detected, and the neighborhood side length is calculated. Ratio of the longest side to the longest side:
[0120]
[0121] like
[0122] R>γ3
[0123] Then p i It may be a contour point. The side length ratio threshold γ3 can be set to 2 to 5, depending on the model requirements.
[0124] Finally, the contour points of the triangular patch model are determined by combining the results of normal change detection, curvature detection, and side length ratio detection.
[0125] S4. Preserve the contour points and perform K-Means clustering on the non-contour points; the contour points and the clustered non-contour points form a point set.
[0126] First, perform K-Means clustering, setting the target number of points K. The K-Means clustering formula is as follows:
[0127]
[0128] Among them, C k This is the point set of the Kth cluster. Clustering the vertices in the non-contour region reduces the number of points. The number of clusters K can be dynamically calculated based on the simplification ratio of the model. Accelerated K-Means algorithms (such as Mini-Batch K-Means) can be used to improve computational efficiency.
[0129] Then, perform boundary point protection.
[0130] Contour points are preserved to prevent them from participating in clustering. Contour points are labeled and directly retained during the clustering process.
[0131] S5. Triangulate the point set and reconstruct it to generate a new triangular facet model.
[0132] First, using the point set, perform triangulation using an efficient Delaunay triangulation algorithm (such as the CGAL library) to generate new facets, ensuring that the triangulated facets are consistent with the topology of the original model.
[0133] Then, boundary point connection optimization is performed to ensure that the contour points are connected in a consistent manner and to avoid topological errors. Local optimization is performed on the contour points to ensure that their connection relationship is consistent with the original model. Finally, a mesh smoothing algorithm (such as Laplacian smoothing) is used to optimize the reconstructed model.
[0134] like Figure 2 As shown, the present invention also discloses a large-scale scene reduction optimization device based on a clustering algorithm. The device includes: a preprocessing module, a detection merging module, a contour detection module, a clustering optimization module, and a topology reconstruction module.
[0135] The preprocessing module is used to read the original triangular patch model data (vertex coordinates, patch connectivity), calculate the vertex coordinates and vertex normals of the triangular patch model, and construct the topological relationships of the triangular patches (recording the neighborhood information of each vertex), providing basic data support for subsequent steps.
[0136] The detection and merging module is used to determine the planar regions of the model and to merge and optimize the topology of the planar regions that meet the conditions.
[0137] Based on a multi-condition fusion strategy (PCA planeness, normal vector consistency, plane fitting error), mergeable planar regions are detected, and the merging threshold is dynamically adjusted (e.g., adaptively adjusting δ1, δ2, δ3 according to the model curvature distribution) to perform topology optimization (e.g., local triangle reconstruction) on the planar regions.
[0138] The contour detection module is used to perform multi-method detection on the processed triangular facet model and to comprehensively judge the contour points of the triangular facet model based on the detection results.
[0139] Synthetic normal mutation (θ) ij >γ1), curvature (K) i >γ2) and side length ratio (R>γ3) are used to detect contour points, mark contour points and prevent them from participating in subsequent clustering optimization.
[0140] The clustering optimization module is used to retain contour points and perform K-Means clustering on non-contour points; the contour points and the clustered non-contour points form a point set.
[0141] K-Means clustering is performed on non-contour vertices (the number of target clusters K is dynamically calculated). An acceleration algorithm (such as Mini-Batch K-Means) is used to improve efficiency, retaining the cluster center points to replace the original non-contour point set. Spatial location clustering (Euclidean distance metric) reduces redundant vertices while protecting contour points to maintain features.
[0142] The topology reconstruction module is used to triangulate a set of points and reconstruct it to generate a new triangular patch model.
[0143] The simplified point set (contour points + cluster centers) is subjected to Delaunay triangulation to optimize boundary connections (such as Laplacian smooth transition regions). Delaunay triangulation maximizes the minimum interior angle, avoids elongated triangles, constrains the connection relationship of contour points, and maintains topological consistency.
[0144] In application, the original triangular mesh model (e.g., a building model with 1 million faces) is input to the preprocessing module for preprocessing, calculating vertex normals and marking neighborhood relationships. Then, the detection merging module performs planar merging, detecting flat areas such as walls (using PCA, normal consistency, or planar fitting error) and merging redundant faces. Next, the contour detection module performs contour protection, preserving high-curvature contour points such as eaves and window frames. Then, the clustering optimization module performs clustering simplification: clustering non-contour areas (e.g., flat walls), reducing the number of vertices from 500,000 to 50,000. Finally, the topology reconstruction module performs reconstruction output, generating an optimized model (100,000 faces, with visual quality close to the original model).
[0145] The device of this invention achieves a balance between performance and quality by using multi-condition fusion decision-making, plane detection and contour protection through multi-threshold collaboration, avoiding the bias of a single method; at the same time, it performs dynamic parameter adjustment and automatically optimizes the threshold according to the model complexity (such as terrain vs. high-precision buildings), clustering simplifies and reduces the amount of computation, and contour protection ensures that key features are not lost.
[0146] The present invention also provides an electronic device, Figure 3 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention, such as... Figure 3 As shown, the electronic device may include a processor, a communications interface, memory, and a communication bus, wherein the processor, communications interface, and memory communicate with each other via the communication bus. The processor can invoke logical instructions from the memory, for example, to execute the following method:
[0147] S1. Obtain the vertex coordinates of the triangular facet model, calculate the vertex normal vectors, and construct the topological relationships of the triangular facets;
[0148] S2. Based on topological relationships, determine the multi-condition planar regions of the model, and merge and perform topological optimization processing on planar regions that meet at least two conditions;
[0149] S3. Perform multi-method detection on the processed triangular patch model, and make a comprehensive judgment on the contour points of the triangular patch model based on the detection results;
[0150] S4. Preserve the contour points and perform K-Means clustering on the non-contour points. The contour points and the clustered non-contour points form a point set.
[0151] S5. Triangulate the point set and reconstruct it to generate a new triangular facet model.
[0152] Furthermore, the logical instructions in the aforementioned memory can be implemented as software functional units and sold or used as independent products, and can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0153] This invention also provides a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, is implemented to perform the methods provided in the above embodiments, including, for example:
[0154] S1. Obtain the vertex coordinates of the triangular facet model, calculate the vertex normal vectors, and construct the topological relationships of the triangular facets;
[0155] S2. Based on topological relationships, determine the multi-condition planar regions of the model, and merge and perform topological optimization processing on planar regions that meet at least two conditions;
[0156] S3. Perform multi-method detection on the processed triangular patch model, and make a comprehensive judgment on the contour points of the triangular patch model based on the detection results;
[0157] S4. Preserve the contour points and perform K-Means clustering on the non-contour points. The contour points and the clustered non-contour points form a point set.
[0158] S5. Triangulate the point set and reconstruct it to generate a new triangular facet model.
[0159] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0160] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0161] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A large-scale scene polygon reduction optimization method based on clustering algorithm, characterized in that, include: S1. Obtain the vertex coordinates of the triangular facet model, calculate the vertex normal vectors, and construct the topological relationships of the triangular facets; S2. Based on topological relationships, determine the multi-condition planar regions of the model, and merge and perform topological optimization processing on planar regions that meet at least two conditions; S3. Perform multi-method detection on the processed triangular patch model, and make a comprehensive judgment on the contour points of the triangular patch model based on the detection results; The process of performing multi-mode detection on the processed triangular facet model includes: normal abrupt change detection, curvature detection, and side length ratio detection. The formula for detecting normal mutations is as follows: i ij =arccos(n i ·n j ) θ ij The normal vector n of the neighboring vertices i The angle between them, θ ij When the angle is greater than γ1, the vertex is determined to be a contour point, where γ1 is the included angle threshold. Curvature detection, expressed by the formula: Where A is the area of the domain, θ jk From a domain perspective, K i >γ2 determines the vertex as a contour point, where γ2 is the curvature threshold; The formula for side length ratio detection is as follows: in, The neighborhood edge length, R > γ3, determines the vertex as a contour point, and γ3 is the ratio threshold; Among them, the contour points of the triangular patch model are judged based on the results of normal change detection, curvature detection and side length ratio detection. S4. Preserve the contour points and perform K-Means clustering on the non-contour points. The contour points and the clustered non-contour points form a point set. S5. Triangulate the point set and reconstruct it to generate a new triangular facet model.
2. The surface reduction optimization method according to claim 1, characterized in that, The formula for calculating the vertex normal vector in S1 is as follows: Where P1, P2, and P3 are the three vertices of the triangular facet, and f is the vertex p i The triangular facet to which it belongs, n f Let A be the normal vector of the triangular facet. f n is the area of the patch. i For vertex p i Normal vector, F i For vertex p i The set of triangular facets to which it belongs.
3. The surface reduction optimization method according to claim 1, characterized in that, The multi-condition planar region determination of the model includes: Local planar region determination based on PCA; Local planar region determination based on normal vector consistency; Local planar region determination is based on local planar fitting error.
4. The surface reduction optimization method according to claim 3, characterized in that, The formula for determining local planar regions based on PCA is expressed as follows: in, It is the local center point, N i It is the set of local neighborhood vertices, where p is a local neighborhood vertex and ∑ is the set of local neighborhood vertices N. i The covariance matrix of λ1, λ2 and λ3, the eigenvalues of the covariance matrix, and δ1 is the eigenvalue threshold; The formula for determining local planar regions based on normal vector consistency is expressed as follows: cosθ ij =n i ·n j i ij <δ2 Where, θ ij The normal vector n of the neighboring vertices i The angle between them, where δ2 is the threshold of the angle between the normal vectors; The method of determining local planar regions based on local planar fitting errors includes: The least squares method is used to fit a plane, and the formula is expressed as follows: ax + by + cz + d = 0 Where p(x,y,z) are local neighborhood vertices, the average distance from each vertex to the plane is calculated by the formula: d avg <δ3 Where, p i (x i ,y i ,z i Let d be one of the vertices. avg The average distance from the vertex to the plane, where δ3 is the distance threshold; Among them, the thresholds δ1, δ2 and δ3 are dynamically adjusted to adapt to the needs of models with different complexities.
5. The surface reduction optimization method according to claim 1, characterized in that, The topology optimization includes: The local triangles are reconstructed to maintain the regularity of the mesh structure; the adjacency relationship of the boundary points is calculated, and the transition region is optimized by Laplacian smoothing.
6. The surface reduction optimization method according to claim 1, characterized in that, In step S4, K-Means clustering is performed on non-contour points, and the formula is expressed as follows: Among them, C k It is the point set of the k-th cluster, where K is the number of clusters.
7. The surface reduction optimization method according to claim 6, characterized in that, S5 includes the following steps: S51. Use the Delaunay triangulation algorithm to triangulate the point set and obtain the reconstructed triangular facet model. S52. Optimize the model contour points to make their connection relationship consistent with the original model; S53. Optimize the reconstructed model using a grid smoothing algorithm.
8. A large-scale scene reduction optimization device based on a clustering algorithm applied to the method described in any one of claims 1 to 7, characterized in that, The device includes: The preprocessing module is used to calculate the vertex coordinates and vertex normals of the triangular facet model and to construct the topological relationships of the triangular facets. The detection and merging module is used to determine the planar regions of the model and to merge and perform topology optimization on the planar regions that meet the conditions. The contour detection module is used to perform multi-method detection on the processed triangular patch model and to comprehensively judge the contour points of the triangular patch model based on the detection results. The clustering optimization module is used to preserve contour points and perform K-Means clustering on non-contour points; the contour points and the clustered non-contour points form a point set; The topology reconstruction module is used to triangulate a set of points and reconstruct it to generate a new triangular patch model.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps of a large-scale scene reduction optimization method based on a clustering algorithm as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Three-dimensional reconstruction method, device and terminal
CN117635875A
BIM model surface reduction method based on vertex normal angle calculation
CN114565718A
Three-dimensional model simplification method and apparatus and storage medium
WO2023273339A1