Three-dimensional model wall thickness measuring method combining ray method and spherical surface method
By combining the hybrid strategy of the ray method and the spherical method, using the SAH-optimized AABB tree to build an acceleration structure, and dynamically selecting the measurement mode, the problem of the existing technology in balancing the efficiency and accuracy of 3D model wall thickness measurement when measuring complex geometric shapes is solved, and efficient and accurate wall thickness analysis and visualization are achieved.
Patent Information
- Application Number
- CN202510748958.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-06
- Publication Date
- 2025-09-23
AI Technical Summary
Existing 3D model wall thickness measurement technology is difficult to simultaneously meet the requirements of high efficiency, high precision and robustness when dealing with complex geometric shapes. In particular, the measurement accuracy decreases on complex surfaces, thin-walled structures and sharp edges, and it is highly dependent on the quality of the initial triangular mesh.
A 3D model wall thickness measurement method combining the ray method and the spherical method was proposed. By optimizing geometric preprocessing and adaptive subdivision, an acceleration structure was constructed using the SAH-optimized AABB tree, the optimal measurement mode was dynamically selected, and the wall thickness was calculated using a hybrid strategy of the ray method and the spherical method.
It achieves efficient and accurate wall thickness analysis of complex 3D models, significantly improves collision detection efficiency, ensures the accuracy of measurement results and intuitive visualization, and is suitable for various complex geometric features.
Smart Images

