CN117970870A - Numerical control curve acquisition method, numerical control curve acquisition equipment and storage medium - Google Patents

Numerical control curve acquisition method, numerical control curve acquisition equipment and storage medium Download PDF

Info

Publication number
CN117970870A
CN117970870A CN202311809252.4A CN202311809252A CN117970870A CN 117970870 A CN117970870 A CN 117970870A CN 202311809252 A CN202311809252 A CN 202311809252A CN 117970870 A CN117970870 A CN 117970870A
Authority
CN
China
Prior art keywords
interpolated
point
points
curve
line segment
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
CN202311809252.4A
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.)
Beijing A&e Technologies Co ltd
Original Assignee
Beijing A&e Technologies Co ltd
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 Beijing A&e Technologies Co ltd filed Critical Beijing A&e Technologies Co ltd
Priority to CN202311809252.4A priority Critical patent/CN117970870A/en
Publication of CN117970870A publication Critical patent/CN117970870A/en
Pending legal-status Critical Current

Links

Landscapes

  • Image Generation (AREA)

Abstract

The application discloses a numerical control curve acquisition method, numerical control curve acquisition equipment and a storage medium, wherein the method comprises the following steps: constructing a point set to be interpolated by utilizing points to be interpolated on the curve to be interpolated; generating a parameter value corresponding to each point to be interpolated in the point set to be interpolated; constructing a node vector set according to the parameter value corresponding to each point to be interpolated, the initial number of control points and the initial order; obtaining a control vector set based on the node vector set and the error function; fitting a NURBS curve based on the node vector set and the control vector set; and in response to the NURBS curve meeting the preset requirement, interpolating the curve to be interpolated by using the NURBS curve. According to the scheme, the calculated amount can be reduced, and the interpolation precision can be improved.

Description

