A neighborhood gradient guided large curvature surface projection point calculation method
By generating triangular meshes and BVH trees, and combining mirror perturbation and Newton's iteration method, the efficiency and accuracy problems of calculating the projection of the midpoint onto the curved surface in five-axis side milling were solved, achieving efficient and accurate tool contact point calculation and interference checking.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- AVICIT CO LTD
- Filing Date
- 2025-10-30
- Publication Date
- 2026-06-12
AI Technical Summary
In existing five-axis side-cut milling, the projection calculation method of points onto curved surfaces has the problems of long time consumption and large error. Especially when dealing with large curvature regions, the sparse mesh nodes cause Newton iteration to converge incorrectly.
By calculating the spatial bounding box of the surface to be projected and triangulating it, a triangular mesh is generated, a BVH tree is constructed, the nearest vertex is queried, and a mirror perturbation is applied in the UV parameter space. The accurate projection point is then calculated using the Newton-Raphson iteration method.
It significantly improves the positioning efficiency and robustness of point-to-surface projection, reduces the number of Newton iterations, adapts to complex boundary conditions, and improves computational accuracy and efficiency.
Smart Images

Figure CN121327909B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer-aided design technology, and in particular to a method, device, and storage medium for calculating projection points of large curvature surfaces guided by neighborhood gradient. Background Technology
[0002] Five-axis side-cutting milling is a key technology for machining complex curved surfaces. This technology removes material by controlling the continuous contact between the tool's side cutting edge and the curved surface, enabling efficient machining of complex geometric shapes such as impellers, blades, and molds widely used in aerospace, energy equipment, and other fields. In this process, accurately calculating the geometric relationship between the tool and the workpiece surface is crucial for ensuring machining quality. The projection calculation of a point onto the curved surface, as a fundamental algorithm, directly affects the accuracy and efficiency of key steps such as tool contact point calculation and tool axis interference checking.
[0003] In existing CAD / CAM systems, the calculation of point projection onto a surface typically relies on standard algorithms provided by the geometric kernel. The method described in application CN116310048A, entitled "A Method for Calculating the Intersection Points of Ray Tracing and NURBS Surfaces Based on Curvature Subdivision," is based on curvature subdivision. It converts the surface into a Bezier surface, inserts nodes based on the surface curvature to subdivide the Bezier surface, constructs an AABB bounding box for the surface's convex hull, iteratively filters surface sub-regions using intersection with the AABB, and then uses Newton's iteration to find the intersection points of rays with the untrimmed surface from these sub-regions. However, while this method uses the intersection of lines with the AABB bounding box to filter possible projection point regions and avoids the risk of obtaining incorrect solutions through Newton's iteration, the iterative calculation process is time-consuming, and additional time is needed to handle boundary issues for trimmed surfaces commonly used in machining scenarios. The patent application CN113343328A, entitled "An Efficient Nearest Point Projection Method Based on Improved Newton Iteration," uses isoparametric surface partitioning. It divides the surface along parameterized U and V directions according to a specified number of grid nodes and directly calculates the nearest neighbor point from the grid nodes. The iterative calculation is an improvement on Newton's iteration, but it is a bidirectional Newton iteration. However, this method, which directly calculates the nearest neighbor point from the grid nodes, is prone to errors due to grid partitioning defects, such as sparse grid nodes in regions with high curvature, causing the Newton iteration to proceed in the wrong direction. Summary of the Invention
[0004] The purpose of this invention is to overcome the shortcomings of existing technologies and provide a method for calculating projection points of large curvature surfaces guided by neighborhood gradients, comprising the following steps:
[0005] S1: Calculate the spatial bounding box of the surface to be projected, and triangulate the surface to be projected according to the discretization accuracy to generate a triangular mesh;
[0006] S2: Traverse the surface control vertices of the triangular mesh, record the set of adjacent vertices of each surface control vertex, and determine whether it is a boundary point based on the UV parameter coordinates of the surface control vertex.
[0007] S3: Store the vertex information and construct a BVH tree. For the point to be projected, traverse the BVH tree, query and obtain the nearest vertex with the smallest distance to the point to be projected, determine whether the nearest vertex is a boundary point, and process it according to the determination result to obtain the initial value of the iteration.
[0008] S4: Using the initial value of the iteration, construct the objective function and use Newton's iteration method to calculate the precise projection point of the point to be projected on the curved surface.
[0009] Preferably, in step S3, storing vertex information and constructing a BVH tree further includes:
[0010] S311: Create a standardized vertex data object from data including vertex index, whether it is a boundary point, and the coordinates of the surface control vertex, and calculate the tiny interval bounding box for each vertex;
[0011] S312: Traverse the bounding boxes of the small intervals to obtain the bounding box of the current node. If the number of vertices is less than or equal to the leaf capacity, create a leaf node. If the number of vertices exceeds the leaf capacity, select a splitting axis, evaluate the splitting position according to the splitting axis, select the splitting scheme with the minimum SAH cost according to the evaluation result, and divide the vertices into two subsets according to the optimal splitting scheme to construct the BVH tree.
[0012] Preferably, in step S3, for the point to be projected, traversing the BVH tree, querying and obtaining the nearest neighbor vertex with the smallest distance to the point to be projected, further includes:
[0013] S321: Traverse the BVH tree using a depth-first strategy;
[0014] S322: Calculate and record the distance between the point to be projected and the coordinates of the vertices in each leaf node;
[0015] S323: Compare all distances and find the nearest vertex corresponding to the minimum distance.
[0016] Preferably, in step S3, determining whether the nearest vertex is a boundary point and processing the result to obtain the initial value for iteration further includes:
[0017] S331: If the nearest vertex If a vertex is not a boundary point, then traverse its set of adjacent vertices. Calculate the distance gradient from each adjacent vertex to the point to be projected, and find the adjacent vertex with the smallest gradient magnitude based on the gradient magnitude. According to the adjacent vertices and the nearest vertex Interpolation is performed on the surface in the isoparametric space to find the interpolation point closest to the point to be projected, along with the parameter value, which serves as the initial value for the iteration.
[0018] S332: If the nearest vertex is a boundary point, then apply a mirror perturbation to its UV parameter space to generate new initial parameter values, which are used as the initial values for the iteration.
[0019] Preferably, in step S331, the distance gradient from each adjacent vertex to the point to be projected is calculated, and the adjacent vertex with the smallest gradient magnitude is selected. Further including:
[0020] Calculate the distance function value from each neighboring vertex of the nearest vertex to the point to be projected;
[0021] Calculate the gradient vector of the distance function value with respect to the surface parameters u and v;
[0022] Compare the magnitudes of the gradient vectors corresponding to all adjacent vertices, and select the parameter corresponding to the adjacent vertex with the smallest magnitude as the input for subsequent interpolation;
[0023] The magnitude of the gradient vector The calculation formula is as follows:
[0024]
[0025] in, The distance function value. The minimum distance from the nearest vertex to the point to be projected. The parameter target is The i-th adjacent vertex The parameter target is .
[0026] Preferably, in step S332, the step of applying a mirror perturbation to its UV parameter space to generate new initial parameter values further includes:
[0027] For the vertex whose nearest neighbor is located on the u-direction boundary, its perturbed parameters are: ;
[0028] For the vertex whose nearest neighbor is located on the boundary in the v direction, its perturbed parameters are: ;
[0029] For the nearest neighbor vertex located at a corner point, its perturbed parameters are:
[0030] in, This refers to the small perturbation increment set according to the surface discretization accuracy.
[0031] Preferably, in step S4, constructing the objective function and calculating it using Newton's iteration method further includes:
[0032] Set the objective function, and project the points to be projected. Minimize the squared distance to the surface to be projected, objective function As shown below:
[0033]
[0034] Where S(u,v) are points on the surface;
[0035] Calculate the first derivative of the objective function:
[0036]
[0037]
[0038] Calculate the second derivative of the objective function:
[0039]
[0040]
[0041]
[0042] Newton iterations are performed using the first and second derivatives until convergence to the precise projection point.
[0043] Preferably, in step S1, the spatial bounding box of the surface to be projected is calculated, and the surface to be projected is triangulated according to the discretization accuracy to generate a triangular mesh, further including:
[0044] S11: Obtain the UV boundary of the surface to be projected, map the UV boundary and the surface control vertex to three-dimensional space through the surface mathematical equation to obtain three-dimensional points, obtain the coordinate extreme points based on the three-dimensional points, construct a spatial bounding box based on the coordinate extreme points, determine the maximum size of the spatial bounding box, and determine the discrete accuracy based on the maximum size.
[0045] S12: Based on the discretization precision, uniformly divide the UV space to obtain a UV parameter grid. Calculate the three-dimensional spatial coordinates of each parameter grid point in the UV parameter grid using the surface parametric equation to obtain a three-dimensional point cloud.
[0046] S13: Generate the triangular mesh based on the three-dimensional point cloud.
[0047] Based on the same concept, the present invention also provides a computer device, including a memory and one or more processors, wherein the memory stores computer code, and when the computer code is executed by the one or more processors, the one or more processors cause the one or more processors to perform a neighborhood gradient-guided method for calculating projection points of a large curvature surface as described in any one of the embodiments.
[0048] Based on the same concept, the present invention also provides a computer-readable storage medium storing computer code, which, when executed, executes a neighborhood gradient-guided method for calculating projection points of a large curvature surface as described in any one of the embodiments.
[0049] Compared with the prior art, the beneficial effects of the present invention are:
[0050] (1) The present invention calculates the spatial bounding box of the surface to be projected, and performs triangulation on the surface to be projected according to the discrete precision to generate a triangular mesh. The vertex information is stored and a BVH tree is constructed. For the point to be projected, the BVH tree is traversed to query and obtain the nearest vertex with the smallest distance to the point to be projected, thereby realizing efficient spatial partitioning of the surface to be projected. When searching for the nearest vertex, a large number of irrelevant regions can be quickly eliminated, which significantly improves the positioning efficiency of the initial point. It is especially suitable for processing large-scale mesh data.
[0051] (2) This invention calculates the distance gradient from each neighboring vertex to the point to be projected by traversing the set of neighboring vertices of the nearest vertex, and selects the target parameter direction based on the gradient magnitude, thereby realizing the search along the optimal descent direction in the parameter space. This effectively avoids the problem of Newton iteration converging to a local minimum or incorrect solution due to improper initial value, and improves the robustness of the algorithm.
[0052] (3) By applying a mirror perturbation to the UV parameter space when the nearest vertex is a boundary point to generate new initial parameter values, this invention can not only effectively handle the special cases of trimmed surfaces and parameter domain boundaries, but also provide a physically reasonable search starting point for Newton iteration, thereby enhancing the adaptability of the algorithm under complex boundary conditions.
[0053] (4) This invention constructs an objective function with the initial value of the iteration and calculates it using the Newton iteration method to obtain the accurate projection point of the projection point on the curved surface. This greatly reduces the number of convergences required by the Newton iteration and improves the overall computational efficiency. It combines the robustness of discrete grid search and the high precision of continuous space optimization, providing a reliable and accurate geometric calculation basis for tool contact point calculation and interference inspection in five-axis side milling. Attached Figure Description
[0054] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the invention.
[0055] Figure 1 This is a flowchart of a method for calculating projection points of a large curvature surface guided by neighborhood gradient according to the present invention;
[0056] Figure 2 This is another flowchart of the method for calculating projection points of a large curvature surface guided by neighborhood gradient according to the present invention;
[0057] Figure 3 The triangulation results and vertex diagram of the blade surface are shown.
[0058] Figure 4 This is a schematic diagram of the nearest neighbor gradient search.
[0059] Figure 5 This is an incorrect projection result of the Newton iteration converging to a local minimum in this invention;
[0060] Figure 6 This is the projection result of a point outside the curved surface onto the region of high curvature on the engine blade surface. Detailed Implementation
[0061] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention. Obviously, the described embodiments are only some, not all, of the embodiments described in this application. All other embodiments obtained by those skilled in the art based on the embodiments in this application without creative effort are within the scope of protection of this application.
[0062] Those skilled in the art will understand that, unless otherwise stated, the singular forms “a” and “an” used herein, and “the”, may also include the plural forms. It should be further understood that the term “comprising” as used in this specification means the presence of the stated features, integers, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.
[0063] First Embodiment
[0064] Please see Figure 1 and Figure 2 As shown, this embodiment provides a method for calculating projection points of a large curvature surface guided by neighborhood gradient, including the following steps:
[0065] S1: Calculate the spatial bounding box of the surface to be projected, and triangulate the surface according to the discrete precision to generate a triangular mesh. Specifically, in this embodiment, the Delaunay triangulation algorithm is used. The discrete precision is used to triangulate the projected surface.
[0066] Preferably, in step S1, the spatial bounding box of the surface to be projected is calculated, and the surface to be projected is triangulated according to the discrete precision to generate a triangular mesh, further including:
[0067] S11: Obtain the UV boundary of the surface to be projected S(u, v). Map the UV boundary and the control vertices of the surface to three-dimensional space through the surface mathematical equation to obtain three-dimensional points. Obtain the coordinate extreme points based on the three-dimensional points. Construct a spatial bounding box based on the coordinate extreme points. Determine the maximum size of the spatial bounding box and the discretization accuracy based on the maximum size. Specifically, in this embodiment, the surface is usually defined by a two-dimensional parameter domain (called the UV space, for example, the range of U and V is [0, 1]). The UV boundary is the minimum and maximum value in the U and V directions. , the four corner points of the parameter domain And the control vertices of the surface (if the surface is defined by control points, such as NURBS) are mapped into three-dimensional space through the mathematical equations of the surface to obtain a set of three-dimensional points. By traversing all three-dimensional points, the minimum values of each point on the X, Y, and Z coordinate axes are found. and maximum value Using these six extreme points, an axis-aligned cube is constructed in three-dimensional space. This cube is the spatial bounding box, which completely encloses the entire curved surface. The maximum size D of the spatial bounding box is... Discrete precision ensures that the side length of the triangle in three-dimensional space is approximately... , The smaller the value, the denser the mesh and the higher the accuracy. Please refer to the triangulation results and vertices. Figure 3 As shown;
[0068] S12: A UV parameter mesh is obtained by uniformly dividing the UV space according to the discrete precision. For each parameter mesh point in the UV parameter mesh, the corresponding three-dimensional spatial coordinates are calculated using the surface parametric equation to obtain a three-dimensional point cloud. Specifically, in this embodiment, in the UV parameter domain... x Inside, according to step length (or according to) The calculated UV step size is then uniformly divided. For example, the U direction starts from... arrive Every ΔU, a point is taken, and the same applies to the V direction. This forms a two-dimensional point matrix, with each point in the UV parameter grid representing a point ( , We then use the surface's parametric equation S(u, v) to calculate its corresponding three-dimensional spatial coordinates (x, y, z). Thus, we obtain a regular three-dimensional point cloud corresponding to the shape of the three-dimensional surface.
[0069] S13: Generate a triangular mesh based on the 3D point cloud. Specifically, in this embodiment, the generated UV point matrix is regarded as a set of points on a two-dimensional plane. The Delaunay triangulation algorithm is used to connect these points to avoid the formation of particularly thin triangles with very small angles, ensuring that the generated triangular mesh has high quality and is beneficial to the stability and accuracy of subsequent calculations. The vertices of each triangle formed on the UV plane are directly mapped to the 3D spatial coordinates points calculated in the second stage. The collection of all these 3D spatial triangular facets constitutes the triangular mesh of the original surface. The coordinates (x, y, z) of all 3D vertices and their original UV parameters (u, v) are recorded. The three vertices (by vertex index) that constitute each triangle are recorded. During or after processing, the triangles connected to each vertex are recorded.
[0070] S2: Traverse the surface control vertices of the triangular mesh, record the set of adjacent vertices of each surface control vertex, and determine whether it is a boundary point based on the UV parameter coordinates of the surface control vertex.
[0071] Create a vertex adjacency list: Initialize an empty dictionary or list (array) with a size equal to the total number of vertices in the grid; each vertex corresponds to an entry, which stores a Set or List. This set will eventually contain the indices of all directly connected neighboring vertices.
[0072] Create a boundary point marker list: Initialize a list (array) of the same length as the total number of vertices, with all values initialized to False or 0. This list is used to mark whether each vertex is a boundary point.
[0073] Traverse the surface control vertices of the triangular mesh: Iterate through each triangle in the triangular mesh. Each triangle is defined by three vertex indices (assuming they are (...)). , , For a triangle, its three sides are sides. To connect vertices and ,side To connect vertices and ,side To connect vertices and For each edge, add it bidirectionally: add the vertices... Add the index to the vertex In the set of adjacent vertices, the vertices Add the index to the vertex In the set of adjacent vertices, opposite edges and edge Repeat this operation.
[0074] S3: Store the vertex information and construct a BVH tree. For the point to be projected, traverse the BVH tree, query and obtain the nearest vertex with the smallest distance to the point to be projected, determine whether the nearest vertex is a boundary point, and process it according to the determination result to obtain the initial value of the iteration.
[0075] Preferably, in step S3, storing vertex information and constructing a BVH tree further includes:
[0076] S311: Create a standardized vertex data object from the data including vertex index, whether it is a boundary point, surface control vertex coordinates, UV parameters, and adjacent vertex set. Calculate a tiny bounding box for each vertex. Specifically, in this embodiment, create a tiny axis-aligned bounding box (AABB) for each vertex.
[0077] S312: Traverse the bounding boxes of the small intervals to obtain the bounding box of the current node. If the number of vertices is less than or equal to the leaf capacity, create a leaf node (the leaf node includes the current node's bounding box, type marker, and list of point objects). If the number of vertices exceeds the leaf capacity, create an internal node. Select a splitting axis (calculate the overall bounding box and split it on the longest axis (X, Y, or Z). Evaluate the splitting position according to the splitting axis. Select the splitting scheme with the minimum SAH cost according to the evaluation result. Divide the vertices into two subsets according to the optimal splitting scheme to construct a BVH tree. Specifically, in this embodiment, find the minimum value of all minimum points and the maximum value of all maximum points to obtain the current node's bounding box. Evaluating the splitting position according to the splitting axis includes dividing the vertex set into left and right groups, calculating the bounding boxes of the left and right groups, and calculating the SAH cost: Cost = Surface area of the left bounding box × Number of left vertices + Surface area of the right bounding box × Number of right vertices.
[0078] Please participate Figure 4 As shown, in step S3, for the point to be projected, the BVH tree is traversed to query and obtain the nearest neighbor vertex with the smallest distance to the point to be projected, which further includes:
[0079] S321: Traverse the BVH tree using a depth-first strategy;
[0080] S322: Calculate and record the distance between the point to be projected and the coordinates of the vertices in each leaf node. If the current node is a leaf node (containing actual vertex data), traverse each vertex stored in the leaf node. For each vertex, calculate its exact Euclidean distance to the projection point P. If the current node is an internal node (containing child nodes), calculate the minimum distance from the projection point P to the bounding boxes of its left and right child nodes.
[0081] S323: Compare all distances and obtain the nearest vertex corresponding to the minimum distance. Specifically, in this embodiment, if the current node is a leaf node, if the distance of a vertex is less than the minimum distance parameter, then update the minimum distance parameter to that distance and update the nearest vertex parameter to that vertex. If the minimum distance from the projection point P to the current node's bounding box is greater than or equal to the minimum distance parameter, it means that there cannot be a vertex closer to the currently known nearest point among any of the node's child nodes. Therefore, skip the node and all its child nodes and directly process the next node in the stack. If the current node is an internal node, based on the two distances from the projection point P to its left child node's bounding box and from the projection point P to its right child node's bounding box, push them onto the stack in ascending order of distance. This means that child nodes with closer distances will be pushed onto the stack later and thus popped out first. Figure 4 As shown, find the distance to the projection point in the triangulated mesh. Recent Vertex That is, the nearest vertex .
[0082] Preferably, in step S3, determining whether the nearest vertex is a boundary point and processing the result to obtain the initial value for iteration further includes:
[0083] S331: If the nearest vertex If a vertex is not a boundary point, then traverse its set of adjacent vertices. Calculate the gradient of the distance from each adjacent vertex to the point to be projected, and find the adjacent vertex with the smallest gradient magnitude based on the gradient magnitude. According to adjacent vertices and nearest neighbor vertex Interpolation is performed on the surface in isoparametric space to find the interpolation point closest to the point to be projected, along with its parameter value, as the initial values for iteration. Specifically, in this embodiment, the nearest vertex... Parameter coordinates nearest neighbor vertex The adjacent vertices are as follows Figure 4 In As shown, the adjacent vertex with the smallest gradient magnitude is , The direction with the minimum gradient magnitude is the nearest vertex. and adjacent vertices Insert 5 points with equal parameters on the surface, and find the point that is closest to the point to be projected. and its parameters and This point is an approximate estimate of the projection result;
[0084] S332: If the nearest vertex is a boundary point, then apply a mirror perturbation to its UV parameter space to generate new initial parameter values as initial values for iteration.
[0085] Preferably, in step S331, the distance gradient from each adjacent vertex to the point to be projected is calculated, and the adjacent vertex with the smallest gradient magnitude is selected. Further including:
[0086] Calculate the distance function value from each neighboring vertex of the nearest vertex to the point to be projected;
[0087] Calculate the gradient vector of the distance function value with respect to the surface parameters u and v;
[0088] Compare the magnitudes of the gradient vectors corresponding to all adjacent vertices, and select the parameter corresponding to the adjacent vertex with the smallest magnitude as the input for subsequent interpolation;
[0089] The magnitude of the gradient vector The calculation formula is as follows:
[0090]
[0091] in, The distance function value. The minimum distance from the nearest vertex to the point to be projected. The parameter target is The i-th adjacent vertex The parameter target is .
[0092] Preferably, in step S332, applying a mirror perturbation to its UV parameter space to generate new initial parameter values further includes:
[0093] For a vertex whose nearest neighbor is located on the boundary in the u direction, its perturbed parameters are: ;
[0094] For a vertex whose nearest neighbor is located on the boundary in the v direction, its perturbed parameters are: ;
[0095] For the nearest vertex located at a corner, its perturbed parameters are:
[0096] in, This refers to the small perturbation increment set according to the surface discretization accuracy.
[0097] S4: Using the initial value of the iteration, construct the objective function and use Newton's iteration method to calculate the precise projection point of the point to be projected on the surface.
[0098] Preferably, in step S4, constructing the objective function and calculating it using Newton's iteration method further includes:
[0099] Set the objective function, and project the points to be projected. Minimize the squared distance to the surface to be projected, objective function As shown below:
[0100]
[0101] Where S(u,v) are points on the surface;
[0102] Calculate the first derivative of the objective function:
[0103]
[0104]
[0105] Calculate the second derivative of the objective function:
[0106]
[0107]
[0108]
[0109] Newton's iterations are performed using the first and second derivatives until convergence to the exact projection point. Specifically, in this embodiment, please refer to... Figure 6 As shown, the projection result of a point outside the curved surface onto a region of high curvature on the engine blade surface is shown in the figure. Please refer to [link to relevant documentation]. Figure 5 As shown, this is an incorrect projection result where Newton's iteration converges to a local minimum.
[0110] Second Embodiment
[0111] In this embodiment, a computer device is provided, including a memory and one or more processors. The memory stores computer code. When the computer code is executed by one or more processors, the one or more processors cause the one or more processors to perform the steps of the neighborhood gradient-guided method for calculating projection points of large curvature surfaces in the first embodiment.
[0112] In some embodiments of this application, a computer-readable storage medium is also provided, wherein when the computer-readable instructions are executed by one or more processors, the one or more processors perform the steps of a neighborhood gradient-guided method for calculating projection points of a large curvature surface as described in any of the first embodiments.
[0113] It is understood that, for the aforementioned neighborhood gradient-guided method for calculating projection points of large curvature surfaces, if all of them are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer server or a network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this invention. The aforementioned storage medium includes: USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, optical disks, and other media capable of storing program code.
[0114] Computer-readable storage media may include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable storage medium may also be any readable medium other than a readable storage medium that can transmit, propagate, or transfer a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the readable storage medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.
[0115] The above description is merely a preferred embodiment of the present invention. The scope of protection of the present invention is not limited to the above embodiments. All technical solutions falling within the scope of the present invention's concept are within the scope of protection of the present invention. It should be noted that for those skilled in the art, any improvements and modifications made without departing from the principles of the present invention should also be considered within the scope of protection of the present invention.
Claims
1. A method for calculating projection points of a large curvature surface guided by neighborhood gradient, characterized in that, Its application to the curved surface of engine blades includes the following steps: S1: Calculate the spatial bounding box of the surface to be projected, and triangulate the surface to be projected according to the discretization accuracy to generate a triangular mesh; S2: Traverse the surface control vertices of the triangular mesh, record the set of adjacent vertices of each surface control vertex, and determine whether it is a boundary point based on the UV parameter coordinates of the surface control vertex. S3: Store the vertex information and construct a BVH tree. For the point to be projected, traverse the BVH tree, query and obtain the nearest vertex with the smallest distance to the point to be projected, determine whether the nearest vertex is a boundary point, and process it according to the determination result to obtain the initial value of the iteration. S4: Using the initial value of the iteration, construct the objective function and use Newton's iteration method to calculate the precise projection point of the point to be projected on the curved surface; In step S3, it is determined whether the nearest neighbor vertex is a boundary point, and the initial value of the iteration is obtained by processing according to the determination result, which further includes: S331: If the nearest vertex If a vertex is not a boundary point, then traverse its set of adjacent vertices. , Calculate the distance gradient from each adjacent vertex to the point to be projected, and find the adjacent vertex with the smallest gradient magnitude based on the gradient magnitude. According to the adjacent vertices and the nearest vertex Interpolation is performed on the surface in the isoparametric space to find the interpolation point closest to the point to be projected, along with the parameter value, which serves as the initial value for the iteration. S332: If the nearest vertex is a boundary point, then apply a mirror perturbation to its UV parameter space to generate new initial parameter values, which are used as the initial values for the iteration. In step S1, the spatial bounding box of the surface to be projected is calculated, and the surface to be projected is triangulated according to the discretization accuracy to generate a triangular mesh, further including: S11: Obtain the UV boundary of the surface to be projected, map the UV boundary and the surface control vertex to three-dimensional space through the surface mathematical equation to obtain three-dimensional points, obtain the coordinate extreme points based on the three-dimensional points, construct a spatial bounding box based on the coordinate extreme points, determine the maximum size of the spatial bounding box, and determine the discrete accuracy based on the maximum size. S12: Based on the discretization precision, uniformly divide the UV space to obtain a UV parameter grid. Calculate the three-dimensional spatial coordinates of each parameter grid point in the UV parameter grid using the surface parametric equation to obtain a three-dimensional point cloud. S13: Generate the triangular mesh based on the three-dimensional point cloud.
2. The method for calculating projection points of large curvature surfaces guided by neighborhood gradient according to claim 1, characterized in that, In step S3, storing vertex information and constructing a BVH tree further includes: S311: Create a standardized vertex data object from data including vertex index, whether it is a boundary point, and the coordinates of the surface control vertex, and calculate the tiny interval bounding box for each vertex; S312: Traverse the bounding boxes of the small intervals to obtain the bounding box of the current node. If the number of vertices is less than or equal to the leaf capacity, create a leaf node. If the number of vertices exceeds the leaf capacity, select a splitting axis, evaluate the splitting position according to the splitting axis, select the splitting scheme with the minimum SAH cost according to the evaluation result, and divide the vertices into two subsets according to the optimal splitting scheme to construct the BVH tree.
3. The method for calculating projection points of large curvature surfaces guided by neighborhood gradient according to claim 1, characterized in that, In step S3, for the point to be projected, the BVH tree is traversed to query and obtain the nearest neighbor vertex with the smallest distance to the point to be projected, further including: S321: Traverse the BVH tree using a depth-first strategy; S322: Calculate and record the distance between the point to be projected and the coordinates of the vertices in each leaf node; S323: Compare all distances and find the nearest vertex corresponding to the minimum distance.
4. The method for calculating projection points of large curvature surfaces guided by neighborhood gradient according to claim 1, characterized in that, In step S331, the distance gradient from each adjacent vertex to the point to be projected is calculated, and the adjacent vertex with the smallest gradient magnitude is selected. Further including: Calculate the distance function value from each neighboring vertex of the nearest vertex to the point to be projected; Calculate the gradient vector of the distance function value with respect to the surface parameters u and v; Compare the magnitudes of the gradient vectors corresponding to all adjacent vertices, and select the parameter corresponding to the adjacent vertex with the smallest magnitude as the input for subsequent interpolation; The magnitude of the gradient vector The calculation formula is as follows: in, The distance function value. The minimum distance from the nearest vertex to the point to be projected. The parameter target is The i-th adjacent vertex The parameter target is .
5. The method for calculating projection points of large curvature surfaces guided by neighborhood gradient according to claim 1, characterized in that, In step S332, applying a mirror perturbation to its UV parameter space to generate new initial parameter values further includes: For the vertex whose nearest neighbor is located on the u-direction boundary, its perturbed parameters are: ; For the vertex whose nearest neighbor is located on the boundary in the v direction, its perturbed parameters are: ; For the nearest neighbor vertex located at a corner point, its perturbed parameters are: in, This refers to the small perturbation increment set according to the discretization accuracy of the surface. Let be the maximum boundary value of the parameter domain of the surface to be projected in the u direction. is the maximum boundary value of the parameter domain of the surface to be projected in the v direction.
6. The method for calculating projection points of large curvature surfaces guided by neighborhood gradient according to claim 1, characterized in that, In step S4, the objective function is constructed and calculated using Newton's iteration method, further including: Set the objective function, and project the points to be projected. Minimize the squared distance to the surface to be projected, objective function As shown below: Where S(u,v) are points on the surface; Calculate the first derivative of the objective function: Calculate the second derivative of the objective function: Newton iterations are performed using the first and second derivatives until convergence to the precise projection point.
7. A computer device comprising a memory and one or more processors, the memory storing computer code that, when executed by the one or more processors, causes the one or more processors to perform the steps of the neighborhood gradient-guided method for calculating projection points of large curvature surfaces as described in any one of claims 1-6.
8. A computer-readable storage medium storing computer code, wherein when the computer code is executed, the steps of the neighborhood gradient-guided method for calculating projection points of large curvature surfaces as described in any one of claims 1-6 are performed.