CN115730438A - Parallel processing method for inverse solution of GPU (graphics processing Unit) of NURBS (non-Uniform rational B-spline) surface mapping of product - Google Patents

Parallel processing method for inverse solution of GPU (graphics processing Unit) of NURBS (non-Uniform rational B-spline) surface mapping of product Download PDF

Info

Publication number
CN115730438A
CN115730438A CN202211447389.5A CN202211447389A CN115730438A CN 115730438 A CN115730438 A CN 115730438A CN 202211447389 A CN202211447389 A CN 202211447389A CN 115730438 A CN115730438 A CN 115730438A
Authority
CN
China
Prior art keywords
point
dimensional
tree
nurbs
curved surface
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211447389.5A
Other languages
Chinese (zh)
Inventor
邹强
包子恒
刘务
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang University ZJU
Original Assignee
Zhejiang University ZJU
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang University ZJU filed Critical Zhejiang University ZJU
Priority to CN202211447389.5A priority Critical patent/CN115730438A/en
Publication of CN115730438A publication Critical patent/CN115730438A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Image Generation (AREA)

Abstract

The invention discloses a GPU parallel processing method for inverse solution of NURBS surface mapping of a product. Inputting a NURBS curved surface, a uv plane and a three-dimensional point group given by a product; utilizing a GPU to calculate the intermediate matrix of each segment of the NURBS curved surface in parallel and storing the intermediate matrix in the GPU; utilizing a GPU to construct a subdivision tree of the NURBS curved surface in parallel, and storing the subdivision tree in the GPU; and processing each three-dimensional point in the three-dimensional point group to be mapped and the subdivision tree in parallel by using the GPU to obtain the corresponding two-dimensional characteristic point of each three-dimensional point on the uv plane. The invention utilizes two methods of a surface subdivision method and a Newton iteration numerical method to solve the problem of the NURBS surface mapping characteristic points of the product, optimizes the representation mode of the NURBS surface, and improves the convergence rate of the surface algorithm of the product under the condition of ensuring to obtain the global optimal solution.

Description