Numerical control curve acquisition method, numerical control curve acquisition equipment and storage medium
Technical Field
The application relates to the technical field of numerical control systems, in particular to a numerical control curve acquisition method, a numerical control curve acquisition device and a storage medium.
Background
Numerical control machining has become an important component in the field of modern manufacturing, and demands for high-speed and high-precision machining are increasing. In practical application, the traditional numerical control machine tool of the cloth cutting machine has only linear and circular arc interpolation methods, but for non-linear and circular arc types, a large number of dense G01 small line segments are often adopted for approximate fitting, and when interpolation points in a processing path are too many, the processing speed, the precision and the smoothness of the numerical control machine tool are greatly affected. The parametric model in the form of a smooth curve needs to be discretized into a large number of small line segments, which increases the amount of processing code. Therefore, there is a need for a numerical control curve method to solve the above problems.
Disclosure of Invention
The application provides a numerical control curve acquisition method, numerical control curve acquisition equipment and a storage medium, which can reduce the calculated amount and improve the interpolation precision.
The first aspect of the application provides a method for acquiring a numerical control curve, which comprises the following steps: constructing a point set to be interpolated by utilizing points to be interpolated on the curve to be interpolated; generating a parameter value corresponding to each point to be interpolated in the point set to be interpolated; constructing a node vector set according to the parameter value, the initial number and the initial order of the control points corresponding to each point to be interpolated, wherein the control points represent the positions of NURBS curves, and the node vector set comprises parameters corresponding to a plurality of nodes; obtaining a control vector set based on the node vector set and an error function, wherein the error function represents the deviation between a curve to be interpolated and an initial curve, and the control vector set comprises parameter values corresponding to a plurality of control points; fitting a NURBS curve based on the node vector set and the control vector set; in response to the NURBS curve meeting the preset requirement, interpolating the curve to be interpolated by using the NURBS curve; otherwise, updating the initial number to the number of control points of the NURBS curve, updating the initial order to the order of the NURBS curve and updating the initial curve to the NURBS curve, and returning to execute the step of constructing the node vector set according to the parameter value corresponding to each point to be interpolated, the initial number of the control points and the initial order.
The step of generating the parameter value corresponding to each point to be interpolated in the point to be interpolated set comprises the following steps: acquiring first distances between every two adjacent points to be interpolated in a point set to be interpolated, and calculating the sum of all the first distances to obtain a first target value; aiming at the current point to be interpolated in the point to be interpolated set, calculating a second distance between the current point to be interpolated and the previous adjacent point to be interpolated, and calculating a first ratio of the second distance to a first target value; and calculating the sum value of the parameter value corresponding to the previous adjacent point to be interpolated and the first ratio value to obtain the parameter value corresponding to the current point to be interpolated.
The method comprises the steps of constructing a node vector set according to the parameter value, the initial number of control points and the initial order corresponding to each point to be interpolated, and comprises the following steps: setting parameters corresponding to the first number of nodes in the node vector to 0 and setting parameters corresponding to the second number of nodes in the node vector to 1, wherein the first number and the second number are equal to the sum of the initial order and 1; parameters corresponding to each node in the middle of the node vector are obtained:i=int(jg),α=jg-i; Wherein p is the initial order, m is the number of control points, g is the scaling factor, j is the first sequence number factor, j=1, 2, …, n-p, i is the second sequence number factor, int () is the integer function, 1- α is the first weight, α is the second weight, u p+j is the parameter corresponding to each node in the node vector set, and is,/> For the parameter value corresponding to the first point to be interpolated,/>For the parameter value corresponding to the second point to be interpolated
The method for constructing the point set to be interpolated by utilizing the points to be interpolated on the curve to be interpolated comprises the following steps: screening non-smooth points to be interpolated in all points to be interpolated to obtain a first point set; screening out to-be-interpolated points forming a target line segment in all to-be-interpolated points to obtain a second point set, wherein the target line segment is formed by two adjacent to-be-interpolated points, and the length of the target line segment is larger than that of at least one line segment adjacent to the target line segment; and merging the first point set and the second point set to obtain a point set to be interpolated.
The step of screening non-smooth points to be interpolated among all the points to be interpolated to obtain a first point set includes: determining a starting point in all points to be interpolated; determining an end point in points to be interpolated after the start point, wherein the distance from a first point to be interpolated between the start point and the end point to a first target line segment is larger than a preset bow height error, the distances from other points to be interpolated between the start point and the end point to the first target line segment are smaller than or equal to the preset bow height error, the two end points of the first target line segment are the start point and the end point respectively, and the first point to be interpolated is adjacent to the end point; rejecting other points to be interpolated between the starting point and the ending point except the first point to be interpolated; taking the first point to be interpolated as a starting point, and returning to the step of determining an ending point in the points to be interpolated after the starting point until all the points to be interpolated are traversed; and constructing a first point set according to the rest points to be interpolated.
The method comprises the steps of constructing a first point set according to the rest points to be interpolated, wherein the step comprises the following steps: constructing an initial set by utilizing all the remaining points to be interpolated; sequentially connecting two adjacent points to be interpolated in the initial set to obtain a plurality of first line segments; calculating the included angle of every two adjacent first line segments; and adding the vertex of the included angle to the first set of points in response to the included angle being greater than the included angle threshold.
The step of screening out the points to be interpolated forming the target line segment in all the points to be interpolated to obtain a second point set includes: sequentially connecting two adjacent points to be interpolated in the curve to be interpolated to obtain a plurality of second line segments; determining a second target line segment in the plurality of second line segments, wherein the length of the second target line segment is larger than the average length of the adjacent preset number of second line segments; and adding the points to be interpolated at the two ends of all the second target line segments to a second point set.
Wherein, after interpolating the curve to be interpolated using the NURBS curve, the method comprises: dividing the NURBS curve by using a third number of control points to obtain a plurality of third segments; calculating a first total length of the NURBS curve before segmentation processing and a second total length of all third line segments; and in response to the absolute difference between the first total length and the second total length being less than the difference threshold, taking the second total length as the total length of the NURBS curve, otherwise, increasing the third number, and then returning to execute the step of dividing the NURBS curve by using the third number of control points to obtain a plurality of third line segments.
Wherein the step of responding to the NURBS curve meeting the preset requirement comprises: judging whether the similarity between the NURBS curve and the curve to be interpolated meets the similarity requirement; if so, determining that the NURBS curve meets the preset requirement, otherwise, determining that the NUBS curve does not meet the preset requirement.
A second aspect of the present application provides a numerical control curve acquisition apparatus, including a memory and a processor coupled to each other, where the processor is configured to execute program instructions stored in the memory, so as to implement the numerical control curve acquisition method in the first aspect.
A third aspect of the present application provides a computer-readable storage medium having stored thereon program instructions which, when executed by a processor, implement the numerical control curve acquisition method of the first aspect described above.
According to the scheme, the points to be interpolated on the curve to be interpolated are utilized to construct a point set to be interpolated, parameter values corresponding to each point to be interpolated are generated according to the point set to be interpolated, the node vector set is obtained by utilizing the parameter values corresponding to each point to be interpolated, the initial number and the initial order of the control points, the node vector set is brought into an error function to obtain a control vector set, then an NURBS curve is fitted according to the node vector set and the control vector set, the fitted NURBS curve is judged, and if the NURBS curve meets the preset requirement, the NURBS curve is utilized to interpolate the curve to be interpolated; otherwise, updating the initial number to the number of control points of the NURBS curve, updating the initial order to the order of the NURBS curve, updating the initial curve to the NURBS curve, and returning to execute the step of acquiring a node vector set, fitting the NURBS curve through the node vector set and the control vector set, thereby reducing the calculated amount, judging and iterating the obtained NURBS curve to obtain the NURBS curve meeting the preset requirement, and utilizing the NURBS curve to interpolate the curve to be interpolated, so that the interpolation precision can be improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application as claimed.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application.
FIG. 1 is a flow chart of an embodiment of the small segment segmentation method of the present application;
FIG. 2 is a schematic diagram of a small segment segmentation method according to an embodiment of the present application;
FIG. 3 is a schematic diagram of another embodiment of the small segment segmentation method of the present application;
FIG. 4 is a flow chart of an embodiment of a method for acquiring a numerical control curve according to the present application;
FIG. 5 is a flow chart of an embodiment of a curve length calculation method according to the present application;
FIG. 6 is a schematic diagram of a numerical control curve acquisition apparatus according to an embodiment of the present application;
FIG. 7 is a schematic diagram of a frame of an embodiment of a computer-readable storage medium of the present application.
Detailed Description
The following describes embodiments of the present application in detail with reference to the drawings.
In the following description, for purposes of explanation and not limitation, specific details are set forth such as the particular system architecture, interfaces, techniques, etc., in order to provide a thorough understanding of the present application.
The term "and/or" is herein merely an association relationship describing an associated object, meaning that there may be three relationships, e.g., a and/or B, may represent: a exists alone, A and B exist together, and B exists alone. In addition, the character "/" herein generally indicates that the front and rear associated objects are an "or" relationship. Further, "a plurality" herein means two or more than two. In addition, the term "at least one" herein means any one of a plurality or any combination of at least two of a plurality, for example, including at least one of A, B, C, may mean including any one or more elements selected from the group consisting of A, B and C.
Referring to fig. 1, fig. 1 is a flow chart of an embodiment of the small line segment segmentation method according to the present application.
Specifically, the method may include the steps of:
step S110: and screening non-smooth points to be interpolated in all the points to be interpolated to obtain a first point set.
In some embodiments, to obtain a non-smooth point to be interpolated, the coordinates of the point to be interpolated may be used for calculation. Specifically, calculating the difference value between the current to-be-interpolated point and the last to-be-interpolated point in an X-axis coordinate and a Y-axis coordinate, comparing the difference value between the X-axis and the Y-axis with a preset coordinate difference value, and if the difference value between the X-axis and the Y-axis is smaller than or equal to the preset coordinate difference value, the current to-be-interpolated point is a smooth to-be-interpolated point; if at least one difference value is larger than the preset coordinate difference value, the current point to be interpolated is a non-smooth point to be interpolated.
In other embodiments, the non-smooth points to be interpolated among all the points to be interpolated may be screened out using a predetermined bow-height error. Specifically, the following steps S111 to S114 can be referred to.
Step S111: and determining a starting point in all points to be interpolated.
In some embodiments, one point to be interpolated may be randomly selected from all points to be interpolated as a starting point. Or selecting the first interpolation point among all the interpolation points as a starting point.
Step S112: an end point is determined among points to be interpolated after the start point.
The distance from the first point to be interpolated between the starting point and the ending point to the first target line segment is greater than a preset bow height error, the distance from the other points to be interpolated between the starting point and the ending point to the first target line segment is less than or equal to the preset bow height error, two end points of the first target line segment are the starting point and the ending point respectively, and the first point to be interpolated is adjacent to the ending point.
Regarding the preset bow-height error, it is to determine whether the point to be interpolated is a smooth point, if the distance from the point to be interpolated to the first target line segment is smaller than the preset bow-height error, the point to be interpolated is considered to be located on the first target line segment, so that the point to be interpolated is a smooth point.
In some embodiments, to facilitate calculation of the distance between the point to be interpolated and the first target line segment, the start point and the end point may be set at intervals such that the start point and the end point are separated by at least one point to be interpolated, so that the vertical distance between the point to be interpolated and the end point and the first target line segment may be calculated. The method for calculating the distance from the point to be interpolated to the first target line segment may be calculated by using a point-to-line distance formula, which is not limited herein.
Step S113: and eliminating other points to be interpolated except the first point to be interpolated between the starting point and the ending point.
In some embodiments, after calculating the distance from the point to be interpolated between the start point and the end point to the first target line segment, if there is at least one point to be interpolated that is greater than the preset bow-height error, the point to be interpolated is reserved and added to the first point set. And discarding the point to be interpolated which is not more than the preset bow-height error from the distance to the first target line segment, and not performing the subsequent steps.
Step S114: and taking the first point to be interpolated as a starting point, and returning to the step S112 until all the points to be interpolated are traversed.
In some embodiments, all the points to be interpolated are traversed, the first point to be interpolated P0 is selected as a starting point, the third point to be interpolated P2 is selected as an ending point, and the starting point P0 and the ending point P2 are connected to obtain a first target line segment P0P2. And then calculating the distance e1 from the point to be interpolated P1 between the starting point P0 and the ending point P2 to the first target line segment P0P2, and discarding the point to be interpolated P1 if the calculated distance e1 is smaller than a preset bow height error. Then, the point to be interpolated P0 is taken as a starting point, and the ending point is the point to be interpolated P3. Referring to fig. 2 in combination, a first target line segment P0P3 is obtained by connecting the start point P0 and the end point P3, distances e1, e2 between the points to be interpolated P1, P2 and the first target line segment P0P3 are calculated, and the distances e1, e2 are smaller than a preset bow-height error, so that the points to be interpolated P1, P2 are abandoned. The point to be interpolated P0 is used as a starting point, the ending point is the point to be interpolated P4, the starting point P0 and the ending point P4 are connected to obtain a first target line segment P0P4, distances e1, e2 and e3 between the point to be interpolated P1, P2 and P3 and the first target line segment P0P4 are calculated, at least 1 of the distances e1, e2 and e3 is larger than a preset bow height error, so the point to be interpolated P3 is reserved, and the point P3 is used as a starting point, and the traversal is continued until the distances between the starting point and the ending point to be interpolated are not satisfied to be smaller than the bow height error. This eventually forms a series of filtered point sets s1= { P0, P3, P7, … }, which are then reprogrammed to new sequence points.
Step S115: and constructing a first point set according to the rest points to be interpolated.
In some embodiments, after all the points to be interpolated are traversed, the points to be interpolated that do not meet the preset bow-height error are eliminated, and the remaining points to be interpolated that meet the preset bow-height error are eliminated, so that the remaining points to be interpolated can be directly combined into a set, and the first point set is obtained.
In other embodiments, after a portion of the points to be interpolated are filtered out by using the preset bow-height error, in order to avoid similar points to be interpolated or points with smaller variation from the remaining points to be interpolated, all the remaining points to be interpolated may be screened again.
Specifically, an initial set is constructed using the remaining points to be interpolated, such as the above-described point set S1. And sequentially connecting two adjacent points to be interpolated in the initial set to obtain a plurality of first line segments, and calculating the included angle of each two adjacent first line segments, wherein the included angle can be calculated by adopting the following formula:
Wherein, P i is the current point to be interpolated, and P i-1、Pi+1 is two points adjacent to the current point to be interpolated.
Judging the included angle theta i, and adding the vertex of the included angle into the first point set S3 in response to the included angle being larger than an included angle threshold value; if the included angle is not larger than the included angle threshold value, eliminating the vertex of the included angle. It is to be understood that the included angle threshold may be a preset value or a value calculated according to actual situations, which is not limited herein specifically.
Step S120: and screening out to-be-interpolated points forming a target line segment in all to-be-interpolated points to obtain a second point set.
The target line segment is composed of two adjacent points to be interpolated, and the length of the target line segment is larger than that of at least one line segment adjacent to the target line segment.
In some embodiments, to obtain the second point set, two adjacent points to be interpolated in the to-be-interpolated curve may be sequentially connected to obtain a plurality of second line segments, and a second target line segment is determined in the plurality of second line segments, where the length of the second target line segment is greater than the average length of a preset number of second line segments adjacent to the second target line segment, for example, the length of the second target line segment only needs to be greater than the average length of a preset number of second line segments adjacent to the second target line segment and all located on one side of the second target line segment, or the length of the second target line segment needs to be greater than the average length of a preset number of second line segments adjacent to both sides of the second target line segment, and the preset number may be 1,2, …, n, and the like, where the preset number is not limited in detail herein. And adding the points to be interpolated at the two ends of all the second target line segments to a second point set. Specifically, referring to fig. 3 in combination, in the a diagram in fig. 3, two adjacent points to be interpolated in the curve to be interpolated are sequentially connected to obtain a second line segment l 1,l2,…,l12, a l0 is set to be the average length from the second line segment l 1 to the second line segment l 5, a l1 is set to be the average length from the second line segment l 2 to the second line segment l 6, a r0 is the average length from the second line segment l 7 to the second line segment l 11, a r1 is set to be the average length from the second line segment l 8 to the second line segment l 12, and a coefficient a is set to determine the second line segment by using a. For example, if the determination result is l 6>a×Al0||l6>a×Ar0, l 6 is a second target line segment; and if the judgment result is l 7>a×Al1||l7>a×Ar1, l 7 is a second target line segment. Therefore, l 6、l7 is the second target line segment, and the endpoints in the second target line segment are combined into a second point set s2= { P5, P6, P7 … }.
Step S130: and merging the first point set and the second point set to obtain a point set to be interpolated.
In some embodiments, the points to be interpolated in the first point set and the second point set are combined to obtain a point set to be interpolated. Further, in the merging process, if there is a duplicate point in the first point set and the second point set, only one point is reserved, so that the points to be interpolated in the point set to be interpolated are all unique.
Referring to fig. 4, fig. 4 is a flowchart illustrating an embodiment of a method for acquiring a numerical control curve according to the present application. Specifically, the method may include the steps of:
Step S410: and constructing a point set to be interpolated by utilizing the points to be interpolated on the curve to be interpolated.
In some embodiments, in order to quickly obtain the points to be interpolated on the curve to be interpolated, the steps S110 to S130 of the small line segment segmentation method may be utilized to obtain the point set to be interpolated.
Step S420: and generating a parameter value corresponding to each point to be interpolated in the point to be interpolated set.
In some embodiments, after the set of points to be interpolated is obtained, m control points of a p-degree non-rational B-spline may be used to interpolate the points to be interpolated. Thus, to obtain m control points, a parameter may be set for each point to be interpolated in the set of points to be interpolated { Q k }, k=0, 1,2, … nAnd a suitable set of node vectors u= { U 0,u1,...,um }, may also be selected.
In order to make the parameter value corresponding to each point to be interpolated in the point set { Q k, k=0, 1,2, … n } more convenient in the subsequent data processing process, the parameter values are limited in the range of u e [0,1 ]. Therefore, a centripetal parameterization mode is selected for processing, because the processing mode can obtain better results when the point to be interpolated changes in a sharp turn, and the mode can better reflect the distribution of the control points.
Specifically, a first distance between every two adjacent points to be interpolated in the point set to be interpolated can be obtained first, and a sum of all the first distances is calculated to obtain a first target value, where the first target value is shown in the following formula:
Wherein d is a first target value.
Then, for the current to-be-interpolated point in the to-be-interpolated point set, calculating a second distance between the current to-be-interpolated point and a previous adjacent to-be-interpolated point, calculating a first ratio of the second distance to a first target value, and calculating a sum of a parameter value corresponding to the previous adjacent to-be-interpolated point and the first ratio to obtain a parameter value corresponding to the current to-be-interpolated point, wherein the following formula is shown:
Wherein, For the first ratio,/>For the parameter value corresponding to the previous adjacent point to be interpolated,/>For the parameter value corresponding to the current point to be interpolated,/>
Step S430: and constructing a node vector set according to the parameter value corresponding to each point to be interpolated, the initial number of control points and the initial order.
The control points represent the positions of NURBS curves, and the node vector set comprises parameters corresponding to a plurality of nodes.
In some embodiments, the initial number of control points is a predetermined value, and the initial order is also a predetermined value. The order is the power of the highest term in the polynomial function.
In some embodiments, the parameter value corresponding to each point to be interpolated may be utilized, and in particular, refer to step S431 to step S435.
Step S431: and setting the parameters corresponding to the first number of nodes before in the node vector to 0, and setting the parameters corresponding to the second number of nodes after in the node vector to 1.
Wherein, the first quantity and the second quantity are equal to the sum of the initial order and 1.
In some embodiments, to facilitate calculation of the node vector, the calculation amount may be reduced by setting the parameter corresponding to the first number of nodes to 0 and the parameter corresponding to the second number of nodes to 1. The following formula can be referred to:
u0=…=up=0,um-p=…=um=1 (4)
where p is the initial order and m is the number of control points.
Step S432: a scaling factor is determined.
In some embodiments, the scaling factor may be a predetermined value.
In other embodiments, the scaling factor may be a calculation formula, such as:
step S433: and obtaining a product coefficient by using the product of the proportional coefficient and the first sequence number coefficient.
Step S434: and (5) integrating the product coefficients to obtain a second sequence number coefficient.
In some embodiments, the first sequence number coefficient may be a constant, and the product of the ratio coefficient and the first sequence number coefficient is integrated to obtain the second sequence number coefficient. The following formula can be referred to:
i=int(jg) (6)
where j is a first sequence number coefficient, j=1, 2, …, n-p, jg is a product coefficient, i is a second sequence number coefficient, and int () is an integer function.
Step S435: summing the product of the parameter value corresponding to the first point to be interpolated and the first weight, and the product of the parameter value corresponding to the second point to be interpolated and the second weight to obtain the parameter corresponding to the first node in the node vector set;
The corresponding sequence number of the first node in the node vector is the sum value of the first sequence number coefficient and the initial order, the sequence number of the second point to be interpolated in the point to be interpolated set is the second sequence number coefficient, the first point to be interpolated is the previous point to be interpolated adjacent to the second point to be interpolated, the sum of the first weight and the second weight is 1, and the second weight is equal to the difference value of the product coefficient and the second sequence number coefficient.
In some embodiments, to make the values of the node vectors all between [0,1], the sum of the first weight and the second weight may be set to 1. Specifically, the calculation formula for the weight can be referred to as follows:
α=jg-i (7)
wherein 1- α is a first weight and α is a second weight.
Therefore, the calculation formula of the parameter corresponding to the first node is:
Wherein p+j is the corresponding sequence number of the first node in the node vector, For the parameter value corresponding to the first point to be interpolated,/>And the parameter value corresponding to the second point to be interpolated.
Step S440: and obtaining a control vector set based on the node vector set and the error function.
The error function characterizes the deviation between the curve to be interpolated and the initial curve, and the control vector set includes parameter values corresponding to a plurality of control points.
In some embodiments, the error function may be a set equation, such as equation 9:
Wherein, Q i is the point to be interpolated in the point set to be interpolated, Q ' i is the derivative of the point to be interpolated in the point set to be interpolated, C (u i) is the initial curve, i.e. the initial NURBS curve, C' (u i) is the derivative of the initial curve, u i is the node vector, and λ is the deviation coefficient of the curve to be interpolated and the initial curve. The NURBS curve is composed of a set of node vectors u= { U 0,u1,u2,…,un+p+1 }, a set of control vectors And the weight vector set w= { W 0,w1,…,wn }. So NURBS curve C (u) can be expressed as:
where N i,p (U) defines a p-th order B-spline basis function on the node vector U using a recursive method:
where N i,p (u) represents the ith p-th order B-spline basis function. The order p in the B-spline basis function is the power of the highest term in the B-spline basis function.
Therefore, to obtain a set of control vectors using a B-spline basis function, while avoiding the nonlinear problem, a set of weight vectors for NURBS curve C (u) may be set to 1, after which a similar solution to the linear least squares problem may be established to solve the control vectors. Under the condition that the error function E is minimum, each control vector is derived, and the following equation is satisfied:
Finally, the control vector is obtained as follows:
wherein:
using equation 13, a set of control vectors can be obtained
Step S450: based on the node vector set and the control vector set, a NURBS curve is fitted.
In some embodiments, after the node vector set and the control vector set are obtained, the weight vector set is set to 1, and the NURBS curve can be calculated using equation 10.
Step S460: and in response to the NURBS curve meeting the preset requirement, interpolating the curve to be interpolated by using the NURBS curve.
In some embodiments, the NURBS curve is determined as it is being obtained to verify that the NURBS curve meets the preset requirements. Specifically, a first preset range may be set for the number m of control points in the NURBS curve, and a second preset range may be set for the order p of the NURBS curve. The number m of control points and the order p of the NURBS curve obtained through calculation are detected, the number m of the control points meets a first preset range, the fact that the minimum control points can be used for approaching the curve to be interpolated is indicated, meanwhile, the order p meets a second preset range, the fact that the order p of the NURBS curve is large enough and the NURBS curve is smooth enough is indicated, and therefore the NURBS curve is a curve which meets expectations, and the curve to be interpolated can be interpolated by using the NURBS curve. Specifically, the NURBS curve may be used to directly replace the curve to be interpolated to interpolate the curve to be interpolated, or the control point of the NURBS curve may be used to interpolate the curve to be interpolated, and the interpolation method is not specifically limited herein.
In other embodiments, the similarity between the NURBS curve and the curve to be interpolated can be used as a criterion. Specifically, it is determined whether the similarity between the NURBS curve and the curve to be interpolated meets the similarity requirement, if so, it is determined that the NURBS curve meets the preset requirement, otherwise, it is determined that the NURBS curve does not meet the preset requirement, and step S470 is performed. For example, a euclidean distance between the NURBS curve and the curve to be interpolated may be calculated by using a euclidean algorithm, specifically, a euclidean distance between a control point in the NURBS curve and a corresponding control point in the curve to be interpolated may be calculated, and if the calculated euclidean distance is smaller than the distance threshold, it is determined that the NURBS curve meets the preset requirement. It will be appreciated that, regarding the algorithm for calculating the similarity between the NURBS curve and the curve to be interpolated, instead of the euclidean algorithm, cosine similarity, dynamic kernel correlation, etc. may be used, which is not limited herein.
It will be appreciated that, regarding the determination as to whether the NURBS curve meets the preset requirement, besides the above method, the determination may also be made by using the deviation between the NURBS curve and the curve to be interpolated, which is not limited herein specifically.
Step S470: otherwise, the initial number is updated to the number of control points of the NURBS curve, the initial order is updated to the order of the NURBS curve, and the initial curve is updated to the NURBS curve, and the step S430 is performed back.
In some embodiments, if the calculated NURBS curve does not meet the preset requirement, the NURBS curve is iterated until an expected NURBS curve is obtained. Specifically, the number of NURBS curve control points that do not meet the preset requirement may be replaced with the initial number, the order of the NURBS curve may be replaced with the initial order, and the NURBS curve may be used to replace the initial curve, and steps S430 to S470 may be repeatedly performed to obtain a NURBS curve that meets the preset requirement.
In a specific application scenario, the scheme is applied to the field of CNC (Computer numerical control machine tools, digital control machine) machining. Before a product is processed by a CNC system, a CAM (Computer-Aided Manufacturing, computer aided manufacturing) system is used for converting a model contour of a part to be processed in CAD (Computer-AIDED DESIGN, computer aided design) into a NURBS curve, and then the CNC performs NURBS interpolation operation according to three types of parameters (node vector set, control vector set and weight vector set) in the curve, and the NURBS curve is internally calculated and directly generated.
Therefore, the model outline of the product in CAD is the curve to be interpolated, and before formal machining, the CNC system divides the curve of the part to be machined into tiny straight-line segments which are connected in sequence and have short lengths by using the small segment segmentation method and generates corresponding G codes, and then the movement of the mechanical platform is controlled through CNC interpretation so as to obtain a point set to be interpolated. The CNC system obtains a first distance between every two adjacent points to be interpolated in the point set to be interpolated based on a formula 2, calculates the sum of all the first distances to obtain a first target value d, and then calculates a second distance between the current point to be interpolated and the previous adjacent point to be interpolated by using a formula 3, and calculates a first ratio of the second distance to the first target valueCalculating the sum value of the parameter value corresponding to the previous adjacent point to be interpolated and the first ratio value to obtain the parameter value/>, corresponding to the current point to be interpolatedAnd set the first parameter/>For/>Last parameter/>For/>And initializing the number of the control points and the orders, and carrying out the initial number of the control points and the initial orders into a formula 5 to obtain a proportionality coefficient, wherein the first p+1 nodes of the node vector set to be solved are set to be 0, and the later p+1 nodes are set to be 1. The product coefficient jg is obtained by using the product of the proportionality coefficient g and the first sequence number coefficient j, and the second sequence number coefficient i is obtained by using the formula 6. And obtaining weights by using a formula 7, and carrying out summation processing on the product of the parameter value corresponding to the first point to be interpolated and the first weight and the product of the parameter value corresponding to the second point to be interpolated and the second weight to obtain the parameter corresponding to the first node in the node vector set, wherein the parameter is shown in a formula 8.
After obtaining the node vector set, to avoid the nonlinear problem, the weight vector set of NURBS curve C (u) may be set to 1, after which a similar solution to the linear least squares problem may be established to solve the error function (equation 9) for the control vector set. Under the condition that the error function E is minimum, deriving each control vector, wherein the solved control vector isThe actual number m of control points can be known through the solved control vector set, and the known node vector set, the control vector set and the weight vector set are brought into a formula 10, so that a NURBS curve can be fitted. Then judging whether the similarity between the NURBS curve and the curve to be interpolated meets the similarity requirement, and if so, interpolating the curve to be interpolated by using the NURBS curve; if the similarity requirement is not met, updating the initial number to the number of control points of the NURBS curve, updating the initial order to the order of the NURBS curve and updating the initial curve to the NURBS curve, and performing iterative operation on the NURBS curve until the NURBS curve meeting the similarity requirement is calculated.
And after the NURBS curve meeting the similarity requirement is obtained, replacing the curve to be interpolated by using the NURBS curve. And in case the NURBS curve is known, the error function can also be determined. Therefore, the length of the NURBS curve can be calculated by inserting the control point into the NURBS curve, so that the CNC machining tool can accurately machine the part to be machined. Referring to fig. 5, the NURBS curve is segmented by using a third number of control points to obtain a plurality of third segments. The first total length of the NURBS curve before segmentation processing and the second total length of all third line segments are calculated. And in response to the absolute difference between the first total length and the second total length being less than the difference threshold, taking the second total length as the total length of the NURBS curve, otherwise, increasing the third number, and then returning to execute the step of dividing the NURBS curve by using the third number of control points to obtain a plurality of third line segments. For example, the NURBS curve may be first divided into two by using a control point, so as to calculate a first total length of the NURBS curve before the division processing and a second total length of the two third line segments, and if an absolute difference between the first total length and the second total length is smaller than a difference threshold, the two third line segments after the division are divided by using two control points, and the division is performed in a circulating manner until the control points approach the curve indefinitely. In addition, the NURBS curve may be divided into three parts by a control point, and the dividing into nine parts is not particularly limited herein.
Wherein the difference threshold may be the value of the error function, in particular for the ratio between the first total length and the second total length, see equation 15.
Wherein tpol denotes a first total length, rdist denotes a second total length.
Interpolation using NURBS curves, speed remains the most important factor. The machining precision and the machining efficiency are both indispensible from the feeding speed. Therefore, under the condition that the NURBS curve length is known, the speed change of the cutter in the actual running process can be calculated by adopting an S curve acceleration and deceleration method so as to improve the machining precision. Specifically, under the condition that the length of the NURBS curve is known, the time T of the expected running of the total curve can be estimated, the time T in the actual running process of the curve is set, if x is given according to a formula 17, y is the finally output node vector u, and the normal acceleration and deceleration starting of the NURBS curve is finally realized.
Wherein y is the position of the cutter in the actual running process, and x is the acceleration of the cutter in the actual running process.
The method comprises the steps of constructing a point set to be interpolated by utilizing points to be interpolated on a curve to be interpolated, generating a parameter value corresponding to each point to be interpolated according to the point set to be interpolated, obtaining a node vector set by utilizing the parameter value corresponding to each point to be interpolated, the initial number and the initial order of control points, bringing the node vector set into an error function to obtain a control vector set, fitting a NURBS curve according to the node vector set and the control vector set, judging the fitted NURBS curve, and interpolating the curve by utilizing the NURBS curve if the NURBS curve meets the preset requirement; otherwise, updating the initial number to the number of control points of the NURBS curve, updating the initial order to the order of the NURBS curve, updating the initial curve to the NURBS curve, and returning to execute the step of acquiring a node vector set, fitting the NURBS curve through the node vector set and the control vector set, thereby reducing the calculated amount, judging and iterating the obtained NURBS curve to obtain the NURBS curve meeting the preset requirement, and utilizing the NURBS curve to interpolate the curve to be interpolated, so that the interpolation precision can be improved.
It will be appreciated by those skilled in the art that in the above-described method of the specific embodiments, the written order of steps is not meant to imply a strict order of execution but rather should be construed according to the function and possibly inherent logic of the steps.
Referring to fig. 6, fig. 6 is a schematic diagram of a frame of an embodiment of a nc curve acquiring apparatus 60 according to the present application. The nc curve acquisition device 60 includes a memory 61 and a processor 62 coupled to each other, the processor 62 being configured to execute program instructions stored in the memory 61 to implement the steps of any of the nc curve acquisition method embodiments described above. In one particular implementation scenario, the numerical control curve acquisition device 60 may include, but is not limited to: the microcomputer and the server, and the numerical control curve obtaining device 60 may also include mobile devices such as a notebook computer and a tablet computer, which are not limited herein.
Specifically, the processor 62 is configured to control itself and the memory 61 to implement the steps of any of the numerical control curve acquisition method embodiments described above. The processor 62 may also be referred to as a CPU (Central Processing Unit ). The processor 62 may be an integrated circuit chip having signal processing capabilities. The Processor 62 may also be a general purpose Processor, a digital signal Processor (DIGITAL SIGNAL Processor, DSP), an Application SPECIFIC INTEGRATED Circuit (ASIC), a Field-Programmable gate array (Field-Programmable GATE ARRAY, FPGA) or other Programmable logic device, a discrete gate or transistor logic device, a discrete hardware component. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. In addition, the processor 62 may be commonly implemented by an integrated circuit chip.
Referring to FIG. 7, FIG. 7 is a schematic diagram of a computer readable storage medium 70 according to an embodiment of the application. The computer readable storage medium 70 stores program instructions 701 capable of being executed by a processor, the program instructions 701 being used to implement the steps in any of the numerical control curve acquisition method embodiments described above.
In some embodiments, functions or modules included in an apparatus provided by the embodiments of the present disclosure may be used to perform a method described in the foregoing method embodiments, and specific implementations thereof may refer to descriptions of the foregoing method embodiments, which are not repeated herein for brevity.
The foregoing description of various embodiments is intended to highlight differences between the various embodiments, which may be the same or similar to each other by reference, and is not repeated herein for the sake of brevity.
In the several embodiments provided in the present application, it should be understood that the disclosed method and apparatus may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of modules or units is merely a logical functional division, and there may be additional divisions of actual implementation, e.g., units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical, or other forms.
In addition, each functional unit in the embodiments of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be embodied in essence or a part contributing to the prior art or all or part of the technical solution in the form of a software product stored in a storage medium, including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor (processor) to execute all or part of the steps of the methods of the embodiments of the present application. And the aforementioned storage medium includes: a usb disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.

