Mesh adaptive subdivision method and real-time preview method for CAD modeling

By adopting an adaptive mesh subdivision method for CAD modeling, and utilizing importance weight ω and half-edge structure to optimize topology query, the computational redundancy and visual jump problems of mesh subdivision algorithms are solved, achieving efficient real-time preview and stable frame rate.

CN120995800BActive Publication Date: 2026-01-16ZHEJIANG HUADONG ENG DIGITAL TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511511296.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-10-22
Publication Date
2026-01-16
Estimated Expiration
2045-10-22

AI Technical Summary

Technical Problem

Existing CAD modeling mesh subdivision algorithms suffer from global computational redundancy, poor dynamic adaptability, poor LOD dynamic adaptability, and frame rate fluctuations, resulting in low computational efficiency and poor visual continuity.

Method used

An adaptive mesh subdivision method for CAD modeling is adopted. By preprocessing model data, calculating importance weights ω, dynamically allocating computing resources and subdivision order, and combining half-edge structure and raster index to optimize topology query, mesh subdivision and rendering are synchronized.

Benefits of technology

It improves the dynamic adaptability and computational efficiency of mesh subdivision, enables real-time preview, and enhances visual smoothness and frame rate stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120995800B_ABST
    Figure CN120995800B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of computer aided design and real-time graphics computing, in particular to a grid adaptive subdivision method and real-time preview method for CAD modeling, comprising the following steps: sorting vertex coordinates of a model according to spatial positions, and constructing an adjacency relationship by using a half-edge structure for a grid data structure of the model; calculating a projection area of different grid subdivision regions in a view frustum as an importance weight ω, and distributing computing resources and arranging a subdivision order according to the importance weight ω. The present application quickly calculates the importance weight ω of the grid subdivision region, arranges computing resources for the subdivision of the subdivision region with a higher preview priority first, improves the dynamic adaptability of the grid subdivision, reasonably distributes the computing resources, and improves the computing efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of computer-aided design and real-time graphics computing, in particular to a grid adaptive subdivision method and real-time preview method for CAD modeling. BACKGROUND

[0002] In CAD modeling and real-time rendering applications, mesh subdivision technology is the core means to improve model accuracy. Traditional subdivision algorithms, such as Catmull-Clark subdivision algorithm and Loop subdivision algorithm, require recursive partitioning of the global mesh, resulting in the following problems:

[0003] Global computation redundancy: high curvature areas, such as edges and corners, require dense patches to maintain details, while equally subdividing low curvature areas will generate a large number of redundant patches, increasing computational load. Existing technologies use local subdivision algorithms, which divide areas by curvature threshold, but curvature calculation relies on offline preprocessing and cannot adapt to dynamic scenarios.