Figure CN120689392A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer-aided design (CAD) and three-dimensional model analysis, and specifically to a three-dimensional model wall thickness measurement method combining a ray method and a spherical method. Background Art
[0002] Accurately measuring and analyzing the wall thickness of 3D models is crucial in fields such as mechanical manufacturing, mold design, additive manufacturing (3D printing), and computer-aided engineering (CAE). Part wall thickness is a key factor in determining structural strength, stiffness, heat dissipation, material consumption, and manufacturing costs. Improper wall thickness design, such as excessively thin walls, can lead to structural failure and damage, while excessively thick walls can cause material waste, increased weight, and uneven cooling.
[0003] Currently, industry and academia have proposed a variety of wall thickness analysis methods for 3D models, each with its own focus and limitations. When dealing with complex curved surfaces, thin-walled structures, sharp edges, or non-parallel surfaces, ray-based wall thickness measurement may not accurately capture the shortest distance or minimum wall thickness, resulting in reduced accuracy. Rays from a single direction also struggle to fully reflect local thickness information. Spherical methods are significantly more computationally complex than ray methods, making them particularly inefficient when dealing with large or complex models. Distance field-based methods estimate wall thickness by calculating the distance from a model surface point to its mid-axis plane or skeleton. However, the calculation of the mid-axis plane or skeleton is inherently complex and sensitive to noise and small features on the model surface, potentially leading to unstable results. Furthermore, the accuracy of these methods is affected by the quality of the initial 3D model (especially the triangular mesh model). Poor model triangulation, such as uneven mesh density or the presence of narrow, elongated, or misshapen triangles, directly impacts the accuracy of normal vector calculations and subsequent wall thickness measurements.
[0004] The patent "Model Wall Thickness Calculation Method, Device, Equipment, and Storage Medium" (Application Number: CN202211443564.3) proposes a method for processing three-dimensional models using a surface triangulation differential algorithm. The model surface is approximated as a number of face triangles, and the wall thickness value at any position is measured through differential point correction and normal vector calculation. Although this method can calculate the wall thickness value at any position in the model, it still has the problem of balancing computational efficiency and accuracy when dealing with complex geometric shapes.
[0005] In summary, existing wall thickness measurement technologies often struggle to simultaneously meet the requirements of high efficiency, high accuracy, and good adaptability to complex geometries. Therefore, developing a novel wall thickness measurement method that combines the advantages of different measurement strategies while overcoming their respective shortcomings, adapting to diverse geometric features while reducing its dependence on initial mesh quality, is of great practical significance and application value for improving product design verification and manufacturing quality control. Summary of the Invention
[0006] The technical problem to be solved by the present invention is to address the problem that existing three-dimensional model wall thickness measurement technology is difficult to strike a balance between efficiency, accuracy and robustness when processing complex geometric shapes. The present invention provides a method, device, equipment and storage medium for accurately measuring the wall thickness of a three-dimensional model that combines ray projection and spherical fitting strategies.
[0007] To achieve this goal, the technical solution proposed in this application aims to realize efficient and accurate wall thickness analysis of any three-dimensional model by optimizing geometric preprocessing, adopting an efficient acceleration structure, and dynamically selecting the optimal measurement mode based on local geometric features.
[0008] To solve the above technical problems, the present invention provides a technical solution: a method for measuring the wall thickness of a 3D model by combining the ray method and the spherical method, comprising processing an input 3D solid model using the surface triangulation algorithm provided by the BRepMesh_IncrementalMesh class in the open source geometry framework OpenCascade. This step converts the model's continuous surface (such as NURBS and B-Spline surfaces) into a discrete triangular mesh representation, i.e., generates a number of basic triangular facets that constitute the model surface.
[0009] To improve measurement accuracy and adapt to the geometric complexity of different areas, the basic triangular mesh obtained in the previous step is adaptively subdivided to optimize mesh quality. In particular, the mesh is denser in areas with high curvature or details, while maintaining a reasonable sparsity in flat areas. Ultimately, an optimized triangular mesh is obtained with a more uniform distribution of facet sizes and a more accurate reflection of local geometric features.
[0010] To significantly improve the efficiency of subsequent large-scale geometric queries (especially ray-triangle collision detection and sphere-triangle contact determination), a hierarchical spatial index data structure is constructed for the optimized triangle mesh. This structure is implemented as an axis-aligned bounding box (AABB) tree. The key point is that the construction of this AABB tree adopts the surface area heuristic (SAH) optimization strategy to minimize the expected query cost and generate an efficient acceleration structure.
[0011] On the surface of the model that has been adaptively subdivided and optimized, a series of measurement points are selected. The geometric centroid of each triangle is chosen as the measurement point P. The precise surface normal vector n at this point is calculated. Starting from point P, a detection ray R is emitted in the opposite direction of the normal vector -n (i.e., pointing into the model), and the starting point and direction of the ray are recorded.
[0012] Use the constructed AABB tree to accelerate the search for the nearest valid intersection point P between ray R and other surfaces of the model intersect , and get the triangle normal vector n at the intersection intersect , calculate the initial normal vector n and the intersection normal vector n intersect The spatial angle θ between them is compared with the preset angle threshold (5°). If the angle is within the threshold, the ray method with high computational efficiency is selected. If the angle exceeds the threshold or no valid intersection is found, the spherical method with higher accuracy is switched to.
[0013] According to the selection result, the corresponding wall thickness calculation logic is executed: If the ray method is selected, the wall thickness is P and P intersect If the spherical method is selected, the wall thickness is determined by iteratively finding the maximum inscribed sphere. This hybrid strategy ensures a balance between efficiency and accuracy.
[0014] Repeat the above process for all points on the model surface that need to be measured to obtain the wall thickness value of each point. Finally, summarize these wall thickness data and generate an intuitive wall thickness distribution map through visualization techniques such as color gradient mapping.
[0015] Preferably, the adaptive subdivision is a quadtree-based adaptive subdivision, specifically including:
[0016] According to the given chord height tolerance, all boundary curves of the original surface are adaptively sampled in UV space to generate a series of discrete UV points and the set of line segments they constitute, and the 3D space coordinates and line segments corresponding to these UV points are recorded at the same time;
[0017] Create a quadtree root node covering the entire surface UV parameter domain and put it into a processing queue. When the queue is not empty, take a node from it for processing, determine the position of the node relative to the discrete UV boundary, and classify it as inside (IN), outside (OUT) or boundary (ON). If the node is OUT, it is discarded directly.
[0018] For non-OUT nodes, the preset subdivision criteria are used for judgment. If the current node does not meet the subdivision stop condition, it will be evenly divided into four child nodes, and these child nodes will be added to the processing queue for deeper subdivision;
[0019] If the current node meets all the subdivision stop conditions, it is determined to be a leaf node. The leaf node and its classification (IN or ON) are stored and wait for the final unified mesh generation. This process is repeated until the processing queue is empty, that is, all areas that need to be subdivided have been completed;
[0020] Traverse all stored leaf nodes. For leaf nodes classified as IN, directly generate triangles in their UV areas and map the vertices to three-dimensional space. For leaf nodes classified as ON, use the previously stored discrete boundary segments as constraints, combine the points generated inside the nodes, and use constrained triangulation and other methods to generate triangles that can accurately fit the boundaries. Map the vertices to three-dimensional space, combine all generated triangles, and form the final adaptive triangular mesh output.
[0021] Preferably, the SAH optimized AABB tree construction method is:
[0022] A hierarchical bounding volume acceleration data structure is adopted, specifically implemented as an axis-aligned bounding box (AABB) tree. A more computationally cost-effective surface area heuristic (SAH) strategy is introduced to guide the recursive segmentation process, aiming to minimize the expected computational cost of a single traversal query.
[0023] The theoretical basis of SAH comes from the probabilistic model analysis of the cost of ray tracing (or other geometric queries). Assume that a query ray is parent The bounding box intersects with the left child N. left or right child node N right The probability of the bounding box intersecting can be approximately calculated by the surface area S(N left ), S(N right ) relative to the parent node bounding box surface area S(N parent ) ratio, that is,
[0024]
[0025] Similarly The total expected cost C of a single query can be expressed as the traversal cost C trav And the weighted sum of the child node query costs:
[0026] C query (N parent )=C trav +P left ·C query (N left )+P right ·C query (N right)
[0027] Among them, C query (N leaf )=N prims ×C intersct , the query cost of a leaf node is the number of primitives (triangles) it contains N prims The cost of intersection test with a single primitive C intersct The goal of SAH is to select a partitioning scheme (partition axis and partition position) for each internal node when building a tree, so as to minimize the expected query cost after partitioning. In practical applications,
[0028] A simplified single-layer SAH cost function is usually used to evaluate the quality of a segmentation:
[0029]
[0030] where N prims,left , N prims,right They are the number of triangles contained in the left and right child nodes after segmentation, and C split The minimum partitioning scheme performs the partitioning, recursively until the number of triangles contained in the leaf node is less than or equal to the preset threshold.
[0031] Preferably, the specific implementation of the ray method includes:
[0032] When the raycast mode is selected, its specific implementation depends on the AABB tree constructed above;
[0033] Select a measurement point P on the model surface and obtain the position of the point on the triangular mesh of the model surface and the normal vector direction n;
[0034] Starting from the root node, perform a depth-first traversal of the AABB tree along the ray direction. If the current node AABB does not intersect with the ray, then remove the node and all its child nodes. If they intersect and the current node is a non-leaf node, recursively check its child nodes; if they intersect and the current node is a leaf node, perform a ray-triangle intersection test;
[0035] Perform ray-triangle intersection calculation on the triangles in the leaf node, screen candidate intersection points, record intersection parameters (such as distance, normal vector), and verify whether the intersection point is within the valid range of the ray. If the current leaf node detection is not completed (there are undetected triangles), return to continue testing. If the detection is completed, select the closest intersection point from all candidate intersection points as the final result;
[0036] Calculate the Euclidean distance between the measured point and the nearest intersection point as the wall thickness value of the current area.
[0037] Preferably, the specific implementation of the spherical method includes:
[0038] When the spherical method mode is selected, its specific implementation also uses the constructed AABB tree for acceleration;
[0039] Select a measurement point P on the model surface, obtain its coordinates and normal vector direction n, emit a ray along the normal vector direction n, perform a ray-triangle intersection test, obtain the nearest intersection point Q and distance d, and use this as the initial sphere radius r = d;
[0040] The initial detection sphere is generated with the center point between the intersection point Q and the measurement point P as the center of the circle and d as the radius of the sphere. The shrinkage step size Δr is set to 0.05mm and the accuracy threshold ε is set to 0.005mm.
[0041] Starting from the root node of the AABB tree, sort the child nodes by SAH cost and perform depth-first traversal. If the current node AABB does not intersect with the sphere: remove the node and all its child nodes; if they intersect and the current node is a non-leaf node: recursively check its child nodes; if they intersect and the current node is a leaf node: perform sphere-triangle intersection test;
[0042] Perform the following calculations on the triangles in the leaf nodes: Calculate the distance D from the sphere center to the triangle plane. If D>r, determine that there is no intersection; if D≤r, determine that there is intersection, and update the sphere radius r=min(r, D);
[0043] After each round of detection, the sphere radius is shrunk to r = r - Δr, and the AABB tree is traversed again. When there is only a tangent relationship between the sphere and the triangle, the iteration is stopped, and the maximum inscribed sphere diameter 2r is used as the wall thickness value of the current measurement point.
[0044] Preferably, by setting an angle threshold of 5° as a criterion for selecting the measurement method, the switch between the ray method and the spherical method is realized. When the angle between the normal vector at the measurement point and the normal vector at the intersection point is less than 5°, the ray method with higher computational efficiency is adopted; when the angle exceeds 5° or no valid intersection is detected, the spherical method with higher accuracy is switched to.
[0045] The dynamic switching mechanism based on geometric features ensures both measurement efficiency in flat areas and measurement accuracy in complex curved areas, making overall wall thickness calculation fast and accurate.
[0046] Preferably, the normal vector angle at each measurement point is calculated in real time:
[0047] If the angle is ≤5°, the ray method is used directly to calculate the result;
[0048] If the angle is >5°, the spherical method is activated for accurate calculation;
[0049] If there is no intersection, the spherical method is used by default.
[0050] Preferably, the visualization result of the model wall thickness is achieved by color gradient mapping, wherein:
[0051] The method for generating visualization results includes: mapping the calculated wall thickness value range to a continuous color gradient, using the HSV color space for linear interpolation so that the wall thickness values from minimum to maximum can smoothly correspond to the color changes from blue (representing thin walls) to green (representing standard wall thickness) and then to red (representing thick walls), and then applying these colors to the corresponding surface areas of the three-dimensional model for rendering. In addition, an interactive function can be provided, where the precise wall thickness value of the point is dynamically displayed when the mouse hovers over the model surface, and the user can customize the color mapping scheme and critical wall thickness threshold as needed.
[0052] Another aspect of the present invention discloses a model wall thickness calculation device, which is as follows:
[0053] An adaptive subdivision module processes the three-dimensional model using a model triangulation algorithm to obtain triangular facets corresponding to the preliminary three-dimensional model, and then further subdivides the model using adaptive subdivision to obtain a number of triangular facets corresponding to the three-dimensional model for performing mesh optimization processing;
[0054] SAH acceleration engine, responsible for building SAH-optimized AABB trees and performing subsequent collision detection;
[0055] Hybrid measurement control module, which integrates the ray method measurement unit and the spherical method measurement unit, is responsible for executing measurement point selection, ray emission, intersection point determination, angle calculation, mode selection, and calling the corresponding unit to calculate wall thickness;
[0056] Visualization interface, responsible for receiving wall thickness data and generating visualization results.
[0057] Another aspect of the present invention discloses a computer device, comprising a processor, a memory, and a computer program stored in the memory, wherein the processor has a computer program capable of being loaded by the processor and executing any of the above-mentioned model wall thickness calculation methods.
[0058] Another aspect of the present invention discloses a computer-readable storage medium, which adopts the following technical solution: storing a computer program that can be loaded by a processor and execute any of the above-mentioned model wall thickness calculation methods.
[0059] The advantages of this invention over existing technologies are as follows: 1. By introducing a SAH-optimized AABB tree structure and employing a dynamic spatial partitioning strategy based on surface area heuristics, it achieves rapid spatial partitioning of complex 3D models. By accurately calculating the expected query cost of each partitioning plane and selecting the optimal partitioning scheme, the number of invalid intersection tests in ray and sphere queries is significantly reduced, significantly improving collision detection efficiency in wall thickness calculations for complex models.
[0060] 2. Combining adaptive subdivision with a hybrid measurement strategy, the system dynamically adjusts mesh density based on local curvature characteristics through a quadtree recursive subdivision algorithm, ensuring accurate representation of surface geometry. This allows it to identify the geometric features of different regions of the model and select the most appropriate measurement method: using the efficient ray method for rapid measurement in flat areas, while switching to the high-precision spherical method for complex curved surfaces. This adaptive measurement strategy enables full-model wall thickness analysis, ensuring both computational efficiency and measurement accuracy.
[0061] 3. Based on the open source geometry kernel OpenCascade, it has good platform compatibility and scalability. The system provides a wall thickness distribution visualization function based on color mapping, which clearly displays the wall thickness changes in each area of the model through intuitive color gradients, allowing engineers to quickly identify potential problem areas and provide a direct basis for design optimization. Whether it is a simple mechanical part or a complex free-form surface model, accurate wall thickness measurement results can be obtained, which can be widely used in multiple engineering fields such as product design verification, manufacturing process analysis and quality inspection. BRIEF DESCRIPTION OF THE DRAWINGS
[0062] Figure 1 It is a schematic diagram used to illustrate the wall thickness definition in the embodiments of this application.
[0063] Figure 2 It is a flow chart of the model wall thickness measurement method in an embodiment of the present application.
[0064] Figure 3 This is a flow chart used to demonstrate the X-ray method for measuring wall thickness in the embodiments of the present application.
[0065] Figure 4 This is a flow chart used to demonstrate the spherical method for measuring wall thickness in the embodiments of the present application.
[0066] Figure 5 It is used in the embodiment of the present application to demonstrate the intersection determination between rays and AABB bounding boxes.
[0067] Figure 6 It is a schematic diagram used to illustrate the intersection between rays and triangular facets in the embodiments of the present application. DETAILED DESCRIPTION
[0068] The present invention will be described in further detail below with reference to the accompanying drawings.
[0069] The following is combined with Figure 1-6 Further details of this application
[0070] The embodiment of the present application discloses the definition of wall thickness, which is as follows:
[0071] like Figure 1 The wall thickness at points a1 and b1 shown is measured using the ray method. Rays originate from a1 and b1, respectively, and intersect at points a2 and b2 along the opposite direction of their normal vectors. The wall thickness is the Euclidean distance d(a1, a2) and d(b1·b2) between the point pairs. However, at point p, a ray emitted in the opposite direction of the normal vector intersects the opposite surface at point q. From point q, the ray is then emitted in the opposite direction and intersects at point z. At this point, the wall thickness at point p is the Euclidean distance of pq, while the wall thickness at point q is the Euclidean distance of qz. In measurements between such non-parallel planes, the use of the ray method alone will lead to an ambiguous definition of the wall thickness. Therefore, it is necessary to combine the spherical method to more accurately define the wall thickness. At this point, the wall thickness at point p is the diameter of the largest inscribed sphere at that point.
[0072] The present application discloses a method for calculating the wall thickness of a model, which is applied to a wall thickness measurement system.
[0073] like Figure 2 As shown, the method comprises the following steps:
[0074] S10, meshing the three-dimensional model using a triangulation algorithm.
[0075] Specifically, the wall thickness measurement system first needs to obtain a three-dimensional model, and then use a triangulation algorithm to process the three-dimensional model, dividing the complex surface on the three-dimensional model into a large number of simple triangular faces to approximately describe the surface. The triangulation algorithm can be completed through the open source geometry framework OpenCascade, and implemented using the functions of the BRepMesh_IncrementalMesh class in the OpenCascade library. BRepMesh_IncrementalMesh has two main triangulation options - linear triangulation and angular triangulation. The first step is to discretize all edges of the face according to the specified parameters, and the second step is to subdivide the face. Linear discretization limits the distance between the curve and the mesh, while angular discretization limits the angle between subsequent line segments in the broken line. It should be noted that the wall thickness measurement system requires staff to import the three-dimensional model whose wall thickness needs to be measured into the system, and then click the wall thickness measurement function to obtain the wall thickness value and the corresponding wall thickness color distribution.
[0076] S20, performing adaptive segmentation processing using the processed model.
[0077] The wall thickness measurement system will achieve high-precision discretization of the three-dimensional model through adaptive subdivision processing. Specifically, based on the given chord height tolerance, all boundary curves of the original surface are adaptively sampled in the UV parameter space to generate discrete UV point sets and their connecting segments. At the same time, the corresponding three-dimensional space coordinates are recorded, and then a quadtree structure covering the entire UV parameter domain is constructed. The root node is added to the processing queue during initialization. During the processing, the system sequentially takes out the nodes in the queue and accurately classifies them according to their positional relationship with the discrete boundary: nodes completely outside the boundary (OUT) are directly eliminated, and nodes intersecting with the boundary (O N) and nodes completely within the boundary (IN) enter the subdivision judgment process. For nodes that need to be subdivided, the system performs a quartering operation to generate four child nodes and re-enters the queue. This process continues to iterate until all nodes meet the subdivision stop conditions. Finally, the system performs differentiated processing on the leaf nodes that have completed the classification: IN nodes directly generate standard triangles in their UV domains, and ON nodes combine pre-stored boundary constraint information and use a controlled triangulation algorithm to generate a surface mesh that strictly fits the boundary. Through this hierarchical processing mechanism, the uniform distribution of mesh density in the surface parameter domain can be achieved while ensuring the boundary geometric accuracy.
[0078] S30, constructing a SAH-optimized AABB tree.
[0079] The specific AABB tree construction algorithm adopts a top-down recursive method:
[0080] For the input triangle patch set F = {f1, ..., f n}, calculate its overall AABB as the root node N root ;
[0081] Recursive construction function: If the number of primitives |P| contained in node N is less than or equal to the preset leaf node capacity threshold, then mark N as a leaf node, store the primitive list P, and return recursively;
[0082] Select the split axis: Usually, the axis with the longest bounding box size of the current node is selected as the candidate split axis among the three axes X, Y, and Z;
[0083] Determine candidate split positions: To avoid evaluating all possible positions, a binning strategy is used. Divide the node bounding box into N evenly along the axis. bins (N bins =16) interval (bin). Traverse all the elements f in the node i ∈P, calculate its center of mass C i and bounding box B i , according to the center of mass C iAssign the primitives to the corresponding bins and accumulate the number of primitives and the union of the bounding boxes in each bin;
[0084] Evaluate the split cost: traverse N bins -1 possible splitting plane. For each potential split, the N of the left and right child nodes is calculated based on the number of primitives accumulated by the bins on both sides and the union of the bounding boxes. prims and S, substitute into the above C split Formula to calculate segmentation cost;
[0085] Optimal split execution: choose the one with the lowest cost C split According to this optimal segmentation, the primitive set P is divided into two subsets P on the left and right. left and P right , calculate P left and P right Create N left and right child nodes with their own precise AABBs left and N right ;
[0086] The SAH-optimized AABB tree constructed through this process can divide space and primitives more effectively than traditional methods. The generated bounding boxes are more compact and have fewer empty areas. Therefore, in subsequent ray or sphere traversal queries, non-intersecting subtrees can be eliminated earlier and more effectively, significantly reducing the average query time complexity. The acceleration effect is especially significant for complex models with non-uniform geometric distribution.
[0087] S40, starting from the patch centroid point, emitting rays in the opposite direction of the patch normal vector.
[0088] The wall thickness measurement system uses a ray emission strategy based on the centroid of a triangle to measure wall thickness. In specific implementation, the system first calculates the geometric centroid coordinates of each triangle. This point is located at the average value of the three vertices of the triangle and can effectively represent the central area of the facet. During the measurement process, the centroid point is used as the starting point of the ray, and the detection ray is emitted in the opposite direction of the pre-calculated facet unit normal vector (i.e., pointing to the interior of the model). This emission method ensures that the measurement path remains perpendicular to the model surface, so that the most direct wall thickness measurement results can be obtained in simple geometric areas. The system will record the starting point coordinates, direction vector and emission timestamp of each ray, providing complete tracking information for subsequent collision detection and measurement method selection.
[0089] S50: Calculate the angle between the ray and the normal vector of the facet where the intersection point is located.
[0090] The wall thickness measurement system introduces a normal vector angle criterion to implement algorithm switching during the wall thickness measurement process. When the detection ray intersects the inner surface of the model, the system will accurately calculate the angle between two key normal vectors: one is the unit normal vector in the ray direction, and the other is the unit normal vector of the triangle patch at the intersection. The angle is calculated using the inverse cosine function to process the dot product of the two normal vectors, that is, θ = arccos(n1·n2), where n1 represents the emitting patch normal vector and n2 is the interface patch normal vector.
[0091] S60 , selecting different wall thickness measurement methods based on whether the included angle is within a threshold value θ, and calculating the wall thickness value corresponding to the measurement point.
[0092] The angle calculated by S50 is compared with the preset angle threshold θ:
[0093] If the angle is within the threshold (|180°-arccos(n·n inersect )|≤5°): Indicates that the surface at the measuring point and the intersection point is approximately parallel, the geometric structure is relatively simple, and the ray method is selected to calculate the wall thickness. The wall thickness value is equal to the measurement point P and the nearest effective intersection point P intersect The straight-line distance between (P, P intersect ), the specific execution process of the ray method is shown in the attached Figure 3 conduct;
[0094] The angle exceeds the threshold or no valid intersection is found: This indicates that the measurement point is not parallel to the surface at the intersection, or the ray cannot find a clear intersection point. This may correspond to complex curved surfaces, sharp angles, or thin walls. In this case, the spherical method is selected for more accurate wall thickness measurement. The specific execution process of the spherical method is as follows: Figure 4 conduct.
[0095] S70 , receiving the wall thickness calculation results of each measuring point and generating a color-coded wall thickness distribution map.
[0096] The embodiment of the present application discloses a method for measuring wall thickness in a simple geometric area, namely, a ray method, which is applied to a wall thickness measurement system.
[0097] When S60 selects the ray method, its core is to efficiently find the nearest intersection point between the ray and the model, such as Figure 3 As shown, the method comprises the following steps:
[0098] 1. Measurement point P, ray direction -n, and pre-built SAH optimized AABB tree;
[0099] 2. Depth-first traversal phase: Depth-first traversal can systematically check all relevant parts of the tree. Combined with subsequent intersection tests, it can effectively guide the search process to visit only those nodes that are likely to contain triangles that intersect with the ray. Starting from the root node of the tree, traverse down as deep as possible along a path until a leaf node is reached or a branch is eliminated. Then backtrack and explore other unvisited paths;
[0100] 3. Node intersection judgment stage: This is the core judgment in the acceleration process. For the currently traversed tree node, a mathematical calculation needs to be performed to determine whether the AABB (axis-aligned bounding box) representing the node intersects with the given ray. This is the key to spatial culling at this stage. If the ray does not even touch the bounding box of the node, then it will definitely not touch anything inside the bounding box (whether it is a deeper subnode or the final triangle face). If the test result is "no" (non-intersection), "cull nodes and subnodes" is executed. This means that the current node and the entire subtree under it can be safely ignored, and the algorithm no longer needs to check this branch. The algorithm then backtracks or continues to traverse other parts of the tree. If the test result is "yes" (intersection), it means that the ray passes through the bounding box and may intersect with some objects inside the bounding box, which requires further inspection.
[0101] 4. Leaf node determination stage: After determining that the ray intersects the current node AABB, it is necessary to determine whether this node is the "end" node of the tree, that is, a leaf node. A leaf node is a node in the AABB tree that no longer has child nodes. It is directly associated with one or several basic geometric units of the model. If the current node is a leaf node, it means that the tree has been deepened to the level containing the actual geometry (triangle facets). The algorithm needs to perform an accurate intersection test and enter the "Perform ray-triangle intersection test". If the current node is not a leaf node, it is an internal node, which means that there are more subdivided child nodes inside this bounding box. In order to find the final intersection point, it is necessary to continue to check in depth and execute "recursive check child nodes";
[0102] 5. Ray-Triangle Intersection Test Phase: When a leaf node intersecting with a ray is reached, this step is executed to perform an accurate ray-triangle intersection calculation for each triangle contained in the leaf node (using –Trumbore algorithm), the calculation will determine whether the ray actually intersects the triangle, and if so, calculate the intersection point;
[0103] 6. Child node recursion phase: When the ray intersects an internal node, this step is executed. The algorithm will repeat the entire judgment and traversal process starting from step 2 (or step 3) for each child node of this internal node;
[0104] 7. Record candidate intersection points: In step 5, whenever a ray and a triangle facet calculate an exact intersection point, this intersection point (including the intersection point coordinates and the distance from the ray starting point) will be temporarily stored;
[0105] 8. Leaf node determination phase: Check whether all relevant leaf nodes (i.e., those leaf nodes whose AABBs or those of their ancestor nodes intersect with the ray) have been processed, ensuring that all possible intersections have been checked before making a final selection. If there are still unchecked relevant nodes or branches (depth-first traversal is still in progress), the process needs to continue. Usually this means returning to step 2 and continuing to traverse the tree. If all possible paths that may intersect with the ray have been explored, and all triangles in the relevant leaf nodes have been tested;
[0106] 9. Result selection stage: Among all the recorded candidate intersection points (step 6), compare their distances from the starting point of the ray and select the intersection point with the closest distance. The ray may pass through multiple surfaces of the model, and usually only the first surface encountered by the ray (that is, the nearest intersection point) is of interest.
[0107] The embodiment of the present application discloses a method for measuring wall thickness in a complex geometric area, namely, a spherical surface method, which is applied to a wall thickness measurement system.
[0108] When S60 selects the spherical method, the goal is to find the largest inscribed sphere that can be embedded in the model wall near the measurement point P, as shown in the following figure. Figure 4 The flowchart depicts a spherical surface wall thickness measurement process accelerated by an AABB tree. It first uses the ray method to determine an initial sphere. It then iteratively shrinks the sphere and uses the AABB tree to efficiently perform intersection checks between the sphere and the model's triangular facets. Ultimately, the largest inscribed sphere that can fit within the model wall is found. The diameter of this sphere is the desired wall thickness. The method includes the following steps:
[0109] 1. Constructing an AABB tree: Similar to the ray method, in order to speed up subsequent calculations, the wall thickness measurement system uses the surface area heuristic (SAH) optimized AABB tree structure to accelerate ray collision efficiency;
[0110] 2. Determine the initial sphere using the ray method: This step is the initialization stage of the spherical method. The spherical method requires an initial sphere for subsequent iterations. A patch center point is selected on the model surface as the starting point for wall thickness measurement. A ray is emitted from this point in the opposite direction of its surface normal (pointing into the model). The intersection of this ray and the surface on the other side of the model is calculated. The line segment between the measurement point and the found intersection point is used as the diameter (the midpoint between the two points is the sphere center, and half the distance is the radius) to define an initial sphere. This sphere spans the local thickness of the model.
[0111] 3. Depth-first traversal stage: Similar to the ray method acceleration, the pre-built AABB tree is traversed using a depth-first strategy. The traversal starts from the root node and systematically checks the nodes of the AABB tree to find the model parts that may intersect with the currently processed sphere;
[0112] 4. Determination of intersection between node AABB and sphere: The core judgment of spherical method acceleration is to calculate whether the bounding box (AABB) of the currently traversed AABB tree node intersects with the sphere currently being processed in space. The intersection test between the sphere and AABB is usually completed by calculating whether the distance from the center of the sphere to the nearest point of the AABB is less than or equal to the radius of the sphere. The model parts that are far away from the current sphere in space are quickly eliminated. If the sphere does not even touch the bounding box of the node, then it will definitely not touch any triangles in the bounding box. If there is no intersection, "eliminate nodes and child nodes" is executed. The current node and its entire subtree are ignored, and the algorithm backtracks or continues to traverse other branches. If there is an intersection, it indicates that the triangles in the bounding box may be in contact with or intersect with the sphere, which requires further detailed inspection. The algorithm proceeds to the next step (step 5).
[0113] 5. Leaf node determination stage: Determine whether the node currently intersecting with the sphere AABB is a leaf node of the AABB tree. If it is a leaf node, a precise geometric test is required, and the "sphere-triangle intersection test" (step 6a) is executed. If it is a child node, it contains more subdivided child nodes, and it is necessary to continue the in-depth search and execute the "recursive check child node" (step 6b);
[0114] 6.a. Sphere-Triangle Intersection Test Phase: When a leaf node intersecting the sphere's AABB is reached, a precise sphere-triangle intersection test is performed on each triangle contained in the leaf node to determine whether the sphere's surface touches or passes through the triangle. This test also identifies the surface areas of the model that actually touch or intersect the sphere. This information is useful for subsequent adjustments to the sphere's size and position.
[0115] b. Recursive child node check stage: When the sphere intersects with the AABB of an internal node, recursively repeat the judgment and traversal process starting from step 3 or step 4 for each child node of this internal node;
[0116] 7. Shrink the sphere and find the maximum inscribed sphere stage: This is the core iterative process of the spherical method wall thickness calculation. After performing the sphere-triangle intersection test (step 6a) and traversing all relevant leaf nodes, the size of the sphere will be adjusted according to the contact or penetration of the sphere with the model surface. This process will be repeated. The goal is to find a sphere as large as possible that can be completely accommodated between the two opposite inner walls of the model and is just tangent to these inner wall surfaces (that is, the maximum inscribed sphere). The diameter of the sphere is the wall thickness.
[0117] The present application embodiment discloses the intersection detection between a ray and an AABB bounding box, specifically as follows:
[0118] To determine whether the ray intersects the bounding box, the Slabs algorithm can be used. For two-dimensional space, AABB is an axis-aligned rectangle. Slab refers to the range between a set of parallel lines in the rectangle. Let the starting point of the ray be P0, the ray direction vector, and t be the distance from the origin to the intersection point. The ray equation can be expressed as:
[0119]
[0120] like Figure 5 As shown, t1 and t2 represent the positions where the ray enters the x-slab and y-slab, and t3 and t4 represent the positions where the ray exits the x-slab and y-slab. For the ray to intersect with the AABB rectangle, the following conditions must be met:
[0121] max(t1,t2)<min(t3,t4)
[0122] Similarly, the three-dimensional case is similar to the two-dimensional case. Assume that the AABB bounding box is: min ,y min , z min , x max ,y max , z max limited, is the ray direction vector, P0 is the starting point of the ray, for the plane in the x-axis direction:
[0123]
[0124] t min_x , t max_x Represents the position of entering and exiting the x-slab, t min_y , t max_y , t min_z , t max_y The calculation is similar to that of , for the ray to intersect with the AABB rectangle, the following conditions must be met:
[0125] max(t min_x ,tmin_y ,t min_z )<min(t max_x ,t max_y ,t max_z )
[0126] The present application embodiment discloses a schematic diagram of intersecting a ray with a triangle facet, as follows:
[0127] The AABB bounding box that has intersected with the ray needs to determine which face in the bounding box the ray intersects with. Further confirmation is required. Here we use –Trumbore algorithm to find the intersection point, such as Figure 6 As shown, a triangular patch consisting of vertices A(V0), A(V1), and C(V2) has the following parametric equation for any point in the triangular patch:
[0128] P=(1-uv)V1+uV2+vV3
[0129] For a ray in space, its starting point is O and its direction is D. According to the ray parameter formula, the P of any point on it is:
[0130] P=O+tD
[0131] Where t>0, according to the different values of t, different points on the ray can be obtained, and these different points constitute the entire ray. Finding the intersection of the ray and the triangle can be converted to solving the following equation:
[0132] O+Dt=(1-uv)V1+uV2+vV3
[0133] By shifting the terms and taking t, u, and v as unknowns, we can get:
[0134]
[0135] According to the mixed product formula: |abc| = a × b·c = -a × c·b, the above formula can be rewritten as:
[0136]
[0137] Let P = D × E2, Q = T × E1, and get the parameter values t, u, v
[0138]
[0139] According to the parameter values t, u, v, find the intersection point P of the ray and the triangle.
[0140] The present application also provides a model wall thickness calculation device, which may include:
[0141] Adaptive subdivision module: used to execute the above steps S10 and S20, mesh and adaptively subdivide the 3D model, and optimize the mesh quality;
[0142] SAH acceleration engine: used to execute step S30, build the SAH-optimized AABB tree, and perform subsequent ray-AABB and sphere-AABB intersection detection;
[0143] Hybrid measurement control module: used to execute S40-S60 steps, including emitting rays, calculating intersection points and angles, and dynamically selecting to call ray method measurement unit or spherical method measurement unit according to the angle threshold. Figure 3 process) and spherical method (such as the attached Figure 4 Process) unit of specific calculation logic;
[0144] Visualization interface: used to execute step S70, receive the wall thickness calculation results of each measuring point, and generate a color-coded wall thickness distribution map.
[0145] The embodiment of the present application also discloses a computer device.
[0146] Specifically, the computer device includes a memory and a processor, and the memory stores a computer program that can be loaded by the processor and execute the above-mentioned model wall thickness calculation method.
[0147] The embodiment of the present application also discloses a computer-readable medium.
[0148] Specifically, the computer-readable storage medium stores a computer program that can be loaded by a processor and execute the above-mentioned three-dimensional model wall thickness measurement method. The computer-readable storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM) and other media that can store program codes.
[0149] The present invention and its embodiments are described above. This description is not restrictive. The drawings show only one embodiment of the present invention, and the actual structure is not limited thereto. In short, if a person skilled in the art is inspired by this and, without departing from the purpose of the present invention, designs structures and embodiments similar to this technical solution without inventiveness, they shall fall within the scope of protection of the present invention.
Claims
1. A three-dimensional model wall thickness measurement method combining ray method and spherical method, characterized in that: The steps include: The three-dimensional model is processed using a surface triangulation algorithm to obtain a number of triangular facets corresponding to the three-dimensional model and a triangular mesh with uniform facet size distribution; Use SAH-optimized AABB tree to accelerate collision detection between rays and triangles, and dynamically segment bounding boxes based on a surface area heuristic cost function; The center point of the patch is selected as the measurement point on the processed model surface, and rays are emitted in the opposite direction of its normal vector to obtain the intersection information with the model surface; The measurement method is dynamically selected based on the angle θ between the normal vector of the triangle where the intersection point is located and the ray direction: when |θ| is less than 5°, the ray method is used to calculate the wall thickness, otherwise it switches to the spherical method; By switching between mixed measurements, the wall thickness value corresponding to the measuring point is calculated; Receive wall thickness calculation results for each measuring point and generate a color-coded wall thickness distribution map.
2. The three-dimensional model wall thickness measurement method according to claim 1, characterized in that: The surface triangulation algorithm is implemented using the open source OpenCascade library to triangulate the input model into a mesh model.
3. The three-dimensional model wall thickness measurement method according to claim 2, characterized in that: It also includes adaptive subdivision of parameters and partitions based on quadtrees, specifically including: node classification of the model UV parameter domain based on quadtrees: Internal node: IN; External node: OUT; Boundary node: ON; The IN nodes are directly triangulated, and the ON nodes are triangulated using discrete boundary segment constraints to form the final adaptive triangulated mesh output.
4. The three-dimensional model wall thickness measurement method according to claim 1, characterized in that: The SAH optimized AABB tree construction method includes: Calculate the surface area ratio of the left and right subtrees of the bounding box segmentation plane; According to the cost function: Select the optimal splitting plane; Recursively group until the leaf node contains 3-5 triangles.
5. The three-dimensional model wall thickness measurement method according to claim 1, characterized in that: When it is determined that the ray method mode is adopted, the specific algorithm steps of the ray method are as follows: Select a measurement point P on the model surface and obtain the position of the point on the triangular mesh of the model surface and the normal vector direction n; Starting from the root node, perform depth-first traversal of the AABB tree along the ray direction: If the current node AABB does not intersect the ray, the node and all its child nodes are removed; If they intersect and the current node is a non-leaf node, recursively check its child nodes; If they intersect and the current node is a leaf node, perform a ray-triangle intersection test; Perform ray-triangle intersection calculation on the triangles in the leaf node, screen candidate intersection points, and record the intersection point parameters: including the face index, distance, and normal vector; Verify that the intersection point is within the valid range of the ray: If the current leaf node detection is not completed, return to continue testing; If the detection is completed, the nearest intersection point is selected from all candidate intersection points as the final result; Calculate the Euclidean distance between the measured point and the nearest intersection point as the wall thickness value of the current area.
6. The three-dimensional model wall thickness measurement method according to claim 1, characterized in that: When it is determined that the spherical method mode is adopted, the specific algorithm steps of the spherical method are as follows: Select a measurement point P on the model surface, obtain its coordinates and normal vector direction n, emit a ray along the normal vector direction n, perform a ray-triangle intersection test, obtain the nearest intersection point Q and distance d, and use this as the initial sphere radius r = d; The initial detection sphere is generated with the center point between the intersection point Q and the measurement point P as the center of the circle and d as the radius of the sphere. The shrinkage step size Δr is set to 0.05mm and the accuracy threshold ε is set to 0.005mm. Starting from the root node of the AABB tree, sort the child nodes by priority according to the SAH cost and perform a depth-first traversal; If the current node AABB does not intersect the sphere: remove the node and all its child nodes; If they intersect and the current node is a non-leaf node: recursively check its child nodes; If they intersect and the current node is a leaf node: perform sphere-triangle intersection test; Perform the following calculations on the triangles in the leaf nodes: Calculate the distance D from the sphere center to the triangle plane. If D>r, determine that there is no intersection; if D≤r, determine that there is intersection, and update the sphere radius r=min(r, D); After each round of detection, the sphere radius is shrunk to r = r - Δr, and the AABB tree is traversed again. When there is only a tangent relationship between the sphere and the triangle, the iteration is stopped, and the maximum inscribed sphere diameter 2r is used as the wall thickness value of the current measurement point.
7. The three-dimensional model wall thickness measurement method according to claim 1, characterized in that: The visualization result is achieved through color gradient mapping, where: The red area represents the area with larger wall thickness, the blue area represents the area with smaller wall thickness, and the green area is in the middle.
8. A three-dimensional model wall thickness measuring device, characterized in that: include: Adaptive subdivision module, used to perform triangulation and mesh adaptive subdivision; Hybrid measurement control module, integrating ray method unit and spherical method unit, switching measurement mode according to real-time geometric features; SAH acceleration engine, deploying AABB tree construction and collision detection algorithms; Visualization interface to generate wall thickness distribution diagrams with color coding and numerical annotations.
9. A computer device, characterized in that: The method comprises a processor, a memory and a computer program stored in the memory, wherein when the processor executes the computer program, the method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium, characterized in that A computer program is stored, and when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Model wall thickness calculation methods, apparatus, equipment and storage media
CN115661361B
Cited By
Three-dimensional geologic body attribute assignment method and system
CN122049278A
A method and system for assigning properties to a three-dimensional geological body
CN122049278B