Parallel processing method for inverse solution of GPU (graphics processing Unit) of NURBS (non-Uniform rational B-spline) surface mapping of product
Technical Field
The invention relates to processing of a product NURBS curved surface in the field of CAD, in particular to a method for reversely solving GPU parallel processing of mapping characteristic points of the product NURBS curved surface.
Background
In the field of computer aided geometric design, NURBS surfaces are the most common way to represent three-dimensional objects in modern CAD systems due to their powerful representation and high flexibility.
One common problem in the research of NURBS surfaces is the inverse solution of NURBS surfaces, i.e., the calculation of two-dimensional (u, v) parameters corresponding to three-dimensional points (x, y, z) on NURBS surfaces. The problem plays an important role in solving the problems of NURBS surface fitting, collision detection, physical simulation, interference avoidance in a CAD/CAM system and the like of point cloud. When a large complex three-dimensional model is processed, a large amount of time is consumed for inverse solution operation, and parallelization processing of an algorithm is a common method for improving the calculation speed.
And the common representation method of the NURBS curved surface is Cox-debor basis function recursive representation, and multiple recursions are needed when points and partial derivatives on the curved surface are calculated, so that the brought function recursive calling operation occupies a large number of registers and caches. Because the register and the cache capacity of each block in the GPU are limited, deep recursion cannot be supported; and the operations of applying and releasing the cache in the block cannot be parallel, and can only be processed by serial queuing of the cache manager, so the basic function recursive representation is not suitable for parallel processing by using a GPU essentially.
The existing parallel method for solving the problem of inverse solution is only to simply deploy codes to a GPU (graphics processing unit) end, the characteristics of GPU programming are not considered, the data storage and use lack of commonality, the parallelism of the codes is not ensured, and only a part of limited parallel performance is exerted.
Disclosure of Invention
Aiming at the defects of the background technology, the invention provides a NURBS curved surface inverse solution parallel algorithm combining a curved surface subdivision method and a Gauss-Newton iteration method, the matrix representation of the NURBS curved surface is used for calculating three-dimensional points and partial derivatives on the curved surface, an intermediate matrix required by the matrix representation is calculated in advance and stored as a constant memory, the data universality is improved, and the defects of large occupation of a register and frequent application and release of a cache in a recursion method are avoided.
According to NURBS surface times, control points and node vectors input by a user, calculating a corresponding intermediate matrix of each node interval, then parallelly constructing a surface subdivision tree in a GPU, parallelly traversing each point in an array from the root node of the subdivision tree in a hierarchical manner, and finding a target two-dimensional point by alternately using bounding box detection and Newton iteration in the hierarchical traversal process.
In order to achieve the purpose, the technical scheme adopted by the invention specifically comprises the following steps:
1) Inputting a NURBS curved surface G given by a product, a uv plane required to be mapped and a three-dimensional point group P required to be mapped; the NURBS curved surface G is described by a bivariate piecewise rational function S (u, v), u and v respectively represent two orthogonal directions on a uv plane, the NURBS curved surface G is divided into a plurality of sections by segmentation points, and the adjacent two sections are divided by the segmentation points;
2) Utilizing a GPU to calculate a middle matrix of each segment of the NURBS curved surface G in parallel, and storing the middle matrix in a constant memory area of the GPU;
3) Utilizing the GPU to parallelly construct a subdivision tree T of the NURBS curved surface G, and storing the subdivision tree T in a constant memory area of the GPU;
4) Utilizing GPU to parallelly make every three-dimensional point P in three-dimensional point group P required to be mapped i And processing the subdivision tree T to obtain each three-dimensional point P i And (4) corresponding two-dimensional feature points on the uv plane.
The step 2) is specifically as follows:
solving is carried out on the NURBS curved surface according to the following matrix form of partial derivatives to obtain a coefficient matrix N of the NURBS curved surface in the u direction and the v direction respectively u And N v
S p,q (u,v)=UN u H(N v ) T V T
Figure BDA0003949989440000021
Figure BDA0003949989440000022
Figure BDA0003949989440000023
Figure BDA0003949989440000024
Wherein S is p,q (u, v) represents three-dimensional points on the NURBS curved surface corresponding to the two-dimensional parameter points (u, v),
Figure BDA0003949989440000025
and
Figure BDA0003949989440000026
expressing first-order partial derivatives of the NURBS curved surface corresponding to the two-dimensional parameter points (U, V) in the U and V directions, p and q respectively express the orders of the NURBS curved surface G in the U and V directions, N and m respectively express the number U and V of control points of the NURBS curved surface G in the U and V directions, respectively, are segmentation point vectors of the NURBS curved surface in the U and V directions, and N u And N v Coefficient matrixes of the NURBS curved surface in the u direction and the v direction respectively, H is a matrix formed by all control points on the NURBS curved surface, u p+1 、v q+1 Respectively representing p +1 th and q +1 th segmentation point values in segmentation point vectors U and V;
then the intermediate matrix N is calculated u H(N v ) T And saved in a constant memory area of the GPU.
In the step 2), the coefficient matrix N u And N v The value of each element in (a) is obtained by iterative calculation according to the following recursion function N:
Figure BDA0003949989440000031
Figure BDA0003949989440000032
in the formula, r and c are respectively a row index and a column index of a coefficient matrix, p and q respectively represent the orders of the NURBS curved surface G in the U and V directions, and i and j represent the segment point interval indexes of the current guessed parameter points on U and V in the Newton iteration process; n is a radical of hydrogen u (r, c) and N v (r,c)Representing a coefficient matrix N u And N v The recursion function values of the elements of row r and column c, a, b, k, l represent recursion parameters, the initial values are p, q, i, j,
Figure BDA0003949989440000041
representing the difference between the i +1 th segmentation point and the i-th segmentation point on the segmentation point vector U, i.e. U i+1 -u i
Figure BDA0003949989440000042
Representing the difference U between the k + p-a segment point and the k segment point on the segment point vector U k+p-a -u k And the rest
Figure BDA0003949989440000043
And so on.
The guessed parameter points refer to intermediate two-dimensional parameter points generated in the Newton iteration process.
For the intermediate matrix in the NURBS surface matrix representation, the intermediate matrix is frequently accessed in the subsequent calculation of Newton iteration and surface subdivision, the data reading frequency is high, and the intermediate matrix is not required to be modified in the operation process.
In the step 3, the step of constructing the subdivision tree T of the NURBS curved surface G in parallel by using the GPU is as follows:
3.1 Create a blank current level node List and next level node List NextList for storing tree nodes of the current level and the next level, respectively;
3.2 Each tree node in the subdivided tree T is a 1 × 1 rectangular region located on a uv plane, and the 1 × 1 rectangular region located at the origin of the uv plane is stored as a root node R in a current-layer node List;
3.3 ) processing each tree node in the current-level node List in parallel, performing subdivision operation on each tree node, and storing a new tree node generated by subdivision into a next-level node List NextList as a next-level tree node;
3.4 If the next-layer node List NextList is not empty, exchanging the current-layer node List and the next-layer node List NextList, emptying the next-layer node List NextList after exchanging, and returning to the step 3.3) to continue the iteration processing;
and if the next-layer node list NextList is empty, finishing the iteration processing, thereby obtaining tree nodes of each layer of the subdivision tree T and storing the tree nodes in a constant memory area of the GPU.
The subdivision operation specifically includes calculating the variation of a 1 × 1 rectangular region of the tree node in the u and v directions according to the following formula:
Figure BDA0003949989440000051
Figure BDA0003949989440000052
wherein, Δ S u And Δ S v Representing the amount of variation of the NURBS surface in the u and v directions, u, respectively 0 、v 0 Respectively representing the coordinate values of the lower left corner of the rectangular region in the u and v directions, u 1 、v 1 Coordinate values in the u and v directions of the upper right corner of the rectangular region are respectively represented,
Figure BDA0003949989440000053
and
Figure BDA0003949989440000054
representing first-order partial derivatives of two-dimensional parameter points on the NURBS curved surface in the u direction and the v direction, wherein the first-order partial derivatives are calculated by using the NURBS curved surface matrix representation, e represents the sampling times on the NURBS curved surface, and i represents the ith sampling;
then comparing and judging the variation of the 1 x 1 rectangular region of the tree node in the u and v directions with a preset tolerance delta:
if the variation of the 1 x 1 rectangular region of the tree node in the u/v direction exceeds the tolerance delta, uniformly dividing the 1 x 1 rectangular region of the tree node into two halves in the direction, and taking one divided rectangular region as a new tree node;
and if the 1 x 1 rectangular region of the tree node does not exceed the tolerance delta in the u/v direction, uniformly dividing the 1 x 1 rectangular region of the tree node into two in the direction, and not generating a new tree node.
Therefore, the variation of the NURBS surface segment corresponding to the node in the tree in a certain direction is smaller than the tolerance delta, and the segmentation in the direction is not required to be continued. The tessellation tree decides in the construction process which direction of the uv plane to tessellate.
In the construction process of the tessellation tree, the dynamic list for storing the tree node of the current layer is stored in the shared memory (shared memory) of each SM, so that the direct reading of the global memory (global memory) is avoided, the reading and writing time of the memory is reduced, and the access bandwidth of the memory is improved.
When the list length is insufficient, the list length is expanded again, so that the situation that a large amount of memory is occupied by pre-allocation is avoided. For the tessellation tree, the tree structure is stored in an array form, and the locality of data is improved, so that the cache hit rate is improved, and random access to a memory space is avoided.
The step 4) is specifically as follows:
for each three-dimensional point P in the desired mapped three-dimensional point set P i And traversing the hierarchy from the root node of the subdivision tree T in parallel by using the GPU:
4.1 First determines the current three-dimensional point P i The layers in the subdivision tree T are located, and then the GPU is utilized to aim at the three-dimensional point P in parallel i Establishing a bounding box by the curved surface sections corresponding to the 1 x 1 rectangular region of each tree node in the tree hierarchy, and judging whether the bounding box contains the current three-dimensional point P i And judging:
if the bounding box contains the current three-dimensional point P i If so, the tree node corresponding to the bounding box is reserved and is used as an effective tree node;
if the bounding box does not contain the current three-dimensional point P i Discarding the tree node corresponding to the bounding box;
4.2 From P) i Starting from the central point of the rectangular plane of each effective tree node of the current layer, expanding the rectangular plane to the surrounding 1 x 1 rectangular area on the uv plane, and performing Newton iteration for a limited number of times in parallel to find a two-dimensional feature point on the uv plane, wherein the two-dimensional feature point corresponds to one point on the NURBS curved surface and the current three-dimensional point P i The distance between the two sets of the first-order partial derivatives is smaller than the tolerance delta, and the NURBS curved surface three-dimensional points and the first-order partial derivatives used in the Newton iteration process are represented and calculated by the matrix;
if the two-dimensional feature point found by one thread of the GPU corresponds to one point on the NURBS curved surface and the current three-dimensional point P i If the distance between the two-dimensional characteristic points is less than the tolerance delta, the two-dimensional characteristic points are stored in a two-dimensional characteristic point group D;
if a plurality of two-dimensional feature points obtained from a plurality of threads of the GPU correspond to one point on the NURBS curved surface and the current three-dimensional point P i If the distance between the two characteristic points is less than the tolerance delta, taking a two-dimensional characteristic point with the minimum distance to a two-dimensional characteristic point group D;
4.3 If the current three-dimensional point P in step 4.2) i All tree nodes under the layer in the current subdivision tree T can not obtain two-dimensional feature points smaller than the tolerance delta after Newton iteration Newton of limited times, and then the current three-dimensional point P is used i Entering the next layer of the tree T and making the following judgments:
if the current three-dimensional point P i If the tree node in the hierarchy of the subdivided tree T is not empty, returning to the step 4.2) for processing;
if the current three-dimensional point P i If the tree node in the hierarchy of the subdivided tree T is empty, the current three-dimensional point P is i Not on NURBS surface, for current three-dimensional point P i The process is finished, and the next current three-dimensional point P is aimed at i+1 Returning to the step 4.1) for treatment;
4.4 ) after the iteration of the above steps is completed, all three-dimensional points P are obtained i Corresponding to two-dimensional feature points on the uv plane.
In the step 4.1), the bounding box formed by the control points of the NURBS curved surface is used as the bounding box of the NURBS curved surface.The convex hull property of a NURBS surface indicates that the NURBS surface is contained in the convex hull of its control points. In the subdivision process, a cuboid formed by NURBS control points is simply used as a bounding box of the NURBS curved surface. After entering the next layer each time, the algorithm divides three-dimensional points P of each NURBS surface segment and the target in the current layer of the subdivision tree i Carrying out bounding box detection in parallel and rejecting bounding boxes not containing P i The tree node of (1).
Firstly, according to a NURBS curved surface G input by a user, utilizing a GPU to calculate the curved surface G in parallel and solve coefficient matrixes in u and v directions; then calculating an intermediate matrix and storing the intermediate matrix in a constant memory area of a GPU, and then utilizing the GPU to construct a subdivision tree T of the NURBS curved surface G in parallel and storing the subdivision tree T in the constant memory area of the GPU; for each three-dimensional point P in the input three-dimensional point group P i Traversing the layers from the root node of the subdivision tree T in parallel; in the traversing process, each curved surface segment is parallel to the three-dimensional point P i And (4) detecting the bounding box, and then performing Newton iteration for a certain number of times to finally obtain a target point within a certain error range. Thus, the invention can quickly and robustly generate the inverse solution array D corresponding to the input point group P according to the input NURBS curved surface and the input point group P.
The method maps the NURBS curved surface projection of the product to a plane to obtain the accurate corresponding two-dimensional characteristic points, and then the two-dimensional characteristic points can be used for modeling, simulation and simulation analysis.
The product is a product such as a CAD/CAM software system geometric kernel, such as an aircraft, a living article and the like.
The beneficial effects of the invention are: the hardware architecture characteristic and the programming characteristic of the GPU are fully exerted, the robustness of the inverse solution of the NURBS curved surface is guaranteed, meanwhile, the storage performance of the inverse solution of the NURBS curved surface is greatly optimized, and the inverse solution speed of the NURBS curved surface is greatly improved.
The invention utilizes two methods of a surface subdivision method and a Newton iteration numerical value method to process the problem of mapping characteristic points of the NURBS surface of the product, newton iteration utilizes the surface subdivision method to select an initial value, the surface subdivision method is assisted by Newton iteration to improve the accuracy of the result, the expression mode of the NURBS surface is expressed and optimized by a matrix, and the convergence rate of the surface algorithm of the product is improved under the condition of ensuring to obtain the global optimal solution.
The invention solves the problem of realizing the efficient inverse solution of the NURBS curved surface by using the GPU. The invention can play an important role in the processes of NURBS surface fitting of a point cloud model, collision detection, physical simulation, interference avoidance in a CAD/CAM system and the like. The algorithm used by the invention is realized on the GPU, the hardware advantages of GPU multithreading are fully utilized, the GPU programming characteristic is combined, the robustness of the NURBS curved surface reverse solution is ensured, the storage performance of the NURBS curved surface reverse solution is greatly optimized, and the NURBS curved surface reverse solution speed is greatly improved.
Drawings
FIG. 1 is a flow chart of the present invention.
FIG. 2 is a schematic representation of a surface of an embodiment input.
Fig. 3 is a schematic diagram of tessellation over the parameter domain.
FIG. 4 is a schematic diagram of an enclosure of an embodiment.
FIG. 5 is a diagram of a Newton's iteration method of an embodiment.
Detailed Description
The invention is further illustrated by the following figures and examples.
As shown in fig. 1, an embodiment of the complete method according to the present disclosure is as follows:
the embodied product is an airplane model product shown in model D in fig. 2. Others are shown as ABC in figure 2.
1) Inputting a NURBS curved surface G given by a product, a uv plane required to be mapped and a three-dimensional point group P required to be mapped; the NURBS curved surface G is described by a bivariate piecewise rational function S (u, v), u and v respectively represent two orthogonal directions on a uv plane, the NURBS curved surface G is divided into a plurality of sections by preset known piecewise points, two adjacent sections are divided by the piecewise points, and each section forms a piecewise point interval;
the input product NURBS curved surface G comprises orders, control points, weights thereof and segmentation points, the NURBS curved surface G is divided into a plurality of sections by the segmentation points, and adjacent two sections are divided by the segmentation points.
The orders of the NURBS curved surface G in the u direction and the v direction are P and q respectively, the number of control points of the NURBS curved surface G in the u direction and the v direction is n and m respectively, and the control points P f,g Expressed as the f-th control point in the u-direction and the G-th control point in the v-direction, w, respectively, of the NURBS curved surface G f,g Indicating a control point P f,g The segmentation point vectors of the NURBS surface G in the U and V directions are denoted as U and V, respectively.
N p-order B-spline basis functions are correspondingly arranged on each segment of the NURBS curved surface G in the u direction, and the s-th p-order B-spline basis function in the u direction is represented as N s,p (u, v); m q-order B spline basis functions are correspondingly arranged on each segment of the NURBS curved surface G in the v direction, and the t-th q-order B spline basis function in the v direction is represented as N t,q (u, v). The B-spline basis function is used to calculate a weight coefficient for each control point.
A three-dimensional point group P of the desired mapping, where Pi represents the ith point in the three-dimensional point group P.
And D represents a two-dimensional characteristic point group D output by the method, wherein Di represents the ith two-dimensional characteristic point.
In this example, the parameters of the NURBS surface are shown in the following table:
testing model parameters
Figure BDA0003949989440000081
The generation rule of the input point group P is as follows: firstly, generating a pair of effective parameter values (u, v) through a random number program, then calculating a three-dimensional point (x, y, z) corresponding to the parameter values on the NURBS curved surface, and finally adding a random noise epsilon to the (x, y, z), wherein the generated result is used as input data to test the algorithm, and each model is tested by 65536 test cases.
2) Utilizing a GPU to calculate a middle matrix of each segment of the NURBS curved surface G in parallel, and storing the middle matrix in a constant memory area of the GPU;
solving is carried out on the NURBS curved surface according to the following matrix form of partial derivatives to obtain a coefficient matrix N of the NURBS curved surface in the u direction and the v direction respectively u And N v
S p,q (u,v)=UN u H(N v ) T V T
Figure BDA0003949989440000091
Figure BDA0003949989440000092
Figure BDA0003949989440000093
Figure BDA0003949989440000094
Then the intermediate matrix N is calculated u H(N v ) T And stored in the constant memory area of the GPU.
Coefficient matrix N u And N v The value of each element in (b) is obtained by iterative calculation according to the following recursion function N:
Figure BDA0003949989440000095
Figure BDA0003949989440000101
comparing the calculation efficiency of NURBS curved surface matrix representation and the calculation efficiency of traditional recursion representation, respectively calculating corresponding three-dimensional coordinate points and two first-order partial derivatives, and recording the time overhead of the three-dimensional coordinate points and the two first-order partial derivatives, wherein the results are shown in the following table:
quantitative comparison of different representations of NURBS
Figure BDA0003949989440000102
The above results show that the matrix representation can significantly reduce the time overhead for calculating the three-dimensional coordinate points and partial derivatives.
3) Utilizing the GPU to parallelly construct a subdivision tree T of the NURBS curved surface G, and storing the subdivision tree T in a constant memory area of the GPU, wherein the method comprises the following specific steps:
3.1 Create a blank current level node List and next level node List NextList, which are used for storing tree nodes of the current level and the next level respectively;
3.2 Each tree node in the subdivided tree T is a 1 × 1 rectangular region located on a uv plane, and the 1 × 1 rectangular region located at the origin of the uv plane is stored as a root node R in a current-layer node List;
3.3 ) processing each tree node in the current-level node List in parallel, performing subdivision operation on each tree node, and storing a new tree node generated by subdivision into a next-level node List NextList as a next-level tree node;
3.4 If the next-layer node List NextList is not empty, exchanging the current-layer node List and the next-layer node List NextList, emptying the next-layer node List NextList after exchanging, returning to step 3.3) and continuing the iteration processing;
and if the next-layer node list NextList is empty, finishing the iteration processing, thereby obtaining tree nodes of each layer of the subdivision tree T and storing the tree nodes in a constant memory area of the GPU.
The subdivision operation specifically includes calculating the variation of the 1 × 1 rectangular region of the tree node in the u and v directions according to the following formula:
in particular, two first-order partial derivatives of NURBS curved surface
Figure BDA0003949989440000111
And
Figure BDA0003949989440000112
to estimate the variation Delta S of the NURBS curved surface in the u and v directions u And Δ S v The calculation formula is as follows:
Figure BDA0003949989440000113
Figure BDA0003949989440000114
then, comparing and judging the variation of the 1 x 1 rectangular region of the tree node in the u and v directions with a preset tolerance delta:
if the variation of the 1 x 1 rectangular region of the tree node in the u/v direction exceeds the tolerance delta, uniformly dividing the 1 x 1 rectangular region of the tree node into two halves in the direction, and taking one divided rectangular region as a new tree node;
and if the 1 × 1 rectangular region of the tree node does not exceed the tolerance delta in the u/v direction, uniformly dividing the 1 × 1 rectangular region of the tree node by two in the direction, and not generating a new tree node.
A schematic diagram of the subdivision process and the subdivision tree T of the embodiment is shown in fig. 3, the subdivision tree of the embodiment having a total of 4 levels.
4) Utilizing GPU to parallelly map all three-dimensional points P in three-dimensional point group P required to be mapped i And processing the subdivision tree T to obtain each three-dimensional point P i And (4) corresponding two-dimensional feature points on the uv plane.
For each three-dimensional point P in the desired mapped three-dimensional point set P i And traversing the hierarchy from the root node of the subdivision tree T in parallel by using the GPU:
4.1 First determines the current three-dimensional point P i The levels in the subdivision tree T are located, and then the GPU is utilized to aim at the three-dimensional point P in parallel i A bounding box (bounding box) is established by the curved surface segments corresponding to the 1 × 1 rectangular region of each tree node in the tree hierarchy, and fig. 4 is a schematic diagram of the bounding box of the embodiment, and is used for judging whether the bounding box includes the current three-dimensional point P i And carrying outAnd (3) judging:
if the bounding box contains the current three-dimensional point P i If yes, the tree node corresponding to the bounding box is reserved and used as an effective tree node;
if the bounding box does not contain the current three-dimensional point P i Discarding the tree node corresponding to the bounding box;
4.2 Bounding boxes created by the curved surface segments corresponding to the rectangular planes of different tree nodes may overlap, from P i Starting from the central point of the rectangular plane of each effective tree node of the current layer, expanding the rectangular plane to the surrounding 1 x 1 rectangular area on the uv plane, and performing Newton iteration Newton for a limited number of times in parallel to find a two-dimensional feature point on the uv plane, wherein the two-dimensional feature point corresponds to one point on the NURBS curved surface and the current three-dimensional point P i The distance between the two sets of the first-order partial derivatives is smaller than the tolerance delta, and the NURBS curved surface three-dimensional points and the first-order partial derivatives used in the Newton iteration process are represented and calculated by the matrix;
the number of times of limitation is specifically set to not more than 10 steps.
If the two-dimensional feature point found by one thread of the GPU corresponds to one point on the NURBS curved surface and the current three-dimensional point P i If the distance between the two-dimensional characteristic points is less than the tolerance delta, the two-dimensional characteristic points are stored in a two-dimensional characteristic point group D;
if a plurality of two-dimensional feature points obtained from a plurality of threads of the GPU correspond to one point on the NURBS curved surface and the current three-dimensional point P i If the distance between the two-dimensional feature points is less than the tolerance delta, the two-dimensional feature point with the smallest distance is selected to the two-dimensional feature point group D.
The schematic diagram of newton iteration of the embodiment is shown in fig. 5, and convergence can be achieved by 3 newton iterations.
4.3 If the current three-dimensional point P in step 4.2) i All tree nodes under the layer in the current subdivision tree T can not obtain two-dimensional feature points smaller than the tolerance delta after Newton iteration Newton for limited times, and then the current three-dimensional point P is compared with the two-dimensional feature points i Enter the next level of tree T and make the following decisions:
if the current three-dimensional point P i If the tree node in the hierarchy of the subdivided tree T is not empty, returning to the step 4.2) for processing;
if when it is usedFront three-dimensional point P i If the tree node in the hierarchy of the subdivided tree T is empty, the current three-dimensional point P is i Not on NURBS surface, for current three-dimensional point P i The processing is finished, and the next three-dimensional point P is aimed at i+1 Returning to the step 4.1) for processing, and ending the method;
4.4 ) after the iteration of the above steps is completed, all three-dimensional points P are obtained i Corresponding to two-dimensional feature points on the uv plane.
In the examples, the resulting acceleration effect is compared to other commonly used algorithms as shown in the following table:
TABLE 3 inverse solution calculation speed (unit: kilo-point per second)
Figure BDA0003949989440000121
Figure BDA0003949989440000131
Wherein, the abc algorithm respectively represents:
a. an inverse solution method (single thread) realized based on NURBS surface basis function representation;
b. inverse solution using OpenMP acceleration (16 threads) based on NURBS surface basis function representation implementation;
c. the invention uses a GPU-accelerated inverse solution algorithm based on NURBS matrix representation.
Aiming at the problem that the time overhead of inverse solution of a large complex three-dimensional model processed by CAD/CAM software is too large, the invention provides a general parallel algorithm based on surface subdivision, gauss-Newton iteration and NURBS matrix representation to solve the inverse solution problem of the NURBS surface. The invention obtains the calculation speed improvement which is at most two orders of magnitude higher than that of the traditional recursive algorithm through GPU parallel acceleration, and obtains better robustness on a test model.
The above detailed description is intended to illustrate the present invention, not to limit the present invention, and any modifications and changes made within the spirit of the present invention and the scope of the claims fall within the scope of the present invention.