[0004] Poor adaptability of LOD (Level of Details, i.e., multiple levels of detail): existing LOD techniques mostly use pre-generated multi-resolution models, relying on fixed thresholds such as distance or viewing angle, resulting in LOD jumps in long-distance or fast-moving scenarios, disrupting visual continuity. Even with dynamic LOD scheduling methods based on view frustum culling (determining whether an object is within the camera's visible range to determine the LOD level) or screen space error adjusting LOD, the level switching does not solve the problem of visual jumps, and objects appear discontinuous in the switching moment, disrupting immersion. The essence is that the geometry, texture, and position information of different LOD models are discontinuous.

[0005] Frame rate fluctuation: in traditional architecture, geometry processing and rendering are coupled, and subdivision calculation and rendering are performed synchronously. Even with the use of GPU parallel computing capabilities to accelerate subdivision, the problem of complex models easily blocking rendering threads and causing frame rate fluctuations cannot be solved. SUMMARY

[0006] To overcome the problems of poor dynamic adaptability and low computational efficiency of existing mesh subdivision methods, the present application proposes a mesh adaptive subdivision method and real-time preview method for CAD modeling.

[0007] The technical solution provided by the present application is as follows: a mesh adaptive subdivision method for CAD modeling, comprising the following steps:

[0008] The model data is pre-processed, the vertex coordinates of the model are sorted according to the spatial positions, so that the vertex coordinates of the spatial positions adjacent to each other are stored continuously in the vertex list, and the mesh data structure of the model is constructed by using a half-edge structure to build an adjacency relationship, and the start point, end point, opposite edge and adjacent face of each edge are recorded;

[0009] The importance weight ω is calculated, the projected area of different mesh subdivision regions in the view frustum is taken as the importance weight ω, and the calculation resources are distributed and the subdivision order is arranged according to the importance weight ω.

[0010] Mesh subdivision, selecting the curvature K i The vertex whose curvature is greater than the curvature threshold value is taken as a seed vertex, after the initial subdivision region is expanded based on the seed vertex and the mesh is subdivided, the vertex coordinates and indexes of the subdivision region are modified, the data of the unchanged region is kept, and the vertex list is updated.

[0011] The vertex coordinates in the model data are sorted according to the spatial positions, and the adjacency relationship of the vertex, edge and face is constructed by using a half-edge structure, so that the importance weight ω of the mesh subdivision region can be quickly calculated; the calculation resources are distributed and the subdivision order is arranged according to the projected area of different mesh subdivision regions in the view frustum as the importance weight ω, the calculation resources are preferentially arranged for the subdivision of the subdivision region with higher preview priority, the dynamic adaptability of the mesh subdivision is improved, the calculation resources are reasonably distributed, and the calculation efficiency is improved; since the vertex coordinates are sorted according to the spatial positions, only the vertex coordinates and indexes of the subdivision region are changed during the mesh subdivision, the data of the unchanged region is kept, and the calculation amount is reduced.

[0012] As a preferred, the curvature threshold value and the importance weight ω are negatively correlated, so that the mesh subdivision region is adjusted according to the importance weight ω, that is, adjusted according to the importance of visual preview, so that the mesh subdivision region is more precisely distributed according to the preview requirement, the ability of the mesh adaptive subdivision is improved, the calculation resources are reasonably distributed, and the calculation efficiency is improved.

[0013] As a preferred, the model data pre-processing further includes the following steps:

[0014] The model is divided into uniform grids, each grid stores the vertex and face index contained in the grid, and the elements in the grid are found by positioning the grid, so that the calculation complexity is reduced.

[0015] As a preferred, the construction steps of the grid include:

[0016] The range of the entire bounding box is determined according to the maximum value and the minimum value of all vertex coordinates;

[0017] The grid size is set and the number of grids is calculated;

[0018] The grid coordinate system is established;

[0019] associate the vertex with the corresponding grid.

[0020] Since the vertex coordinates are sorted according to the spatial position, the grid division is facilitated according to the space, thereby improving the element search and traversal efficiency.

[0021] As a preferred, when the following three termination conditions are met, the subdivision is terminated:

[0022] Termination condition one, the curvature change amount ΔK of the subdivided region is less than a set threshold;

[0023] Termination condition two, the number of GPU draw calls (Draw Call) exceeds a specified threshold;

[0024] Termination condition three, the curvature change rate after subdivision is less than a set threshold.

[0025] A mesh real-time preview method for CAD modeling, the mesh subdivision adopts the mesh adaptive subdivision method for CAD modeling, and the importance weight ω is used to determine the LOD level of different mesh subdivision regions. The vertex coordinates and their indexes of the subdivision region are modified once after each mesh subdivision region is subdivided. The real-time preview method further includes the following steps:

[0026] The vertex list is cached in the first buffer area of the memory buffer after each update;

[0027] The second buffer area of the memory buffer exchanges data with the first buffer area;

[0028] The second buffer area transmits data to the rendering module for rendering the mesh, and completes the rendering and display of the mesh.

[0029] The importance weight ω is used to determine the LOD level and the mesh subdivision order of different mesh subdivision regions, and the near-view region is processed first. After some near-view mesh is processed, the data is updated and stored in the first buffer area. The second buffer area is consistent with the first buffer area after data exchange. The rendering module can perform rendering in advance by extracting data from the second buffer area. During rendering, other subdivision regions are subdivided according to the importance weight ω at the same time. The mesh subdivision and rendering are synchronized, and the real-time preview effect is realized.

[0030] As a preferred, the method further includes the following steps: calling the vertex list data of the first buffer area to calculate the screen projection of the Hausdorff distance of all LOD levels as the initial screen projection distance H s1 , and adjusting the division of the LOD level according to whether the initial screen projection distance H s1 exceeds a threshold value, to ensure that the "worst case" of the basic LOD level is still within the perception threshold.

[0031] As preferred, the operation of adjusting the division of the LOD level includes a fallback adjustment of the LOD model, such as an optimized low-mode simplification algorithm, and a reduction of the shape deviation between the high mode and the low mode.

[0032] As preferred, the importance weight ω of the mesh subdivision region under the current view angle is detected to see if it reaches the threshold of the LOD level switching, if yes, the vertex list data of the first buffer is called to calculate the screen projection of the Hausdorff distance between the mesh subdivision region under the current LOD level and the adjacent LOD level to be switched as the real-time screen projection distance H s2 , if the real-time screen projection distance H s2 is greater than the set threshold, the number of rendering frames of the transition interpolation is increased to control the deformation amplitude, dilute the deformation perception through a longer gradual transition, mask the level difference, ensure that the shape difference between the adjacent LOD levels is within the limit of human eye perception, and realize the dynamic adjustment of the spatial switching of the LOD level.

[0033] As preferred, a Bezier curve is used to adjust the transition time rhythm when switching between the high mode and the low mode of the LOD level, and the curve expression is B (t) = P0×(1-t)³ + 3P1×t (1-t)² + 3P2×t²(1-t) + P3×t³, P0, P1, P2 and P3 are four control points, wherein:

[0034] P0=(0,0), controlling the low mode end;

[0035] P1=(0.2, 0.1), as the first control point;

[0036] P2=(0.8, 0.9), as the second control point;

[0037] P3=(1,1), controlling the high mode end.

[0038] The Bezier curve is used to adjust the transition time rhythm of the LOD level, which optimizes the transition rhythm from the time dimension, makes the deformation process consistent with the expectation of human eyes for "natural motion" (slow start, fast in the middle, and slow end), and cooperates with the geometric deformation metric to further mask the traces of level switching within the safe deformation range.

[0039] A mesh adaptive subdivision system for CAD modeling, comprising:

[0040] A preprocessing module for sorting the vertex coordinates of the model data according to the spatial position, and constructing the adjacency relationship of the mesh data structure of the model using the half-edge structure;

[0041] An importance weight calculation module calculates the projected area of different mesh subdivision regions in a view frustum as an importance weight ω;

[0042] A mesh subdivision module is used to select the vertex with curvature K i The vertex with curvature greater than the curvature threshold is taken as a seed vertex, and after mesh subdivision is performed based on the seed vertex to expand an initial subdivision region, the vertex coordinates and indexes of the subdivision region are modified, the data of the unchanged region is preserved, and the vertex list is updated.

[0043] A mesh real-time preview system for CAD modeling, comprising the mesh adaptive subdivision system for CAD modeling, and further comprising:

[0044] An LOD level division module is used to determine the LOD level of different mesh subdivision regions according to the importance weight ω;

[0045] A first buffer is used to store the initial and updated vertex list data;

[0046] A second buffer is used to exchange data with the first buffer after the data of the first buffer is updated;

[0047] A rendering module is used to extract the data of the second buffer and perform mesh rendering.

[0048] An intelligent terminal, comprising a processor and a memory, wherein the memory stores a computer program, the processor is in communication connection with the memory, and the processor executes the mesh adaptive subdivision method for CAD modeling or the mesh real-time preview method for CAD modeling through the computer program.

[0049] A computer readable storage medium, which stores program data used to execute the mesh adaptive subdivision method for CAD modeling or the mesh real-time preview method for CAD modeling.

[0050] Compared with the prior art, the present application has the following beneficial effects:

[0051] 1. The spatial positions of the vertex coordinates in the model data are sorted, and the half-edge structure is used to construct the adjacency relationship of the vertices, edges and faces, so that the importance weight ω of the mesh subdivision region can be quickly calculated, and only the vertex coordinates and indexes of the subdivision region need to be changed during mesh subdivision, the data of the unchanged region is preserved, and the calculation amount is reduced.

[0052] 2. According to the projection area of different mesh subdivision areas in the view frustum as the importance weight ω, the computing resources are distributed and the subdivision order is arranged, the subdivision area with higher preview priority is arranged with computing resources in priority, the dynamic adaptability of mesh subdivision is improved, the computing resources are reasonably distributed, and the computing efficiency is improved;

[0053] 3. The curvature threshold is dynamically adjusted according to the importance weight ω, so that the mesh subdivision area is adjusted according to the importance weight ω, that is, adjusted according to the importance of visual preview, so that the mesh subdivision area is more precisely distributed according to the preview demand, the ability of adaptive mesh subdivision is improved, the computing resources are reasonably distributed, and the computing efficiency is improved;

[0054] 4. According to the importance weight ω, the LOD level and mesh subdivision order of different mesh subdivision areas are determined, the close-range area is processed in priority, data is updated and stored in the first buffer area after part of the close-range mesh is processed, the second buffer area is consistent with the first buffer area after data exchange, and the rendering module can perform rendering in advance by extracting data of the second buffer area, other subdivision areas are subdivided at the same time according to the importance weight ω during rendering, mesh subdivision and rendering are synchronized, and the effect of real-time preview is realized.

[0055] 5. The perception problem of LOD transition is solved from the spatial limitation and time rhythm two dimensions, and the visual smooth line is enhanced. BRIEF DESCRIPTION OF DRAWINGS

[0056] Figure 1 It is a whole flowchart of the embodiment one of the present application;

[0057] Figure 2 It is a schematic diagram of the angle deficit method in the Gaussian curvature calculation in the embodiment one of the present application;

[0058] Figure 3 It is a half-edge structure schematic diagram of the embodiment one of the present application;

[0059] Figure 4 It is a task priority scheduling (based on the distance of the viewpoint) schematic diagram of the embodiment one of the present application. DETAILED DESCRIPTION

[0060] The present application will be further described below in conjunction with the drawings and specific embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. Based on the described embodiments of the present application, all other embodiments obtained by those skilled in the art without creative labor belong to the scope of protection of the present application. Unless otherwise defined, the technical terms or scientific terms used herein should be understood as the usual meaning understood by those skilled in the art in the field of the present application.

[0061] Embodiment one, refer toFigure 1 The embodiment of the present application provides a real-time preview method for CAD modeling, including a mesh adaptive subdivision method, steps are as shown in the figure, including: Figure 1

[0062] S1, importing a model file and verifying and checking the model file, the imported model data format includes OBJ, FBX, PLY and the like, and it is ensured that the data includes vertex coordinates, normal vectors, UV texture coordinates and triangular / quadrilateral patch indexes.

[0063] S11, topological structure verification, Non-Manifold Edges, Orphaned Vertices and the like are detected and repaired during importing, and it is ensured that the initial mesh satisfies the "subdivision condition", and distortion or errors in subsequent subdivision are avoided. Including:

[0064] S111, topological checking, excluding Non-Manifold topology (such as an edge being shared by three or more surfaces, an abnormal number of edges connected to a vertex, self-intersecting surfaces and the like);

[0065] S112, geometry checking, ensuring that the mesh has no obvious distortion (such as a too small minimum angle of a triangle, an unbalanced aspect ratio of a quadrilateral), and defects are avoided from being amplified after subdivision.

[0066] S2, model data preprocessing,

[0067] S21, vertex coordinate reindexing, spatial ordering is performed on a vertex list through a Morton Code encoding mode, that is, a Z-Order curve is used to arrange vertices, the vertex coordinates of the model are ordered according to spatial positions, so that the vertex coordinates of spatial adjacent positions are stored continuously in the vertex list, thereby improving GPU cache hit rate and reducing memory access fragmentation.

[0068] The core of vertex reindexing is to recombine the storage order of vertices through spatial correlation, and solve the "fragmentation" problem of GPU memory access - the original vertex list is usually stored in the modeling order (not continuous in space), and cache miss (frequent jump addressing is required) is prone to occur when the GPU accesses, and the Morton code ordering can make the vertex coordinates adjacent in space be stored continuously in the memory, and the cache utilization rate is greatly improved.

[0069] ​A Z-Order curve is a "space-filling curve" that maps 3D spatial coordinates to 1D integers, i.e., by alternately taking the binary bits of X, Y, Z coordinates to splice into an integer (i.e., Morton code), so that spatially adjacent points also remain adjacent in the 1D sequence. For example, the binary of 3D coordinates (x=5, y=3, z=6) is x=101, y=011, z=110, after alternately taking bits, the Morton code = 1 0 1 | 0 1 1 | 1 1 0 → binary 101011110 → decimal 350.

[0070] Therefore, the closer the spatial distance of the vertices, the smaller the difference of the Morton codes of the vertices, so that the vertices with close spatial distances are stored continuously in the memory after sorting.

[0071] S22, the mesh data structure of the model is constructed using a half-edge structure to build adjacency relationships, and the starting point, end point, opposite edge and adjacent face of each edge are recorded, thereby supporting efficient topological traversal (such as curvature calculation, local subdivision), quickly finding the corresponding points and faces, solving the problem that the original mesh (only having vertex coordinates and face indexes) cannot quickly query the neighborhood, meeting the demand of adaptive mesh subdivision according to the curvature, and using explicit storage of adjacency relationships (such as edge-face, vertex-edge) to realize O(1)~O(n) neighborhood traversal.

[0072] The "adjacency relationships" (such as vertex-edge, edge-face, face-adjacent face) of the mesh are the basis for curvature calculation and local subdivision, but the original mesh usually only stores "vertex coordinates" and "face-vertex indexes", such as a triangular face only recording 3 vertex indexes, which cannot directly and quickly query the neighborhood. The half-edge structure realizes explicit storage of adjacency relationships (such as edge-face, vertex-edge) through explicit storage of topological information, and realizes O(1)~O(n) neighborhood traversal.

[0073] Taking a triangular mesh as an example, as shown in Figure 2 , the construction process of the half-edge structure includes:

[0074] S221, initializing the basic elements: reading the vertex coordinate list (v) and the face list (F, each face containing 3 vertex indexes).

[0075] S222, generating half-edges and associated relationships: for each face F i (corresponding vertices v1, v2, v3), 3 half-edges HE are generated:

[0076] HE1: origin=v1, target=v2, face=F i ;

[0077] HE2: origin = v2, target = v3, face = F i ;

[0078] HE3: origin = v3, target = v1, face = F i ;

[0079] And set the closed loop relationship of half edge, that is: HE1.next = HE2, HE2.next = HE3, HE3.next = HE1.

[0080] S223, establish a pair of half edges (twin),

[0081] For each half edge HE (origin = u, target = v), find the half edge HE' of "origin = v, target = u", set HE.twin = HE', HE'.twin = HE (if it is a boundary edge, twin is null).

[0082] S224, associate vertex and face:

[0083] Each vertex V is associated with a half edge starting from V (such as HE.origin = v, then v.edge = HE); each face F is associated with a half edge belonging to it (such as HE.face = F, then F.edge = HE).

[0084] S23, divide the model into uniform grids, and store the indexes of vertices and faces contained in each grid. When querying, "first locate the grid, then traverse the elements in the grid", to reduce the computational complexity. In dynamic curvature calculation, it is often necessary to query the vertices or faces within a certain spatial range (such as all vertices within 5mm around vertex V). If the entire model is traversed for querying, the complexity is O(N) (N is the total number of vertices), which is low in efficiency. Spatial grid index divides the model space into uniform grids, realizes "first locate the grid, then query the elements in the grid", and thus speeds up the neighborhood query.

[0085] The construction steps of the grid include:

[0086] S231, calculate the bounding box (AABB): traverse all vertices to determine the minimum value (min_x, min_y, min_z) and maximum value (max_x, max_y, max_z) of x / y / z, define the bounding box range, form the axis-aligned bounding box (AABB): [min_x, max_x] × [min_y, max_y] × [min_z, max_z].

[0087] S232, divide the uniform grid. Taking the vertex grid index as an example, it includes:

[0088] S2321, set the grid size (cell_size) according to the model accuracy and query requirements (such as dynamic curvature calculation commonly used 0.5~5mm, need to balance the number of grids and query accuracy).

[0089] S2322, calculate the number of grids:

[0090] nx = ceil((max_x - min_x) / cell_size)

[0091] ny, nz similarly.

[0092] S2323, establish a grid coordinate system: each grid is represented by an integer (i,j,k), where i∈[0, nx-1],j∈[0, ny-1], k∈[0, nz-1].

[0093] S233, associate vertices with grids.

[0094] For vertex v (x,y,z), calculate the grid coordinates it belongs to: i = floor((x - min_x) / cell_size)

[0095] j, k similarly, k = floor((z - min_z) / cell_size).

[0096] Store the vertex index in the list of grid (i,j,k) (you can use hash table or three-dimensional array storage, such as grid[i][j][k] = [v1, v2,...]).

[0097] By setting up a data structure layer of half-edge structure, the adjacency relationship is explicitly stored, and the basic topology query problem is solved; by setting up a spatial acceleration layer of grid index, spatial partitioning is added on the basis of data structure to accelerate dynamic curvature and other operations that rely on neighborhood query. That is, the half-edge structure ensures the efficiency of topology traversal, and the grid index further optimizes the spatial query efficiency, and the combination of the two supports the subsequent subdivision and curvature calculation module.

[0098] S3, divide the mesh subdivision area and select the curvature K i Vertices with curvature greater than the curvature threshold are selected as seed vertices, and an initial subdivision area is expanded based on the seed vertices, including the following steps:

[0099] S31, select seed vertices and select curvature K i > curvature threshold K threshold Vertices with curvature K i =μ + σ, μ is the average curvature and σ is the standard deviation, and the curvature threshold Kthreshold The curvature threshold and importance weight ω are set to be negatively correlated, for example, they can be inversely proportional.

[0100] The curvature K of the vertex i Existing curvature calculation methods, such as Gaussian curvature (K=k1*k2), are used to describe the local bending degree of the surface. In a discrete mesh, such as... Figure 3 As shown, the approximate calculation is performed using the Angle Deficit method:

[0101] Vertex V i Gaussian curvature K i Calculated based on the deficit in its neighborhood:

[0102]

[0103] Among them, A mixed (v i ) is the vertex V i The mixed Voronoi area is used for curvature normalization to improve accuracy.

[0104] For non-uniform meshes, the method for calculating the mixed Voronoi area is as follows:

[0105]

[0106] in, It is a triangle T j ={v i ,v j1 ,v j2 The weighted area is assigned to each vertex, and we have:

[0107]

[0108] Where α j ,β j For T j middle and v i Opposite angles.

[0109] The Voronoi area is the area occupied by a single Voronoi cell in a Voronoi graph (also known as a Thiessen polygon). A Voronoi graph is generated from a set of discrete points (called "seed points" or "generators"), each seed point corresponding to a Voronoi cell, where all points within the cell are less distant from the seed point than from any other seed point.

[0110] In mesh processing, Voronoi area is often used to estimate the "weight" of vertices. In curvature calculation, Voronoi area is used to weight and average neighborhood information, thereby improving accuracy.

[0111] S32, region expansion: based on the breadth-first search (BFS) algorithm, the seed vertex is quickly expanded to its adjacent neighborhood, and the expansion relies on the face adjacency relationship of the half-edge data structure to form an initial subdivision region, and the expansion radius R is:

[0112]

[0113] where K is the maximum curvature of the current mesh, R is the base radius. max base

[0114] Expansion termination condition: curvature gradient reaches R.

[0115] S4, divide the LOD level, and calculate the projection area of different mesh subdivision regions in the view frustum as the importance weight ω, and allocate computing resources and arrange the subdivision order according to the importance weight ω. According to the importance weight ω, the LOD level and the computing resources of different mesh subdivision regions are determined, the larger the projection area is, the higher the subdivision level (LOD) is allocated, and the more computing resources are allocated, so that the mesh subdivision region obtains finer triangulation.

[0116] In computer graphics, the importance weight based on the view frustum is used to measure the visual importance of the subdivision region (such as objects, terrain blocks, etc.) in the scene in the camera view frustum, and the core indicator is the projection area, that is, the projection area of the subdivision region on the near clipping plane (or screen space). The larger the projection area is, the more pixels the region occupies in the final rendering, and therefore more accurate subdivision or rendering resources are required.

[0117] The projection area is calculated based on the bounding sphere approximation, that is, the subdivision region is represented by a bounding sphere. Since the mesh data structure of the model reuses the half-edge structure to construct the adjacency relationship, the bounding sphere of the subdivision region can be quickly calculated from the model data. The center of the sphere in the camera space is P=(P x , y , z ), and the radius of the sphere is r, then the projection area formula is:

[0118]

[0119] where θ is the vertical field of view (FOV), a is the aspect ratio (Aspect Ratio), that is: a=screen height / screen width, and n is the near clipping plane distance.

[0120] The projection area is directly used as the importance weight ω as the basis for allocating computing resources, that is:

[0121]

[0122] ​​ω (weight) is proportional to r square, indicating that the larger the area, the higher the weight.

[0123] ω (weight) is proportional to P z square, indicating that the closer to the camera, the higher the weight.

[0124] The constant term a, n is the same for all areas, which can be calculated in advance.

[0125] S5, dynamic curvature sensitive subdivision, mesh subdivision, modify the vertex coordinates and index of the subdivision area, keep the data of the unchanged area, update the vertex list, the steps include:

[0126] S51, only for high curvature area (curvature threshold > K threshold ), use recursive method for subdivision, the subdivision method uses existing technology, such as Catmull-Clark subdivision algorithm, Loop subdivision algorithm, low curvature area keeps the original mesh, reduces the number of patches generated.

[0127] S52, by interpolating the boundary curve C1(u), C2(v) surface, the initial subdivision area is subdivided, boundary interpolation (Coons surface):

[0128]

[0129] Where P ij is the corner control point, which is used to eliminate the step discontinuity.

[0130] S53, after each mesh subdivision area is subdivided, modify the vertex coordinates and vertex index of the subdivision area, keep the data of the unchanged area, after each update of the vertex list, cache the data into the first buffer area opened in the memory buffer area, to ensure the compatibility of the rendering pipeline.

[0131] S54, terminate the subdivision when any one of the following three termination conditions is met:

[0132] Termination condition one, the curvature change amount ΔK of the subdivided area <0.05, where ΔK is the curvature difference before and after subdivision, that is, ΔK = ∑∣K new -K old ∣;

[0133]

[0134] Termination condition two, the number of GPU drawing calls (Draw Call) exceeds the specified threshold (such as 10,000 times / frame);

[0135]

[0136] Termination condition three, the curvature change rate threshold after subdivision:

[0137]

[0138] S6, call the vertex list data of the first buffer to calculate the screen projection of all LOD levels of Hausdorff distance as the initial screen projection distance H s1 , adjust the division of LOD levels according to whether the initial screen projection distance H s1 exceeds the threshold value, and update the adjusted data in the first buffer, as shown in Figure 4 adjust the division of LOD levels according to Hausdorff distance, and pre-adjust the division of LOD levels statically.

[0139] For all preset LOD levels (such as LOD0 and LOD1, LOD1 and LOD2), calculate the maximum Hausdorff distance Hmax in three-dimensional space, and calculate the critical screen projection distance H s1 (H s1 = Hmax×(pixel density / minimum visible distance)) based on the "maximum visible distance" of the model (such as the object being visible within 1 meter to 100 meters), that is, the initial screen projection distance H s1 . If H s1 is greater than the set threshold value, which is set to 0.5 pixels in this embodiment, the LOD model needs to be adjusted back (such as optimizing the low-mode simplification algorithm and reducing the shape deviation between the high mode and the low mode) to ensure that the "worst case" of the basic LOD level is still within the perception threshold.

[0140] The initial screen projection distance H s1 calculation process includes:

[0141] Calculate Hausdorff distance: Hausdorff distance is the maximum shape difference between two geometric sets, taking the high-mode LOD h level and the low-mode LOD l level as an example, the Hausdorff distance is defined as "the nearest distance from any point in LOD h to LOD l " and "the nearest distance from any point in LOD l to LOD h ", that is, the maximum value of Hausdorff distance H = max ( sup a ∈LOD h inf β ∈LOD l ||a-b||, sup β ∈LOD l inf a ∈LODh ||ab|| ).

[0142] Convert to initial screen projection distance H s1 Convert the 3D Hausdorff distance to the screen projection pixel distance, i.e., H. s1 H s1 = H × (screen pixel density / distance from object to viewpoint), in pixels. For example, an object with a 3D deformation of 0.1 meters will have a projection error of 0.1 / (10 × 0.001) = 10 pixels at a distance of 10 meters (pixel density 0.001 m / pixel), which far exceeds the perception threshold.

[0143] S7, in the dynamic LOD scheduling module, dynamically schedules the LOD level and updates the scheduled data in the first buffer.

[0144] S71 schedules the switching of LOD levels spatially through frame interpolation.

[0145] The dynamic LOD scheduling module detects whether the importance weight ω of the mesh subdivision region under the current view has reached the threshold for LOD level switching. If the threshold is reached based on screen-space error (SSE), then the vertex list in the first buffer is called in real time to calculate the screen projection of the Hausdorff distance of the mesh subdivision region under the current view between the current LOD level and the adjacent LOD level to be switched, as the real-time screen projection distance H. s2 If H s2 > 0.5 pixels, temporarily increase the number of transition interpolation frames (e.g., extend from 8 frames to 12 frames) to control the deformation amplitude. By diluting the perceived deformation through a longer gradient, the layer differences are masked, ensuring that the shape differences between adjacent LOD layers are within the limits of human visual perception. H s2 The calculation steps are as follows:

[0146] S711, take two adjacent LOD levels h and LOD l Key feature points (such as corner vertices, sampling points in high curvature regions);

[0147] S712 calculates the 3D distance between feature point pairs, combines it with the distance D from the current object to the viewpoint, and converts it into the real-time screen projection distance H. s2 = Feature point distance D × (screen horizontal resolution / (2 × D × tan (FOV / 2))), where FOV is the field of view angle;

[0148] In this implementation, the real-time screen projection distance H s2 Set the threshold to 0.5 pixels, i.e., H. s2For grid areas larger than 0.5 pixels, the number of transition interpolation frames is increased to limit the shape difference of the LOD level in the spatial dimension and ensure "transitionability" - even if there is slight deformation during the transition process, it cannot be detected by the human eye; it provides a "safe deformation range" for subsequent temporal interpolation to avoid interpolation failure due to excessive differences in the base model.

[0149] S72 adjusts the values ​​of multiple control points of the Bézier curve according to the application scenario, thereby adjusting the transition time rhythm of the LOD level and avoiding the mechanical feel (such as sudden acceleration and deformation of the model) caused by linear interpolation (α changes at a constant speed with time).

[0150] Bézier curves dynamically adjust the rate of change of interpolation weight α to make the transition conform to the human eye's perception of "natural motion" (slow start, fast middle, slow finish).

[0151] Interpolation weight α is a key parameter controlling the LOD blending ratio when switching from LOD. l (Low-poly) to LOD h (For high-order modulo), α∈[0,1]:

[0152] α=0: Fully display LOD l ;

[0153] α=1: Fully display LOD h ;

[0154] α is the intermediate value: hybrid LOD l and LOD h The vertex position (p = (1-α)×p) l + α×p h ), normal (n = (1-α)×n l + α×n h Texture coordinates, etc., are used to achieve gradual deformation.

[0155] The linear interpolation α(t) = t (t is the proportion of the transition time, t∈[0,1]) has a constant rate of change (derivative is 1), resulting in an abrupt transition. The Bézier curve adjusts the slope (rate of change) of α(t) by using control points.

[0156] Using typical third-order Bézier curves to mix LOD l and LOD h For example, the settings are as follows:

[0157] The curve expression is B(t) = P0×(1-t)³ + 3P1×t(1-t)² + 3P2×t²(1-t) + P3×t³, where P0, P1, P2, and P3 are four control points, and:

[0158] P0=(0,0): Start point, a=0 (fully low mode);

[0159] P1=(0.2, 0.1): First control point, control the transition start phase, when t=20%, a only reaches 10%, slow start, reduce the perception of "sudden start";

[0160] P2=(0.8, 0.9): Second control point, control the transition middle phase, when t=80%, a has reached 90%, fast complete the main deformation in the middle phase;

[0161] P3=(1,1): End point, a=1 (fully high mode), slow down the end phase to avoid the abrupt feeling of "sudden stop".

[0162] The derivative of the Bezier curve (the rate of change of a to t) presents a "low→high→low" trend, that is:

[0163] Start phase (t=0~0.2): The rate of change slowly rises from 0 (e.g. t=0 derivative ≈0.75), the model deformation starts gently;

[0164] Middle phase (t=0.2~0.8): The rate of change maintains a high level (e.g. peak derivative ≈2.5), quickly completes most of the deformation, reducing the total transition time;

[0165] End phase (t=0.8~1): The rate of change slowly falls from a high level to 0, the model deformation converges naturally.

[0166] When dealing with fast-moving objects, shorten the transition time (e.g. 4 frames), adjust P1=(0.1,0.3), P2=(0.9,0.7), speed up the middle deformation, avoid the object moving out of the field of view before the transition is completed;

[0167] When dealing with close-range static objects, extend the transition time (e.g. 16 frames), adjust P1=(0.3,0.05), P2=(0.7,0.95), slow down the start and end, enhance the delicate feeling;

[0168] When dealing with high-curvature area transition, increase the rate of change when a approaches 0.5, quickly pass through the high-sensitivity area, reduce the perception of angular deformation.

[0169] Use Bezier curve to adjust the transition time rhythm of LOD level, optimize the transition rhythm from time dimension, make the deformation process consistent with the expectation of "natural motion" of human eyes (slow start, fast middle, slow end);

[0170] Cooperate with geometric deformation measurement, within the safe deformation range, further hide the traces of level switching through rhythm control.

[0171] The step S71 and the step S72 are both carried out in the dynamic LOD scheduling module, and the perception problem of the LOD transition is solved from the spatial limitation and the time rhythm two dimensions respectively, and the visual smooth line is enhanced:

[0172] The geometric deformation measurement is calculated in two stages of the step S6 and the step S71 through the Hausdorff distance, the shape difference of the LOD level is ensured to be within the limit of the human eye perception, the timing interpolation controlled by the Bezier curve avoids the mechanical feeling, and the deformation process is natural and smooth. The combination of the two can realize the LOD transition that cannot be perceived by the human eye.

[0173] S8, the second buffer area of the memory buffer area exchanges data with the first buffer area, the second buffer area transmits data to the rendering module for rendering the grid, and the rendering and display of the grid are completed.

[0174] According to the importance weight ω, the LOD level and the grid subdivision order of different grid subdivision areas are determined, the near view area is preferentially processed, data is updated and stored in the first buffer area after part of the near view grid is processed, the second buffer area is consistent with the first buffer area after data exchange, and the rendering module can perform rendering in advance by extracting the data of the second buffer area. When rendering, other subdivision areas are subdivided according to the importance weight ω at the same time, the grid subdivision and the rendering are synchronized, and the real-time preview effect is realized.

[0175] Embodiment two

[0176] A grid adaptive subdivision system for CAD modeling, comprising:

[0177] The preprocessing module is used for sorting the vertex coordinates of the model data according to the spatial position, and constructing the adjacent relationship of the grid data structure of the model by using the half-edge structure, so as to realize the step S2 in the embodiment one;

[0178] The importance weight calculation module calculates the projection area of different grid subdivision areas in the view frustum as the importance weight ω, so as to realize the step S4 in the embodiment one;

[0179] The grid subdivision module is used for selecting the vertex with the curvature K i greater than the curvature threshold value as a seed vertex, expanding the initial subdivision area based on the seed vertex to perform grid subdivision, modifying the vertex coordinates and the index of the subdivision area, retaining the data of the unchanged area, and updating the vertex list.

[0180] Embodiment three

[0181] A grid real-time preview system for CAD modeling, comprising the grid adaptive subdivision system for CAD modeling in the embodiment two, and further comprising:

[0182] a LOD level division module, configured to determine LOD levels of different mesh subdivision regions according to the importance weight ω;

[0183] a dynamic LOD scheduling module, configured to implement the LOD level dynamic scheduling in steps S6 and S7 of the embodiment;

[0184] a first buffer, configured to store initial and updated vertex list data;

[0185] a second buffer, configured to exchange data with the first buffer after the data of the first buffer is updated;

[0186] a rendering module, configured to extract data of the second buffer and perform mesh rendering.

[0187] Embodiment Four

[0188] An intelligent terminal, comprising a processor and a memory, the memory stores a computer program, the processor is in communication connection with the memory, and the processor executes the mesh adaptive subdivision method for CAD modeling or the mesh real-time preview method for CAD modeling in the embodiment one through the computer program.

[0189] Embodiment Five

[0190] A computer readable storage medium, storing program data, the program data is used to execute the mesh adaptive subdivision method for CAD modeling or the mesh real-time preview method for CAD modeling of the embodiment one.

[0191] The preferred embodiments of the present application are described in detail above with reference to the accompanying drawings, but the present application is not limited to the specific details in the above-described embodiments, and various simple modifications can be made to the technical solutions of the present application within the technical concept of the present application, and these simple modifications all belong to the protection scope of the present application.

Claims

1. A method for adaptive mesh subdivision for CAD modeling, characterized in that, The method comprises the following steps: Model data preprocessing, sorting the vertex coordinates of the model according to the spatial position, so that the vertex coordinates with adjacent spatial positions are stored continuously in the vertex list, and the mesh data structure of the model is constructed by using half-edge structure to establish adjacency relationship, and the starting point, ending point, opposite edge and adjacent face of each edge are recorded; Divide the mesh sub-region, select the curvature K i The vertex greater than the curvature threshold is selected as a seed vertex, and an initial sub-region is expanded based on the seed vertex Calculate the importance weight ω, calculate the projection area of different mesh subdivision regions in the view volume as the importance weight ω, and allocate the calculation resources and arrange the subdivision order according to the importance weight ω; Carrying out mesh subdivision, modifying the vertex coordinates and indexes of the subdivision region, retaining the data of the unchanged region, and updating the vertex list.

2. The CAD modeling oriented mesh adaptive subdivision method of claim 1, wherein, The curvature threshold value is negatively correlated with the importance weight ω.

3. The CAD modeling oriented mesh adaptive subdivision method of claim 1, wherein, The model data preprocessing further comprises the following steps: Dividing the model into uniform grids, each grid storing the vertex and face index contained in the grid, and traversing and searching the elements in the grid by positioning the grid.

4. The CAD modeling oriented mesh adaptive subdivision method of claim 3, wherein, The construction steps of the grid include: Determining the range of the entire bounding box according to the maximum and minimum values of all vertex coordinates; Setting the grid size and calculating the number of grids; Establishing the grid coordinate system; Associating the vertex with the corresponding grid.

5. The CAD modeling oriented mesh adaptive subdivision method according to any one of claims 1-4, characterized in that, When any one of the following three termination conditions is met during mesh subdivision, the subdivision is terminated: Termination condition one, the curvature change amount ΔK of the region after subdivision is less than the set threshold value; Termination condition two, the number of GPU rendering calls exceeds the specified threshold value; Termination condition three, the curvature change rate after subdivision is less than the set threshold value.

6. A method for real-time preview of a mesh for CAD modeling, the method comprising: The mesh subdivision adopts the mesh adaptive subdivision method for CAD modeling according to any one of claims 1-5, and the importance weight ω is used to determine the LOD level of different mesh subdivision regions, and the vertex coordinates and indexes of the subdivision region are modified once after each mesh subdivision region is completed during mesh subdivision, and the real-time preview method further comprises the following steps: After each update of the vertex list, the data is cached into the first buffer area opened in the memory buffer area; The second buffer area opened in the memory buffer area exchanges data with the first buffer area; The second buffer area transmits data to the rendering module for rendering the mesh, and completes the rendering and display of the mesh.

7. The CAD modeling oriented mesh real-time preview method according to claim 6, characterized in that, Further comprising the following steps: calling a screen projection of the Hausdorff distance of all LOD levels as an initial screen projection distance H from vertex list data of the first buffer s1 adjusting the division of the LOD levels according to whether the initial screen projection distance H s1 exceeds a threshold value, and updating the adjusted data in the first buffer.

8. The CAD modeling oriented mesh real-time preview method according to claim 7, characterized in that, The operation of adjusting the division of the LOD level includes reverting the model with the adjusted LOD.

9. The CAD modeling oriented mesh real-time preview method according to claim 6 or 7 or 8, characterized in that, Further comprising the following steps: Dynamically scheduling the LOD level and updating the scheduled data in the first buffer area, and dynamically scheduling the LOD level comprises the following steps: whether the importance weight ω of the mesh subdivision region under the current view angle reaches a threshold of LOD level switching, if yes, a screen projection of the Hausdorff distance between the current LOD level and the adjacent LOD level to be switched of the mesh subdivision region under the current view angle is calculated as a real-time screen projection distance H s2 , if the real-time screen projection distance H s2 is greater than a set threshold, the rendering frame number of the transition interpolation is increased, and the adjusted data is updated in the first buffer.

10. The CAD modeling oriented mesh real-time preview method according to claim 6 or 7 or 8, characterized in that, Dynamically scheduling the LOD level further comprises the following steps: A Bezier curve is used to adjust the transition time rhythm when switching between the high and low LOD levels, and the curve expression is B(t) = P0×(1-t)³ + 3P1×t (1-t)² + 3P2×t²(1-t) + P3×t³, P0, P1, P2 and P3 are four control points, wherein: P0=(0,0), controlling the low end of the model; P1=(0.2, 0.1), as the first control point; P2=(0.8, 0.9), as the second control point; P3=(1,1), controlling the high end of the model.

11. A CAD modeling oriented mesh adaptive subdivision system, characterized by, ​ The preprocessing module is configured to sort vertex coordinates of model data according to spatial positions so that vertex coordinates of adjacent spatial positions are stored continuously in a vertex list, and construct an adjacency relationship of a mesh data structure of the model by using a half-edge structure, and record a start point, an end point, an opposite edge and an adjacent face for each edge; The importance weight calculation module is configured to calculate a projection area of different mesh subdivision regions in a view frustum as an importance weight ω; a mesh subdivision module for selecting a curvature K i a vertex with a curvature greater than a curvature threshold as a seed vertex, expanding an initial subdivision region based on the seed vertex, and performing mesh subdivision according to a computation resource allocated based on the importance weight ω and a subdivision order arranged, modifying vertex coordinates and indexes of the subdivision region, retaining data of an unchanged region, and updating a vertex list.

12. A CAD modeling oriented mesh real-time preview system, characterized in that, The mesh adaptive subdivision system for CAD modeling according to claim 11 further comprises: The LOD level division module is configured to determine LOD levels of different mesh subdivision regions according to the importance weight ω; The first buffer is configured to store initial and updated vertex list data; The second buffer is configured to exchange data with the first buffer after data of the first buffer is updated; The rendering module is configured to extract data of the second buffer and perform mesh rendering.

13. A smart terminal, characterized by The intelligent terminal comprises a processor and a memory, the memory stores a computer program, the processor is in communication connection with the memory, and the processor executes the mesh adaptive subdivision method for CAD modeling according to any one of claims 1-5 or the mesh real-time preview method for CAD modeling according to any one of claims 6-10 by using the computer program.

14. A computer-readable storage medium, characterized in that, The computer readable storage medium stores program data, and the program data is used to execute the mesh adaptive subdivision method for CAD modeling according to any one of claims 1-5 or the mesh real-time preview method for CAD modeling according to any one of claims 6-10.

Citation Information

Patent Citations

  • Self-adaptive grid subdivision method, device and equipment and storage medium

    CN112733318A

  • BIM model plane cutting analysis method based on Cesium

    CN119720360A