Claims (11)

1. The numerical control curve acquisition method is characterized by comprising the following steps of:
Constructing a point set to be interpolated by utilizing points to be interpolated on the curve to be interpolated;
generating a parameter value corresponding to each point to be interpolated in the point to be interpolated set;
Constructing a node vector set according to the parameter value corresponding to each point to be interpolated, the initial number and the initial order of the control points, wherein the control points represent the positions of NURBS curves, and the node vector set comprises parameters corresponding to a plurality of nodes;
Obtaining a control vector set based on the node vector set and an error function, wherein the error function represents the deviation between the curve to be interpolated and an initial curve, and the control vector set comprises parameter values corresponding to a plurality of control points;
fitting the NURBS curve based on the set of node vectors and the set of control vectors;
in response to the NURBS curve meeting a preset requirement, interpolating the curve to be interpolated by using the NURBS curve;
Otherwise, updating the initial number to the number of control points of the NURBS curve, updating the initial order to the order of the NURBS curve, updating the initial curve to the NURBS curve, and returning to execute the step of constructing a node vector set according to the parameter value corresponding to each point to be interpolated, the initial number of control points and the initial order.
2. The method of claim 1, wherein the step of generating parameter values corresponding to each of the points to be interpolated in the set of points to be interpolated comprises:
Acquiring a first distance between every two adjacent points to be interpolated in the point set to be interpolated, and calculating the sum of all the first distances to obtain a first target value;
For a current to-be-interpolated point in the to-be-interpolated point set, calculating a second distance between the current to-be-interpolated point and a previous adjacent to-be-interpolated point, and calculating a first ratio of the second distance to the first target value;
and calculating the sum value of the parameter value corresponding to the previous adjacent point to be interpolated and the first ratio to obtain the parameter value corresponding to the current point to be interpolated.
3. The method according to claim 1, wherein the step of constructing a node vector set according to the parameter value, the initial number of control points, and the initial order corresponding to each of the points to be interpolated includes:
setting parameters corresponding to a first number of nodes before in a node vector to 0, and setting parameters corresponding to a second number of nodes after the first number of nodes in the node vector to 1, wherein the first number and the second number are equal to the sum of the initial order and 1;
parameters corresponding to each node in the middle of the node vector are obtained:
i=int(jg),α=jg-i;
Wherein p is the initial order, m is the number of control points, g is the scaling factor, j is the first sequence number factor, j=1, 2, …, n-p, i is the second sequence number factor, int () is the integer function, 1- α is the first weight, α is the second weight, u p+j is the parameter corresponding to each node in the node vector set, which is, For the parameter value corresponding to the first point to be interpolated,/>And the parameter value corresponding to the second point to be interpolated.
4. The method of claim 1, wherein the step of constructing the set of points to be interpolated using points to be interpolated on the curve to be interpolated comprises:
Screening out non-smooth points to be interpolated in all the points to be interpolated to obtain a first point set;
Screening out to-be-interpolated points forming a target line segment in all to-be-interpolated points to obtain a second point set, wherein the target line segment is formed by two adjacent to-be-interpolated points, and the length of the target line segment is larger than that of at least one line segment adjacent to the target line segment;
and merging the first point set and the second point set to obtain the point set to be interpolated.
5. The method of claim 4, wherein the step of screening out non-smooth points to be interpolated among all the points to be interpolated to obtain a first set of points comprises:
determining a starting point in all the points to be interpolated;
Determining an end point in the points to be interpolated after the start point, wherein the distance from a first point to be interpolated between the start point and the end point to a first target line segment is larger than a preset bow height error, the distances from other points to be interpolated between the start point and the end point to the first target line segment are smaller than or equal to the preset bow height error, two end points of the first target line segment are the start point and the end point respectively, and the first point to be interpolated is adjacent to the end point;
Rejecting other points to be interpolated between the starting point and the ending point except the first point to be interpolated;
returning the first point to be interpolated to the step of determining an end point in the points to be interpolated after the start point until all the points to be interpolated are traversed;
And constructing the first point set according to the rest points to be interpolated.
6. The method of claim 5, wherein the step of constructing the first set of points from all remaining points to be interpolated comprises:
constructing an initial set by using the rest points to be interpolated;
sequentially connecting two adjacent points to be interpolated in the initial set to obtain a plurality of first line segments;
Calculating the included angle of each two adjacent first line segments;
And adding the vertex of the included angle to the first point set in response to the included angle being greater than an included angle threshold.
7. The method of claim 4, wherein the step of screening out the points to be interpolated that form a target line segment from among all the points to be interpolated to obtain a second point set includes:
sequentially connecting two adjacent points to be interpolated in the curve to be interpolated to obtain a plurality of second line segments;
Determining a second target line segment in the plurality of second line segments, wherein the length of the second target line segment is larger than the average length of the adjacent preset number of second line segments;
And adding the points to be interpolated at the two ends of the second target line segment to the second point set.
8. The method of claim 1, comprising, after said interpolating said curve to be interpolated using said NURBS curve:
Dividing the NURBS curve by using a third number of control points to obtain a plurality of third segments;
calculating a first total length of the NURBS curve and a second total length of all the third line segments before the segmentation process;
In response to the absolute difference between the first total length and the second total length being less than a difference threshold, taking the second total length as the total length of the NURBS curve,
Otherwise, the third number is increased, and then the step of dividing the NURBS curve by using the third number of control points to obtain a plurality of third line segments is executed.
9. The method of claim 1, wherein the step of responding to the NURBS curve meeting a preset requirement comprises:
judging whether the similarity between the NURBS curve and the curve to be interpolated meets the similarity requirement;
and if so, determining that the NURBS curve meets a preset requirement, otherwise, determining that the NURBS curve does not meet the preset requirement.
10. A numerical control curve acquisition device comprising a memory and a processor coupled to each other, the processor being configured to execute program instructions stored in the memory to implement the numerical control curve acquisition method of any one of claims 1 to 9.
11. A computer readable storage medium having stored thereon program instructions, which when executed by a processor, implement the numerical control curve acquisition method of any one of claims 1 to 9.
CN202311809252.4A 2023-12-26 2023-12-26 Numerical control curve acquisition method, numerical control curve acquisition equipment and storage medium Pending CN117970870A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311809252.4A CN117970870A (en) 2023-12-26 2023-12-26 Numerical control curve acquisition method, numerical control curve acquisition equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311809252.4A CN117970870A (en) 2023-12-26 2023-12-26 Numerical control curve acquisition method, numerical control curve acquisition equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117970870A true CN117970870A (en) 2024-05-03