Claims (6)

1. A parallel processing method for inverse solution of GPU for NURBS surface mapping of products is characterized by comprising the following steps:
1) Inputting a NURBS curved surface G given by a product, a uv plane required to be mapped and a three-dimensional point group P required to be mapped; the NURBS curved surface G is described by a bivariate segmentation rational function S (u, v), u and v respectively represent two orthogonal directions on a uv plane, the NURBS curved surface G is divided into a plurality of sections by segmentation points, and two adjacent sections are divided by the segmentation points;
2) Utilizing a GPU to calculate the intermediate matrix of each segment of the NURBS curved surface G in parallel, and storing the intermediate matrix in the GPU;
3) Utilizing a GPU (graphics processing Unit) to construct a subdivision tree T of the NURBS curved surface G in parallel, and storing the subdivision tree T in the GPU;
4) Utilizing GPU to parallelly map all three-dimensional points P in three-dimensional point group P required to be mapped i And processing the three-dimensional points P with the subdivision tree T to obtain each three-dimensional point i And (4) corresponding two-dimensional feature points on the uv plane.
2. The method of claim 1, wherein the NURBS surface mapping inverse solution GPU parallel processing is performed by: the step 2) is specifically as follows:
solving is carried out on the NURBS curved surface according to the following matrix form of partial derivatives to obtain a coefficient matrix N of the NURBS curved surface in the u direction and the v direction respectively u And N v
S p,q (u,v)=UN u H(N v ) T V T
Figure FDA0003949989430000011
Figure FDA0003949989430000012
Figure FDA0003949989430000013
Figure FDA0003949989430000014
Wherein S is p,q (u, v) represents a three-dimensional point on the NURBS curved surface corresponding to the two-dimensional parameter point (u, v),
Figure FDA0003949989430000015
and
Figure FDA0003949989430000016
expressing first-order partial derivatives of the NURBS curved surface corresponding to the two-dimensional parameter points (U, V) in the U and V directions, p and q respectively express the orders of the NURBS curved surface G in the U and V directions, N and m respectively express the number U and V of control points of the NURBS curved surface G in the U and V directions, respectively, are segmentation point vectors of the NURBS curved surface in the U and V directions, and N u And N v Coefficient matrixes of the NURBS curved surface in the u direction and the v direction respectively, H is a matrix formed by all control points on the NURBS curved surface, u p+1 、v q+1 Respectively representing p +1 th and q +1 th segmentation point values in the segmentation point vectors U and V;
then the intermediate matrix N is calculated u H(N v ) T And stored in the constant memory area of the GPU.
3. The method of claim 1, wherein the NURBS surface mapping inverse solution GPU parallel processing is performed by:
in the step 2), the coefficient matrix N u And N v The value of each element in (b) is obtained by iterative calculation according to the following recursion function N:
Figure FDA0003949989430000021
Figure FDA0003949989430000022
in the formula, r and c are respectively a row index and a column index of a coefficient matrix, p and q respectively represent the orders of the NURBS curved surface G in the U and V directions, and i and j represent the segment point interval indexes of the current guessed parameter points on U and V in the Newton iteration process; n is a radical of hydrogen u (r, c) and N v (r, c) represents a coefficient matrix N u And N v The recursion function values of the elements of the row r and the column c, a, b, k and l represent recursion parameters, the initial values are p, q, i and j respectively,
Figure FDA0003949989430000031
representing the difference between the i +1 th and the i-th segmentation point on the segmentation point vector U, i.e. U i+1 -u i
Figure FDA0003949989430000032
Representing the difference U between the k + p-a segment point and the k segment point on the segment point vector U k+p-a -u k
Figure FDA0003949989430000033
Representing the difference between the i +1 th and the i-th segmentation point on the segmentation point vector V, i.e. u i+1 -u i
Figure FDA0003949989430000034
Representing the difference u between the k + p-a segment point and the k segment point on the segment point vector V k+p-a -u k
4. The method of claim 1, wherein the NURBS surface mapping inverse solution GPU parallel processing is performed by:
in the step 3, the step of constructing the subdivision tree T of the NURBS curved surface G in parallel by using the GPU is as follows:
3.1 Create a blank current level node List and next level node List NextList, which are used for storing tree nodes of the current level and the next level respectively;
3.2 Each tree node in the subdivided tree T is a 1 × 1 rectangular region located on the uv plane, and the 1 × 1 rectangular region located at the origin of the uv plane is used as a root node R to be stored in the current layer node List;
3.3 ) processing each tree node in the current-level node List in parallel, performing subdivision operation on each tree node, and storing a new tree node generated by subdivision into a next-level node List NextList as a next-level tree node;
3.4 If the next-layer node List NextList is not empty, exchanging the current-layer node List and the next-layer node List NextList, emptying the next-layer node List NextList after exchanging, and returning to the step 3.3) to continue the iteration processing;
and if the next-layer node list NextList is empty, finishing the iterative processing, thereby obtaining tree nodes of each level of the subdivision tree T and storing the tree nodes in a constant memory area of the GPU.
5. The method of claim 4, wherein the NURBS surface mapping inverse solution GPU parallel processing is performed by:
the subdivision operation specifically includes calculating the variation of a 1 × 1 rectangular region of the tree node in the u and v directions according to the following formula:
Figure FDA0003949989430000041
Figure FDA0003949989430000042
wherein, Δ S u And Δ S v Representing the amount of variation of the NURBS surface in the u and v directions, u 0 、v 0 Respectively representing the coordinate values of the lower left corner of the rectangular region in the u and v directions, u 1 、v 1 Respectively indicate the upper right corner of the rectangular area is u andthe coordinate values in the direction of v are,
Figure FDA0003949989430000043
and
Figure FDA0003949989430000044
representing first-order partial derivatives of two-dimensional parameter points on the NURBS curved surface in the u direction and the v direction, wherein the first-order partial derivatives are calculated by using the NURBS curved surface matrix representation, e represents the sampling times on the NURBS curved surface, and i represents the ith sampling;
then comparing and judging the variation of the 1 x 1 rectangular region of the tree node in the u and v directions with a preset tolerance delta:
if the variable quantity of the 1 x 1 rectangular region of the tree node in the u/v direction exceeds the tolerance delta, uniformly dividing the 1 x 1 rectangular region of the tree node into two parts in the direction, and taking one divided rectangular region as a new tree node;
and if the 1 x 1 rectangular region of the tree node does not exceed the tolerance delta in the u/v direction, uniformly dividing the 1 x 1 rectangular region of the tree node into two in the direction, and not generating a new tree node.
6. The method of claim 1, wherein the NURBS surface mapping inverse solution GPU parallel processing is performed by:
the step 4) is specifically as follows:
for each three-dimensional point P in the three-dimensional point group P to be mapped i And traversing the layers from the root node of the subdivision tree T in parallel by using the GPU:
4.1 First determines the current three-dimensional point P i The levels in the subdivision tree T are located, and then the GPU is utilized to aim at the three-dimensional point P in parallel i Establishing a bounding box by the curved surface sections corresponding to the 1 x 1 rectangular region of each tree node in the tree hierarchy, and judging whether the bounding box contains the current three-dimensional point P i And judging:
if the bounding box contains the current three-dimensional point P i If so, the tree node corresponding to the bounding box is reserved and is used as an effective tree node;
if the bounding box does not contain the current three-dimensional point P i Discarding the tree node corresponding to the bounding box;
4.2 From P) i Starting from the central point of the rectangular plane of each effective tree node of the current layer, expanding the rectangular plane to the surrounding 1 x 1 rectangular area on the uv plane, and performing Newton iteration for a limited number of times in parallel to find a two-dimensional feature point on the uv plane, wherein the two-dimensional feature point corresponds to one point on the NURBS curved surface and the current three-dimensional point P i The distance therebetween is less than the tolerance δ;
if the two-dimensional feature point found by one thread of the GPU corresponds to one point on the NURBS curved surface and the current three-dimensional point P i If the distance between the two-dimensional characteristic points is less than the tolerance delta, the two-dimensional characteristic points are stored in a two-dimensional characteristic point group D;
if a plurality of two-dimensional feature points obtained from a plurality of threads of the GPU correspond to one point on the NURBS curved surface and the current three-dimensional point P i If the distance between the two characteristic points is less than the tolerance delta, taking a two-dimensional characteristic point with the minimum distance to a two-dimensional characteristic point group D;
4.3 If the current three-dimensional point P in step 4.2) i All tree nodes under the layer in the current subdivision tree T can not obtain two-dimensional feature points smaller than the tolerance delta after Newton iteration Newton of limited times, and then the current three-dimensional point P is used i Enter the next level of tree T and make the following decisions:
if the current three-dimensional point P i If the tree node in the hierarchy of the subdivided tree T is not empty, returning to the step 4.2) for processing;
if the current three-dimensional point P i If the tree node in the hierarchy of the subdivided tree T is empty, the current three-dimensional point P is i Not on NURBS surface, for current three-dimensional point P i The process is finished, and the next current three-dimensional point P is aimed at i+1 Returning to the step 4.1) for treatment;
4.4 ) after the iteration of the above steps is completed, all three-dimensional points P are obtained i Corresponding to two-dimensional feature points on the uv plane.
CN202211447389.5A 2022-11-18 2022-11-18 Parallel processing method for inverse solution of GPU (graphics processing Unit) of NURBS (non-Uniform rational B-spline) surface mapping of product Pending CN115730438A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211447389.5A CN115730438A (en) 2022-11-18 2022-11-18 Parallel processing method for inverse solution of GPU (graphics processing Unit) of NURBS (non-Uniform rational B-spline) surface mapping of product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211447389.5A CN115730438A (en) 2022-11-18 2022-11-18 Parallel processing method for inverse solution of GPU (graphics processing Unit) of NURBS (non-Uniform rational B-spline) surface mapping of product

