Automated optimization fitting method and system for automobile body Bézier curve
By extracting the deviation matrix and boundary deviation matrix, calculating the average fitting distance, and iteratively updating the control points, the problem of automatic fitting of Bézier curves for automobile bodies is solved, improving the efficiency and smoothness of industrial design.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-08
- Publication Date
- 2026-04-14
AI Technical Summary
Existing technologies struggle to quickly and efficiently fit Bézier curves for car bodies when curve points are unknown, impacting the efficiency of industrial design.
By extracting the deviation matrix and boundary deviation matrix, calculating the average fitting distance, and iteratively updating the control points, the computer system can be used to achieve automatic optimal fitting of the Bézier curve.
It enables rapid automatic fitting at unknown curve points, improving the efficiency and smoothness of automotive body design, and is suitable for CAD design of industrial products.
Smart Images

Figure CN116385586B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer graphics technology, and more specifically, to a method for automatic optimization fitting of Bézier curves of automobile bodies. Technical Background
[0002] Bézier curves are a fundamental tool in computer graphics modeling. They can also assist in industrial design, such as automobile body design, and have a significant impact on automobile body research.
[0003] For example, CN114491856A provides a multi-condition optimization design method for turbine runners under multi-energy complementarity conditions. First, an initial three-dimensional blade model is established, and the Bézier curve expresses the geometric distribution characteristics of the model's placement angle. The obtained optimization design variables are modeled, and the range of variation of the inlet and outlet placement angles of the model is constrained. Then, a sample space for optimization design is constructed based on the optimization design variables and constraint variables. Hydraulic performance numerical calculations are performed on each mixed-flow turbine runner model to obtain their operating efficiencies under ultra-low load, low load, and rated load conditions. An optimization objective function is established, and then a response surface model between the constraint variables and the optimization objective function is constructed. After ensuring that the model meets accuracy requirements, global optimization is performed on the response surface model to obtain the optimal solution set. From the optimal solution set, the solution set where the weighted average efficiency of both the turbine and its runner blades is improved is selected; this is the optimized turbine runner under multi-energy complementarity conditions.
[0004] The shape of the Bézier curve is determined by its control points. Therefore, this method proposes to fit the Bézier curve by iteratively adjusting its control points. This automatic Bézier curve fitting method is more conducive to rapid industrial intelligent design applications. Summary of the Invention
[0005] The purpose of this invention is to address the shortcomings of existing technologies by providing an automatic optimization fitting method for the Bézier curve of a car body.
[0006] The present invention provides an automatic optimization fitting method for the Bézier curve of a car body, comprising the following steps:
[0007] (1) Extract the deviation matrix and the average fitting distance, including first extracting the deviation matrix of the area where the real lines of the car body are located, then discretizing the initialized Bézier curve into several points, then extracting the boundary deviation matrix, determining the average fitting distance based on the deviation distance, and using the average fitting distance as the subsequent update and iteration condition.
[0008] (2) Extracting control point update amount and updating control points, including first knowing the four control points of the Bézier curve, extracting the update amount of the control points in different directions in the rectangular coordinates according to the minimum deviation condition and the fitting distance in the fitting situation, then obtaining new control points according to the update amount and the original control points, and extracting the average fitting distance of the updated points, comparing the new average fitting distance with the average fitting distance calculated in the previous step to determine whether it needs to be updated again. If it is needed, the control points are updated iteratively multiple times; otherwise, it is considered that the adjustment of one control point is completed, and then the next control point is adjusted in the same way. The control points are continuously iterated and updated until the optimized curve is obtained, realizing the integration and smoothness of the reconstruction of the car body curve by extracting the discrete points of the original car body appearance.
[0009] Moreover, the method for extracting the deviation matrix of the region where the line is located is to calculate the distance between any point (i,j) in the image where the real line is located and the line points in the four directions of ±x and ±y, and then traverse all points to obtain the deviation matrix, which is denoted as BM(4,M,N).
[0010] Furthermore, the method for extracting the boundary deviation matrix is to discretize the initialized Bézier curve to obtain n uniform discrete points {P1, P2, ..., P...}. n Calculate the deviation matrices in each of the four directions separately, and combine them to obtain the boundary deviation matrix of this curve for this region.
[0011] Furthermore, the method for determining the average fitting distance based on the deviation distance is as follows: define the average fitting distance of the curve. CBM is the deviation matrix, min() calculates the minimum deviation value for each uniformly discrete point column by column, and sum() sums the minimum deviation values of n uniformly discrete points. The numerator represents the sum of the deviation distances of the discrete points of the curve.
[0012] Moreover, the update method for extracting control points in different directions in rectangular coordinates is to divide the sum of the deviation distances of discrete points that satisfy the minimum deviation condition in that direction by the number of discrete points.
[0013] On the other hand, the present invention provides an automatic optimization fitting system for Bézier curves of automobile bodies, used to implement the automatic optimization fitting method for Bézier curves of automobile bodies as described above.
[0014] Furthermore, it includes a processor and a memory, the memory being used to store program instructions, and the processor being used to call the stored instructions in the memory to execute an automatic optimization fitting method for a car body Bézier curve as described above.
[0015] Furthermore, it includes a readable storage medium on which a computer program is stored, which, when executed, implements an automatic optimization fitting method for a car body Bézier curve as described above.
[0016] This invention has the following innovative features compared to existing technologies:
[0017] 1) An innovative method for finding unknown curve points is proposed;
[0018] 2) Optimize the Bézier curve by iterating through control points.
[0019] The beneficial effects of this invention are:
[0020] 1) Facilitates CAD design of industrial products, especially automotive body optimization. CAD design of industrial products generally requires NURBS curves. Cubic Bézier curves, as a special type of NURBS curve, have an automatic fitting method that can be extended to the automatic extraction of general NURBS curves, which is beneficial for rapid and efficient CAD design of industrial products.
[0021] 2) By using the deviation matrix of the entire region to update the control points, it is possible to automatically fit cubic Bézier curves without giving the true curve points. Attached Figure Description
[0022] Figure 1 This is a flowchart illustrating the steps of an embodiment of the present invention.
[0023] Figure 2 A schematic diagram of the constraint region for iterative adjustment of intermediate control points.
[0024] Figure 3 This is a diagram illustrating the iterative process of an embodiment of the present invention. Detailed Implementation
[0025] The specific embodiments of the present invention will be further described below with reference to the accompanying drawings and technical solutions.
[0026] This invention provides an automatic optimization fitting scheme for the Bézier curve of a car body. It extracts the deviation matrix of the region where the curve is located, discretizes the Bézier curve for a given initial control point, and calculates the current average fitting distance of the curve. Furthermore, it calculates the update amount of the first control point based on the minimum deviation condition and the deviation distance, iterates and updates the first control point multiple times, and adjusts the second control point in the same way, finally obtaining the optimized Bézier curve. This achieves the integration and smoothness of reconstructing the car body curve by extracting discrete points from the original car body appearance.
[0027] See Figure 1This invention provides an automatic optimization fitting method for the Bézier curve of a car body, comprising the following steps:
[0028] (1) Extract the deviation matrix and average fitting distance: First, calculate the deviation matrix of the region where the line is located. Then, discretize the Bézier curve with the given initial control points into n points. Calculate the boundary deviation matrix and determine the average fitting distance based on the deviation distance. The average fitting distance is used as the subsequent update and iteration condition.
[0029] The implementation method of step (1) in the embodiment is as follows:
[0030] First, the initial Bézier curve is calculated for a given discrete point using the arc length equal division method. To obtain control points for iteratively adjusting the Bézier curve, this method first calculates the distance and direction from all other points within the line region to the line and saves this as a deviation matrix. Then, the iteration process is controlled based on the average fitting distance of the curve. Given the image containing the real line as I(M,N) (if pixel (i,j) is a line point, then pixel value I(i,j) = 1; otherwise, pixel value I(i,j) = 0), the distance and direction between all points within the region and the line point are calculated, where M and N are the image dimensions (width and height). The specific calculation method is as follows:
[0031] For any point (i,j) in the image I(M,N) containing the actual lines of the car body, calculate its distance to the line points in the four directions (±x, ±y). Iterate through all points to obtain the deviation matrix, denoted as BM(4,M,N). In the specific calculation, considering the relatively small number of actual line points, initialize BM(4,M,N) = Inf (i.e., infinitely large). Using line point (i,j) as the reference, iterate in the four directions.
[0032] If I(i-ki,j)==1 and Then BM(1,ik,j)=k (k=1,2,…,ki); where 1 represents a line point. Indicates non-line points.
[0033] If I(i+ki,j)==1 and Then BM(2,i+k,j)=k(k=1,2,…,ki);
[0034] If I(i,j-ki)==1 and Then BM(3,i,jk)=k(k=1,2,…,ki);
[0035] If I(i,j+ki)==1 and Then BM(3,i,j+k)=k(k=1,2,…,ki).
[0036] Here, == represents checking whether the two ends are equal. It represents any.
[0037] Next, discretize the initialized Bézier curve and calculate n uniformly discrete points {P1, P2, ..., P} of the curve. n}, thus obtaining the boundary deviation matrix CBM of the curve. 4*n =BM(1:4, P) ix P iy (That is, for n uniformly discrete points {P1, P2, ..., P...) n} Calculate the deviation matrices in each of the four directions separately, and combine them to obtain the boundary deviation matrix of the curve for this region. Define the mean fitting length (MFL) of the curve as follows: (CBM is the deviation matrix, min is the minimum deviation value calculated for each uniformly discrete point by column, and sum is the sum of the minimum deviation values of n uniformly discrete points), where the numerator represents the sum of the deviation distances of the discrete points of the curve.
[0038] The meanings of the character variables in the above text are as follows: I(M,N) is the image where the real line is located; (i,j) is the coordinate point of the image; x, y are the two perpendicular directions of the Cartesian coordinate system; BM(4,M,N) is the deviation matrix; ki is the set step size; k is a variable in the calculation process; BM(1,ik,j) is the deviation matrix after traversing in the negative x direction, BM(2,ik,j) is the deviation matrix after traversing in the positive x direction, BM(3,ik,j) is the deviation matrix after traversing in the negative y direction, and BM(4,ik,j) is the deviation matrix after traversing in the positive y direction; CBM 4*n P is the boundary deviation matrix of the curve; ix That is, the i-th uniformly discrete point P i The x-coordinate value of P; iy That is, the i-th uniformly discrete point P i The coordinates in the y-direction; MFL is the average fitting distance;
[0039] (2) Extracting control point update amount and updating control points: First, given the four control points of the Bézier curve, calculate the update amount of the control points in different directions in the rectangular coordinate system based on the fitting condition, i.e., the minimum deviation condition and the fitting distance. Then, obtain the new control points based on the update amount and the original control points, and calculate the average fitting distance of the updated points. Compare the new average fitting distance with the average fitting distance calculated in the previous step to determine whether it is necessary to update again. If so, iterate and update the control points multiple times. After adjusting one control point, adjust the next control point in the same way. Continue to iterate and update the control points until the optimized curve is obtained.
[0040] Step (2) of the embodiment is implemented as follows:
[0041] The control points are adjusted using a piecewise calculation approach. Let the fitted curve expression be denoted as P. u = c(u), the four control points are denoted as P0, P1, P2 and P3 respectively. Let the intermediate parameters L1 = |P1-P0|, L2 = |P2-P1|, L3 = |P3-P2|, and the piecewise parameters be c(u).
[0042] When P0 is updated, the range of values for parameter u in the curve expression is (0, u1);
[0043] When P1 is updated, the range of values for u is:
[0044] When P2 is updated, the range of values for u is:
[0045] When P3 is updated, the range of u is (u2, 1).
[0046] Regarding the feature lines on the car body, these lines are generally convex, do not twist, and are not excessively protruding. Therefore, the adjustment area is constrained during the calculation process, as shown in the attached figure. Figure 2 As shown, the rectangle enclosed by [P0, Q1, Q2, P3] is the constraint rectangle, where Q1 and Q2 are endpoints obtained by extending along the convex direction of the curve, with half the length of line segment P0P3, starting from P0 and P3 respectively. When adjusting P1, the adjustment area of P1 should fall within the grayscale area of the left image; when adjusting P2, the adjustment area of P2 should fall within the grayscale area of the right image.
[0047] The control point to be updated is denoted as oldP. The control point update amounts are Δx and Δy, whose values depend on the fitting in the four directions. L1 is the line segment length between control points P0 and P1; L2 is the line segment length between control points P1 and P2; L3 is the line segment length between control points P2 and P3; u1, u2, and u3 are three values of parameter u, ranging from 0 to 1; the specific update process of the control points is as follows:
[0048] 1) First, consider the update amount in the x-direction. Define the update amount in the -x-direction as Lvalue and the update amount in the +x-direction as Rvalue. Let MI1 = {q|CBM(1,q)≤MaxError} and MI2 = {q|CBM(2,q)≤MaxError}, which are the sets of discrete points satisfying the minimum deviation condition in the -x and +x directions, respectively. MaxError is the minimum deviation condition. The update amount is calculated as the sum of the deviation distances of the discrete points satisfying the minimum deviation condition in that direction divided by the number of discrete points. The mathematical expression is as follows: In the formula, the numerator represents the sum of the deviation distances of the set of discrete points that satisfy the minimum deviation condition, and |MI1| is the number of elements in the set vector MI1; |MI2| is the number of elements in the set vector MI2. CBM(1,q) is the boundary deviation matrix in the - direction; CBM(2,q) is the boundary deviation matrix in the +x direction; q is the coordinate value in the x direction, here representing discrete points in the y direction; MI1 is the set vector in the negative x direction, represented in coordinate form; MI2 is the set vector in the positive x direction, represented in coordinate form;
[0049] If Lvalue = Rvalue, the average deviation distances in the ±x directions are the same, and the update amount Δx = 0.
[0050] If Lvalue < Rvalue, the average deviation distance in the +x direction is smaller, and the fitting effect is better, indicating that this point needs to be updated to the right, and the update amount Δx = Lvalue.
[0051] If Lvalue > Rvalue, the average deviation distance in the -x direction is smaller, and the fitting effect is better, indicating that this point needs to be updated to the left, and the update amount Δx = -Rvalue.
[0052] 2) Similarly, calculate the value of △y. Specifically as follows:
[0053] Define the update amount in the -y direction as Uvalue, and the update amount in the +y direction as Bvalue. Denote MI1 = {q|CBM(3,q) ≤ MaxError}, MI2 = {q|CBM(4,q) ≤ MaxError}, which are respectively the sets of discrete points that satisfy the minimum deviation condition in the - direction and the + direction, and MaxError is the minimum deviation condition. The update amount is calculated as the sum of the deviation distances of the discrete points that satisfy the minimum deviation condition in this direction divided by the number of discrete points. The mathematical expression is as follows: In the formula, the numerator represents the sum of the deviation distances of the set of discrete points that satisfy the minimum deviation condition, and |MI1| is the number of elements in the set vector MI1; |MI2| is the number of elements in the set vector MI2. CBM(3,q) is the boundary deviation matrix in the - direction; CBM(4,q) is the boundary deviation matrix in the +y direction; q is the coordinate value in the y direction, here representing discrete points in the y direction; MI1 is the set vector in the negative y direction, represented in coordinate form; MI2 is the set vector in the positive x direction, represented in coordinate form;
[0054] If Uvalue = Bvalue, the average deviation distances in the ±y directions are the same, and the update amount Δy = 0.
[0055] If Uvalue < Bvalue, the average deviation distance in the +y direction is small, and the fitting effect is better, indicating that this point needs to be updated to the right, and the update amount Δy = Uvalue. If Uvalue > Bvalue, the average deviation distance in the -x direction is small, and the fitting effect is better, indicating that this point needs to be updated to the left, and the update amount Δy = -Bvalue.
[0056] The control point is updated to newP = oldP + [△x, △y]. Calculate the average fitting distance newMFL of the horizontal line according to the new control point. If newMFL < MFL, then oldP = newP, MFL = newMFL. newP is the updated control point; oldP is the control point to be updated in 2), that is, the control point before update here; [△x, △y] is the change of the control point coordinates in two directions of the rectangular coordinate system.
[0057] 3) Calculate 1) and 2) cyclically by an iterative method. The iterative constraint condition is preferably set as the average deviation distance obtained by updating the control point is less than the average deviation distance before update. The maximum number of iterations is set to 5. The final result obtained is recorded as the optimal control point position.
[0058] 4) After adjusting one control point, adjust the next control point in the same way, and continuously iterate to update the control points. Finally, the optimized curve is obtained. Preferred suggestion: First fix the control point P2, and adjust the control point P1 according to the process of 1)-3); further fix the control point P1, and then adjust the control point P2 according to the process of 1)-3), and then repeat adjusting the control points P1 and P2 again to obtain a more accurate result. After the adjustment of the internal control points P1 and P2 is completed, further adjust the control points P0 and P3 according to the process of 1)-3)
[0059] Figure 3 is the automatic fitting result obtained by using the iterative method under the condition of a given initial line and a noisy line.
[0060] For the convenience of implementation reference, the following provides a simplified expression of the implementation process of the embodiment of the present invention:
[0061]
[0062]
[0063] where t represents the current iteration number.
[0064] In specific implementation, the method proposed by the technical solution of the present invention can be automatically run by those skilled in the art using computer software technology. The system device for realizing the method, such as a computer-readable storage medium storing the corresponding computer program of the technical solution of the present invention and a computer device including running the corresponding computer program, should also be within the protection scope of the present invention.
[0065] In some possible embodiments, an automatic optimization fitting system for a car body Bézier curve is provided, including a processor and a memory. The memory is used to store program instructions, and the processor is used to call the stored instructions in the memory to execute an automatic optimization fitting method for a car body Bézier curve as described above.
[0066] In some possible embodiments, an automatic optimization fitting system for a car body Bézier curve is provided, including a readable storage medium storing a computer program, which, when executed, implements an automatic optimization fitting method for a car body Bézier curve as described above.
[0067] The specific embodiments described herein are merely illustrative of the spirit of the invention. Those skilled in the art to which this invention pertains may make various modifications or additions to the described specific embodiments or use similar methods to substitute them, without departing from the spirit of the invention or exceeding the scope defined by the appended claims.
Claims
1. An automatic optimization fitting method for the Bézier curve of a car body, characterized in that: Includes the following steps, (1) Extract the deviation matrix and the average fitting distance, including first extracting the deviation matrix of the area where the real lines of the car body are located, then discretizing the initialized Bézier curve into several points, then extracting the boundary deviation matrix, determining the average fitting distance based on the deviation distance, and using the average fitting distance as the subsequent update and iteration condition. (2) Extracting control point update amount and updating control points, including first knowing the four control points of the Bézier curve, extracting the update amount of the control points in different directions in the rectangular coordinates according to the minimum deviation condition and the fitting distance in the fitting situation, then obtaining new control points according to the update amount and the original control points, and extracting the average fitting distance of the updated points, comparing the new average fitting distance with the average fitting distance calculated in the previous step to determine whether it needs to be updated again. If it is needed, the control points are updated iteratively multiple times; otherwise, it is considered that the adjustment of one control point is completed, and then the next control point is adjusted in the same way. The control points are continuously iterated and updated until the optimized curve is obtained, realizing the integration and smoothness of the reconstruction of the car body curve by extracting the discrete points of the original car body appearance.
2. The automatic optimization fitting method for the Bézier curve of a car body according to claim 1, characterized in that: The method for extracting the deviation matrix of the region where the line is located is as follows: for any point (i,j) in the image where the real line is located, calculate its distance from the line points in the four directions of ±x and ±y, traverse all points to obtain the deviation matrix and denote it as BM(4,M,N).
3. The automatic optimization fitting method for the Bézier curve of a car body according to claim 2, characterized in that: The method for extracting the boundary deviation matrix is to discretize the initialized Bézier curve into n uniformly discrete points {P1, P2, ..., Pn}. n Calculate the deviation matrices in each of the four directions separately, and combine them to obtain the boundary deviation matrix of this curve for this region.
4. The automatic optimization fitting method for the Bézier curve of a car body according to claim 3, characterized in that: The method for determining the average fitting distance based on the deviation distance is as follows: define the average fitting distance of the curve. CBM is the deviation matrix, min() calculates the minimum deviation value for each uniformly discrete point column by column, and sum() sums the minimum deviation values of n uniformly discrete points. The numerator represents the sum of the deviation distances of the discrete points of the curve.
5. The automatic optimization fitting method for the Bézier curve of a car body according to claim 1, characterized in that: The update method for extracting control points in different directions in rectangular coordinates is to divide the sum of the deviation distances of discrete points that satisfy the minimum deviation condition in that direction by the number of discrete points.
6. An automatic optimization fitting system for the Bézier curve of a car body, characterized in that: This method is used to implement an automatic optimization fitting method for a car body Bézier curve as described in any one of claims 1-5.
7. The automatic optimization fitting system for the Bézier curve of a car body according to claim 6, characterized in that: It includes a processor and a memory, the memory being used to store program instructions, and the processor being used to call the stored instructions in the memory to execute an automatic optimization fitting method for a car body Bézier curve as described in any one of claims 1-5.
8. The automatic optimization fitting system for the Bézier curve of a car body according to claim 6, characterized in that: The device includes a readable storage medium on which a computer program is stored, and when the computer program is executed, it implements an automatic optimization fitting method for a car body Bézier curve as described in any one of claims 1-5.
Citation Information
Patent Citations
Bezier curve-based path optimization method and system
CN109933932A
Automatic modeling method for parameterized model of side view of vehicle body
CN113516759A