Family

ID=90862193

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311809252.4A Pending CN117970870A (en) 2023-12-26 2023-12-26 Numerical control curve acquisition method, numerical control curve acquisition equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117970870A (en)

Similar Documents

Publication Publication Date Title
CN104793560A (en) Method and system for generating a trajectory
CN112733318B (en) Adaptive grid subdivision method, device, equipment and storage medium
JP2011096077A (en) Method and device for generating tool path
CN111311651B (en) Point cloud registration method and device
Park An approximate lofting approach for B-spline surface fitting to functional surfaces
CN110908337B (en) Method for predicting inverse control point of NURBS
CN115130253A (en) Generating a refined control mesh for generating a smooth surface of an object
CN102540977B (en) Method for estimating error in numerical control processing
Baek et al. Precision NURBS interpolator based on recursive characteristics of NURBS
CN113490894A (en) Machining program conversion device, numerical control device, machining program conversion method, and machine learning device
JP2010146161A (en) Design support apparatus, method and program for dividing and modeling parameter space
CN117970870A (en) Numerical control curve acquisition method, numerical control curve acquisition equipment and storage medium
CN112305994B (en) Straight line segment smoothing method, device and equipment based on average filtering and storage medium
CN115599526B (en) Five-axis numerical control machine tool intelligent editing method and device, electronic equipment and storage medium
KR20110072462A (en) Modeling method and system for sketching 3d curved surface model, and program recording medium
JP2007168424A (en) Mold correction system, method, and program
CN116229116A (en) Process multiplexing processing method and system based on similar parts and electronic equipment
JP4981313B2 (en) Three-dimensional shape processing apparatus, curved surface creation program, and curved surface creation method
CN116432329A (en) Computer-aided generation design with feature thickness control for manufacturing and structural performance
CN114970247A (en) Automatic modeling method of high-fidelity finite element model for leaf disc structure
CN114611289A (en) Method and device for determining reference line in automatic driving and electronic equipment
JP5686975B2 (en) Point sequence generation method, point sequence generation program, point sequence generation device, and machine tool provided with the same
CN116339242B (en) Free-form surface cutter path generation method and related equipment
Winter et al. NURBS-based shape and parameter optimization of structural components with an adaptive amount of control points
CN116529774A (en) Model optimization method, device and storage medium for additive manufacturing

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