Publications (1)

Publication Number Publication Date
CN115730438A true CN115730438A (en) 2023-03-03

Family

ID=85296822

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211447389.5A Pending CN115730438A (en) 2022-11-18 2022-11-18 Parallel processing method for inverse solution of GPU (graphics processing Unit) of NURBS (non-Uniform rational B-spline) surface mapping of product

Country Status (1)

Country Link
CN (1) CN115730438A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116310048A (en) * 2023-03-29 2023-06-23 上海慕灿信息科技有限公司 Method for calculating intersection point of ray tracing and NURBS curved surface based on curvature subdivision

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116310048A (en) * 2023-03-29 2023-06-23 上海慕灿信息科技有限公司 Method for calculating intersection point of ray tracing and NURBS curved surface based on curvature subdivision
CN116310048B (en) * 2023-03-29 2024-01-26 上海慕灿信息科技有限公司 Method for calculating intersection point of ray tracing and NURBS curved surface based on curvature subdivision

Similar Documents

Publication Publication Date Title
US7786991B2 (en) Applications of interval arithmetic for reduction of number of computations in ray tracing problems
CN105760588B (en) SPH fluid surface reconstruction method based on two-layer regular grid
JP2020109659A (en) Learning of neural network for inferring editable feature tree
Papagiannopoulos et al. How to teach neural networks to mesh: Application on 2-D simplicial contours
CN110516316B (en) GPU acceleration method for solving Euler equation by interrupted Galerkin method
CN113077553A (en) Three-dimensional model segmentation method based on surface attributes
CN115730438A (en) Parallel processing method for inverse solution of GPU (graphics processing Unit) of NURBS (non-Uniform rational B-spline) surface mapping of product
Evangelou et al. Fast radius search exploiting ray-tracing frameworks
KR100512760B1 (en) Method for generating 3d mesh from 3d points by using shrink-wrapping scheme of boundary cells
CN113609599A (en) Wall surface distance effective unit calculation method for aircraft turbulence flow-around simulation
US10083264B1 (en) Systems and methods for implicit surface modeling
Chao et al. Improved hybrid bounding box collision detection algorithm
CN110738726B (en) Robot vision-guided three-dimensional object reconstruction method based on octree
Akinci et al. Adaptive surface reconstruction for SPH using 3-level uniform grids
CN117115393A (en) NURBS curved surface parallel intersection method, equipment and storage medium based on GPU
CN107730464A (en) Image noise reduction parallel algorithm based on Block- matching
Horvat et al. Ray-casting point-in-polyhedron test
CN114756974B (en) Wall surface distance calculation method considering object surface normal information
CN114627346B (en) Point cloud data downsampling method capable of retaining important features
CN113111612B (en) Discrete point cloud repeated point fast searching method based on self-adaptive space subdivision
CN110322415A (en) High-precision surface three-dimensional reconstruction method based on point cloud
CN115511731A (en) Noise processing method and noise processing equipment
CN114399611A (en) Polyhedral optimization method based on grid quality measurement characteristics
CN114119882A (en) Efficient nested grid host unit searching method in aircraft dynamic flow field analysis
Lee et al. Primitive trees for precomputed distance queries

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination