CN113111405B - NURBS curve fitting method based on improved second-order oscillation PSO algorithm - Google Patents

NURBS curve fitting method based on improved second-order oscillation PSO algorithm Download PDF

Info

Publication number
CN113111405B
CN113111405B CN202110436477.4A CN202110436477A CN113111405B CN 113111405 B CN113111405 B CN 113111405B CN 202110436477 A CN202110436477 A CN 202110436477A CN 113111405 B CN113111405 B CN 113111405B
Authority
CN
China
Prior art keywords
points
point
curvature
nurbs curve
discrete data
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.)
Active
Application number
CN202110436477.4A
Other languages
Chinese (zh)
Other versions
CN113111405A (en
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.)
Dalian University
Original Assignee
Dalian University
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 Dalian University filed Critical Dalian University
Priority to CN202110436477.4A priority Critical patent/CN113111405B/en
Publication of CN113111405A publication Critical patent/CN113111405A/en
Application granted granted Critical
Publication of CN113111405B publication Critical patent/CN113111405B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F30/00Computer-aided design [CAD]
    • G06F30/10Geometric CAD
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F17/00Digital computing or data processing equipment or methods, specially adapted for specific functions
    • G06F17/10Complex mathematical operations
    • G06F17/11Complex mathematical operations for solving equations, e.g. nonlinear equations, general mathematical optimization problems
    • G06F17/12Simultaneous equations, e.g. systems of linear equations
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F30/00Computer-aided design [CAD]
    • G06F30/20Design optimisation, verification or simulation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/004Artificial life, i.e. computing arrangements simulating life
    • G06N3/006Artificial life, i.e. computing arrangements simulating life based on simulated virtual individual or collective life forms, e.g. social simulations or particle swarm optimisation [PSO]
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02TCLIMATE CHANGE MITIGATION TECHNOLOGIES RELATED TO TRANSPORTATION
    • Y02T90/00Enabling technologies or technologies with a potential or indirect contribution to GHG emissions mitigation

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Mathematical Physics (AREA)
  • Mathematical Analysis (AREA)
  • General Engineering & Computer Science (AREA)
  • Computational Mathematics (AREA)
  • Mathematical Optimization (AREA)
  • Pure & Applied Mathematics (AREA)
  • Geometry (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • Software Systems (AREA)
  • Computer Hardware Design (AREA)
  • Artificial Intelligence (AREA)
  • Biophysics (AREA)
  • Computational Linguistics (AREA)
  • Biomedical Technology (AREA)
  • General Health & Medical Sciences (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Operations Research (AREA)
  • Algebra (AREA)
  • Databases & Information Systems (AREA)
  • Image Generation (AREA)
  • Numerical Control (AREA)

Abstract

The application discloses an NURBS curve fitting method based on an improved second-order oscillation PSO algorithm, which comprises the following steps: obtaining discrete data points to be fitted; parameterizing the discrete data points; selecting points which can most represent the shape and the characteristics of the discrete data points by taking the inflection points and the curvature extreme points as selection criteria, and marking the points as characteristic points; obtaining a node vector of the NURBS curve; approximating the characteristic points by a least square method, and performing back calculation to obtain initial control points; constructing an initial population of the initial control point coordinates and initializing the population; establishing an effective fitness function; optimizing the position of an initial control point by utilizing an improved second-order oscillation PSO algorithm to obtain an optimized optimal control point; and fitting and generating a NURBS curve according to the node vector and the optimized optimal control point. The method improves the accuracy and reliability of NURBS curve fitting.

Description

NURBS curve fitting method based on improved second-order oscillation PSO algorithm
Technical Field
The application relates to the field of reverse engineering and computer aided design, in particular to an NURBS curve fitting method based on an improved second-order oscillation PSO algorithm.
Background
In the reverse engineering, a large amount of point cloud data is often needed to reconstruct a physical model, but the error generated in the actual measurement process is larger, so that an operator generally adopts an interpolation or approximation method to reduce the error as much as possible, thereby obtaining a curve with higher precision. In the interpolation process, the curve can precisely pass through each discrete data point, so that the data volume becomes large, the burden of data transmission and processing is increased, and the efficiency is low. In contrast, the fitting approximation method not only can adjust the fitting precision, but also can compress the data volume, and is widely applied to aerospace, ship and automobile manufacturing or numerical control machine tools.
The NURBS curve, which is a common curve of the parametric curve fitting method, saves a lot of memory space compared with NC codes, and is the most popular mathematical method for curve surface description in the late 80 s of the 20 th century due to its stable property and good local control capability, and is also the only representation form for defining free curve surfaces in the product model data exchange standard STEP. At present, many advanced numerical control companies such as FANUC, SIEMENS, MITSUBISHI and the like abroad have NURBS curve fitting, planning and interpolation methods with mature specifications, but the techniques are in a secret state and are not open to users.
The manufacturing industry in China is relatively backward in the technical aspect, particularly after industrial 4.0 causes great discussion and research in the industrial field worldwide, the method fundamentally gets rid of dependence on foreign technology, and makes up the shortages of domestic operating systems on curve surface analysis, interpolation, path planning and the like into the direction of researchers.
Therefore, a track planning technology and an operation system with complete NURBS curve fitting, interpolation and speed control are required to be developed.
Disclosure of Invention
The application aims to provide an improved second-order oscillation PSO algorithm-based NURBS curve fitting method, which modifies selection standards of anti-curvature points and curvature extreme points, and takes the two types of points which can most reflect the track shape as characteristic points to replace all discrete data points; the initial control point coordinates are unfolded into a one-dimensional vector to construct an initial population of particles, the initial population is optimized by an improved second-order oscillation PSO algorithm, and finally NURBS parameter curve fitting can still keep higher precision on the basis of compressed data quantity.
In order to achieve the above purpose, the technical scheme of the application is as follows: an NURBS curve fitting method based on an improved second-order oscillating PSO algorithm, comprising:
obtaining discrete data points to be fitted;
parameterizing the discrete data points;
selecting points which can most represent the shape and the characteristics of the discrete data points by taking the inflection points and the curvature extreme points as selection criteria, and marking the points as characteristic points;
obtaining a node vector of the NURBS curve;
approximating the characteristic points by a least square method, and performing back calculation to obtain initial control points;
constructing an initial population of the initial control point coordinates and initializing the population;
establishing an effective fitness function;
optimizing the position of an initial control point by utilizing an improved second-order oscillation PSO algorithm to obtain an optimized optimal control point;
and fitting and generating a NURBS curve according to the node vector and the optimized optimal control point.
Further, the discrete data points are parameterized, specifically: the method adopts a chord length parameterization method to obtain NURBS curve parameters corresponding to discrete data points, and the implementation mode is as follows:
the discrete data points are noted as { Q } i I=0, 1, …, m, i.e.: there are a total of m+1 discrete data points;
let the sum of the chord lengths between two adjacent discrete points be d,
the NURBS curve parameter acquisition mode is as follows:
wherein ,representing a parameter value corresponding to the i-th discrete data point; and (4) obtaining corresponding parameters of the NURBS curve by the simultaneous two formulas.
Further, the points which can best show the shape and the characteristics of the points are screened from the discrete data points by taking the inflection points and the curvature extreme points as selection criteria and are marked as characteristic points M, and the method specifically comprises the following steps:
the feature points are expressed as m= { M i I=0, 1..s, s.ltoreq.s.ltoreq.m }, i.e. there are s+1 feature points in total;
first, the first and the last discrete data points Q 0 ,Q M Divided into feature points, i.e. Q 0 =M 0 ,Q m =M s; wherein ,M0 ,M s The first and last feature points are represented respectively.
Further, the method for obtaining the inflection point is as follows: solving normal vectors between adjacent coordinate points comprises the following steps:
wherein ,Novi Representing the normal vector angle at the i-th point,a normal vector representing the i-th discrete data point to the i+1th discrete data point; when the normal vector included angle at the point is larger than the set threshold value, the concave-convex property of the curve at the point is considered to be changed, and the curve is marked as an inflection point;
the curvature extreme point obtaining mode is as follows: traversing all discrete data points and obtaining curvature k of each point i Average curvature k aver And a curvature maximum value k max The method comprises the steps of carrying out a first treatment on the surface of the Setting a curvature threshold value between the average curvature and the maximum curvature, denoted as k k
The curvature extreme point extraction method is shown as follows:
namely: if the curvature of a certain point is not smaller than the set curvature threshold value, the certain point is considered as a curvature extreme point; if the curvature of a certain point is between the average curvature and the curvature threshold value and the curvature of the front and rear points is not greater than the average curvature, the point is also a curvature extreme point; otherwise, the curvature extreme point is not generated;
feature points representing the discrete data point prototype are obtained by combining the inflection points and the curvature extreme points.
Further, a node vector of the NURBS curve is obtained: and obtaining a node vector by adopting a rounding method based on the parameter values corresponding to the discrete data points.
Further, the feature points are approximated by a least square method, and an initial control point is obtained by back calculation, specifically: the initial control point and the characteristic point at the beginning and the end are keptAgreement, i.e. P 0 =M 0 =Q 0 ,P n =M s =Q m; wherein ,P0 ,P n Respectively representing initial control points at the beginning and the end; in addition, n-1 initial control points approach under the least square method, and the implementation steps are as follows:
taking the sum of squares of errors of corresponding points of the characteristic points and the parameter curves as an objective function, wherein the specific formula is as follows:
where χ represents the objective function value, M i Represents the i-th feature point, C (u i ) Then represents the corresponding value of NURBS curve at the i-th parameter:
removing points after the product of the first and last characteristic points and the basis function, and solving an approximate curve as follows:
ζ i =M i -N 0,k (u i )M 0 -N n,k (u i )M s
wherein ,ζi Representing the value at the i-th point in the approximation curve;
two formulas are obtained in parallel:
to minimize the objective function, the n-1 initial control points are biased to 0, and are sorted to obtain:
wherein γ=1, 2,..n-1;
from this, a system of equations comprising n-1 equations is obtained:
(N T N)P=ζ
wherein N is a (s-1) × (N-1) order matrix:
ζ and P are both (n-1) x 1 order matrices:
solving an equation set by using a Gaussian elimination method to obtain n-1 initial control points;
and integrating the first control point and the last control point to form a control point set, so as to obtain all initial control points.
Further, an initial population of the initial control point coordinates is constructed and population initialization is performed, specifically: expanding the two-dimensional coordinates of the obtained initial control point set into a one-dimensional vector form, and respectively adding a random value between [ -1,1] to each element in the two-dimensional vector form; initializing the particle swarm, wherein the implementation steps are as follows:
initial particle group velocity: setting the initial velocity component of each individual to be a random value within the [ -6,6] interval;
initializing the value of an inertia factor and a learning factor of a particle swarm;
the maximum iteration number of the particle swarm is set.
Further, an effective fitness function is established, specifically: taking the square sum of errors between the characteristic points and corresponding parameters of the NURBS curve as a fitness function, the method is defined as follows:
wherein fit (INP i ) Represents the fitness of the ith particle group individual, M j For the j-th feature point location vector,as feature point M j Parameterized values.
As a further step, in the step S8, the position of the initial control point is optimized by using the improved second-order oscillation PSO algorithm, so as to obtain an optimized optimal control point, which specifically includes the following steps:
acquiring the fitness value of each particle of the initial population;
the speed and the position of the updated particles are respectively represented by the following formulas:
v j (λ+1)=θ×v j (λ)+μ 1jd -(1+σ 1jd (λ)+σ 2 φ jd (λ-1))+μ 2gd -(1+σ 3jd (λ)+σ 4 φ jd (λ-1))
φ jd (λ+1)=φ jd (λ)+v j (λ+1)
wherein ,vj (lambda+1) represents the speed of the jth particle at lambda+1 iteration; θ is an inertial factor; mu (mu) 12 As learning factors, the value range mu 1 =μ 2 ∈[0,4];σ 1234 Is [0,1]Random parameters within the interval; particle search in D-dimensional space, phi jd (λ) represents the d-th component of the j-th particle position vector in the λ -th iteration; η (eta) jd A d-th dimension component representing a j-th individual optimal solution for the particle; η (eta) gd Then the d-th dimension component of the globally optimal solution is represented;
comparing the fitness value of the current position of each particle with the fitness value of the experienced position, if the current position is better, updating the individual optimal value, otherwise, not updating;
comparing the individual optimal value of each particle with the individual optimal values of other global particles, and updating the position of the individual with the optimal position to be the global optimal value up to the current iteration;
judging whether the maximum iteration times are reached, if so, stopping iteration; otherwise, updating the speed and the position of the particles again, and acquiring the fitness value of each particle again; cycling until the maximum iteration times are reached;
outputting the optimized control point optimal value, and adjusting the optimized control point optimal value into two-dimensional coordinates to form a new optimized control point set.
Further, fitting and generating a NURBS curve according to the node vector and the optimized optimal control point, wherein the NURBS curve specifically comprises the following steps: definition of a k-degree NURBS curve is:
wherein k represents the times of NURBS spline curves, and u is an independent variable; p (P) i (i=0, 1,., n) represents n+1 control points; omega i As the weight corresponding to the control point, the first and last weight omega 0n > 0, the rest omega i ≥0;N i,k (u) is a k-th order NURBS curve basis function satisfying the De Boor recurrence relation:
by adopting the technical scheme, the application can obtain the following technical effects:
1. the NURBS curve fitting method based on the improved second-order oscillation PSO algorithm provided by the application modifies the selection standard of the anti-curvature points and curvature extreme points, takes two types of points which can most reflect the track shape as characteristic points to replace all discrete data points, and greatly compresses the data volume on the basis of ensuring the fitting precision; when the control points are calculated reversely by the least square method, the specific number of the initial control points is not specified, and the secondary compression of the data volume is realized.
2. The application adopts the improved second-order oscillation PSO algorithm to carry out optimization adjustment, unlike genetic algorithm which must firstly convert the original problem into the optimization problem of discrete combination, and avoids discrete errors.
3. According to the application, a second-order oscillation link is added on the basis of a standard PSO algorithm, and the PSO algorithm is adjusted by adopting mutually different parameter values in the oscillation link, so that the problems that the PSO algorithm is easy to fall into local optimum and early convergence are avoided, and the accuracy and reliability of NURBS curve fitting are improved.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings that are required to be used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments described in the present application, and other drawings may be obtained according to the drawings without inventive effort to those skilled in the art.
FIG. 1 is a general flow chart of NURBS curve fitting in an embodiment of the present application;
FIG. 2 is a plot of input discrete data to be fitted in an embodiment of the present application;
FIG. 3 is a feature point diagram extracted in an embodiment of the present application;
FIG. 4 is an initial control point diagram calculated by the least squares method in an embodiment of the present application;
FIG. 5 is a graph of an optimal control point optimized by a modified second-order oscillating PSO algorithm in an embodiment of the present application;
FIG. 6 is a graph of NURBS curve fitting graphical effects formed after optimization by a modified second order oscillating PSO algorithm in an embodiment of the present application;
FIG. 7 is a graph of the effect of fitting errors resulting from NURBS curve fitting after optimization by the improved second order oscillating PSO algorithm in an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present application, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
The application provides an NURBS curve fitting method based on an improved second-order oscillation PSO algorithm, which is shown in a flow chart of FIG. 1 and comprises the following steps:
s1, acquiring discrete data points to be fitted, wherein an effect diagram of the discrete data points to be fitted is shown in FIG. 2;
s2, carrying out parameterization processing on the discrete data points;
the method can adopt a chord length parameterization method to acquire NURBS curve parameters corresponding to discrete data points, and the specific operation is as follows;
the resulting discrete data points are noted as { Q ] i I=0, 1, …, m, i.e.: there are a total of m+1 discrete data points;
let the sum of the chord lengths between two adjacent discrete points be d,
the corresponding parameters of the NURBS curve are obtained as follows:
wherein ,representing a parameter value corresponding to the i-th discrete data point; and (4) obtaining corresponding parameters of the NURBS curve by the simultaneous two formulas.
S3, taking the inflection point and the curvature extreme point as selection criteria, screening out the points which can best show the shape and the characteristics of the points from the discrete data points, and marking the points as characteristic points, wherein the characteristic points are shown in figure 3;
the feature points are expressed as m= { M i I=0, 1..s, s.ltoreq.s.ltoreq.m }, i.e. there are s+1 feature points in total;
to keep inThe integrity of the shape of the data to be fitted needs to ensure that the discrete data points at the two ends of the shape are not screened, so that the first and the last discrete data points Q are firstly selected 0 ,Q M Divided into feature points, i.e. Q 0 =M 0 ,Q m =M s. wherein ,M0 ,M s Respectively representing the first and last characteristic points;
step S3-1, firstly extracting the inflection point, which comprises the following specific steps:
step S3-1-1, solving the normal vector between each adjacent coordinate point by the following method
wherein ,Novi Representing the angle of the normal vector at the i-th point,then the normal vector value representing the i-th discrete data point to the i+1th discrete data point;
step S3-1-2, setting the reference threshold value as theta max =160°. When the normal vector included angle at the point is larger than the threshold value, the concave-convex property of the curve at the point is considered to be changed, and the curve is marked as an inflection point;
s3-2, extracting curvature extreme points, wherein the specific steps comprise:
step S3-2-1, traversing all discrete data points and calculating curvature k of each point i Average curvature k aver And a curvature maximum value k max
Step S3-2-2, to prevent the influence of potential factors such as noise, a curvature threshold k is set between the average curvature and the maximum curvature k =3k max /4;
The curvature extreme point extraction method is shown as follows:
namely: if the curvature of a certain point is not smaller than the set curvature threshold value, the certain point is considered as a curvature extreme point; if the curvature of a certain point is between the average curvature and the curvature threshold value and the curvature of the front and rear points is not greater than the average curvature, the point is also a curvature extreme point; otherwise, it is not considered as an extreme point of curvature.
Step S3-3, integrating the inflection point and the curvature extreme point to obtain a characteristic point M= { M i |i=0,1,...,s,0≤s≤m};
S4, obtaining a node vector of the NURBS curve;
based on the obtained parameter values of each discrete data point, obtaining the node vector by adopting a rounding method, wherein the specific steps are as follows; the node vector is denoted as u= [ U ] 0 ,u 1 ,...,u k ,u k+1 ,...,u n ,u n+1 ,...,u n+k+1 ]The method comprises the steps of carrying out a first treatment on the surface of the First, the front k+1 and the back k+1 node vectors are defined as 0 and 1, respectively, as shown in the following formula:
where k is the order of the NURBS curve;
the setting parameter epsilon=int (D) represents a maximum integer not greater than D, where D is a function reflecting the number correspondence between discrete data points and feature points, and the expression is:
wherein m+1 represents the number of discrete data points, and s+1 represents the number of feature points;
the expression of the node vector is obtained as follows,
wherein ε represents the maximum integer not greater than βD, β is an independent variable, and α is a specific gravity parameter between [0,1 ]; the formulas are combined to obtain a node vector U.
S5, approximating the characteristic points by a least square method, and performing back calculation to obtain initial control points, as shown in FIG. 4;
step S5-1, to prevent uncontrollable and nonlinear problems of the head and tail positions, keeping the head and tail initial control points consistent with the characteristic points, namely P 0 =M 0 =Q 0 ,P n =M s =Q m; wherein ,P0 ,P n Respectively representing the initial control points at the beginning and the end.
Step S5-2, the other n-1 initial control points approach under the least square method, and the specific steps are as follows:
step S5-2-1, taking the sum of squares of errors of corresponding points of the characteristic points and the parameter curves as an objective function, wherein the specific formula is as follows:
wherein χ represents the objective function value, M i Represents the i-th feature point, C (u i ) Then represents the corresponding value at the i-th parameter of the NURBS curve:
s5-2-2, removing points after the product of the first and last characteristic points and the basis function, and solving an approximate curve as follows; wherein ζ i Representing the value at the i-th point in the approximation curve;
ζ i =M i -N 0,k (u i )M 0 -N n,k (u i )M s
two formulas are combined to obtain:
to minimize the objective function, the n-1 initial control points are biased to 0, and are sorted to obtain:
wherein γ=1, 2,..n-1;
from this, a system of equations comprising n-1 equations is obtained:
(N T N)P=ζ
wherein N is a (s-1) × (N-1) order matrix:
ζ and P are both (n-1) x 1 order matrices:
step S5-2-3, solving the relation equation set by using Gaussian elimination method to obtain the remaining n-1 initial control points P= { (P) ix ,P iy )|i=1,2,…n-1};
Step S5-2-4, the first and last control points before integration form a control point set, thereby obtaining all initial control points P= { (P) ix ,P iy )|i=0,2,…n};
S6, constructing an initial population of the initial control point coordinates and initializing the population;
s6-1, constructing an initial population, wherein the specific steps are as follows:
step S6-1-1, initial control Point set P= { (P) ix ,P iy ) The two-dimensional coordinates of i=0, 2, … n are spread out in the form of a one-dimensional vector, denoted pop= (x) 0 ,x 1 ,...,x n ,y 0 ,y 1 ,...,y n );
Step S6-1-2, constructing an initial population POP= { POP 1 ,POP 2 ,…,POP T T is population number; individual POPs of each particle l (0 < l < = T) are each one-dimensional vector pop= (x) 0 ,x 1 ,...,x n ,y 0 ,y 1 ,...,y n ) Each element inside is respectivelyPlus [ -1,1]A random value is obtained in between;
step S6-2, initializing a particle swarm, wherein the specific steps are as follows:
step S6-2-1, initial particle group velocity: setting the initial velocity component v of each individual to be a random value within the [ -6,6] interval;
step S6-2-2, initializing the inertia factor θ=1 of the particle swarm, and learning the factor μ 1 =μ 2 =2;
Step S6-2-3, setting the maximum iteration times lambda of the particle swarm max =200;
S7, establishing an effective fitness function;
taking the square sum of errors between the characteristic points and parameters corresponding to the NURBS curve as a fitness function, namely:
wherein fit (INP i ) Represents the fitness of the ith particle group individual, M j For the j-th feature point location vector,as feature point M j Parameterized values.
S8, optimizing the position of the initial control point by utilizing an improved second-order oscillation PSO algorithm to obtain an optimized optimal control point, as shown in FIG. 5;
s8-1, acquiring fitness values of the particles of the initial population by the step S7;
step S8-2, updating the speed and the position of the particles. The velocity and location update formulas of the particles are respectively:
v j (λ+1)=θ×v j (λ)+μ 1jd -(1+σ 1jd (λ)+σ 2 φ jd (λ-1))+μ 2gd -(1+σ 3jd (λ)+σ 4 φ jd (λ-1))
φ jd (λ+1)=φ jd (λ)+v j (λ+1)
wherein ,vj (lambda+1) represents the speed of the jth particle at lambda+1 iteration, theta being the inertial factor; mu (mu) 12 As learning factors, the range of values is generally mu 1 =μ 2 ∈[0,4];σ 1234 Is [0,1]Random parameters within the interval; particle search in D-dimensional space, phi jd (λ) represents the d-th component of the j-th particle position vector in the λ -th iteration; η (eta) jd A d-th dimension component representing a j-th individual optimal solution for the particle; η (eta) gd The d-th dimension component of the globally optimal solution is represented.
S8-3, comparing the fitness value of the current position of each particle with the fitness value of the experienced position, if the current position is better, updating the individual optimal value, otherwise, not updating;
step S8-4, comparing the individual optimum value of each particle with the individual optimum values of other particles in the global state, and updating the position of the individual with the optimal position to the global optimum value eta of the current iteration g
Step S8-5, judging whether the maximum iteration number lambda is reached max =200, if yes, stopping iteration; otherwise, updating the speed and the position of the particles in the step S8-2 again, and recalculating the fitness value of each particle; cycling until the maximum iteration times are reached;
step S8-6, outputting the optimized control point optimal value P eta g =(x g0 ,x g1 ,...,x gn ,y g0 ,y g1 ,...,y gn ) And adjust it to two-dimensional coordinates to form a new optimized control point set P g =(P gi (x gi ,y gi )|i=0,1,...,n)。
And S9, fitting and generating a NURBS curve according to the node vector and the optimized optimal control point, as shown in FIG. 6. The generalization of a k-degree NURBS curve is defined as:
where k represents the number of NURBS spline curves (3 NURBS curves are the study object in this example), and u is the argument; p (P) i (i=0, 1,., n) represents n+1 control points; omega i As the weight corresponding to the control point, the first and last weight omega 0n > 0, the rest omega i ≥0;N i,k (u) is a k-th order NURBS curve basis function satisfying the De Boor recurrence relation:
it will be evident to those skilled in the art that the application is not limited to the details of the foregoing illustrative embodiments, and that the present application may be embodied in other specific forms without departing from the spirit or essential characteristics thereof. The present embodiments are, therefore, to be considered in all respects as illustrative and not restrictive, the scope of the application being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference sign in a claim should not be construed as limiting the claim concerned.
Furthermore, it should be understood that although the present disclosure describes embodiments, not every embodiment is provided with a separate embodiment, and that this description is provided for clarity only, and that the disclosure is not limited to the embodiments described in detail below, and that the embodiments described in the examples may be combined as appropriate to form other embodiments that will be apparent to those skilled in the art.

Claims (9)

1. An improved second-order oscillation PSO algorithm-based NURBS curve fitting method is characterized by comprising the following steps:
obtaining discrete data points to be fitted;
parameterizing the discrete data points;
selecting points which can most represent the shape and the characteristics of the discrete data points by taking the inflection points and the curvature extreme points as selection criteria, and marking the points as characteristic points;
obtaining a node vector of the NURBS curve;
approximating the characteristic points by a least square method, and performing back calculation to obtain initial control points;
constructing an initial population of the initial control point coordinates and initializing the population;
establishing an effective fitness function;
the position of the initial control point is optimized by utilizing an improved second-order oscillation PSO algorithm, and an optimized optimal control point is obtained, and the specific steps are as follows:
acquiring the fitness value of each particle of the initial population;
the speed and the position of the updated particles are respectively represented by the following formulas:
v j (λ+1)=θ×v j (λ)+μ 1jd -(1+σ 1jd (λ)+σ 2 φ jd (λ-1))+μ 2gd -(1+σ 3jd (λ)+σ 4 φ jd (λ-1))
φ jd (λ+1)=φ jd (λ)+v j (λ+1)
wherein ,vj (lambda+1) represents the speed of the jth particle at lambda+1 iteration; θ is an inertial factor; mu (mu) 12 As learning factors, the value range mu 1 =μ 2 ∈[0,4];σ 1234 Is [0,1]Random parameters within the interval; particle search in D-dimensional space, phi jd (λ) represents the d-th component of the j-th particle position vector in the λ -th iteration; η (eta) jd Indicating individual optimality of jth particleA d-th dimensional component of the solution; η (eta) gd Then the d-th dimension component of the globally optimal solution is represented;
comparing the fitness value of the current position of each particle with the fitness value of the experienced position, if the current position is better, updating the individual optimal value, otherwise, not updating;
comparing the individual optimal value of each particle with the individual optimal values of other global particles, and updating the position of the individual with the optimal position to be the global optimal value up to the current iteration;
judging whether the maximum iteration times are reached, if so, stopping iteration; otherwise, updating the speed and the position of the particles again, and acquiring the fitness value of each particle again; cycling until the maximum iteration times are reached;
outputting an optimized control point optimal value, and adjusting the optimal value into two-dimensional coordinates to form a new optimized control point set;
and fitting and generating a NURBS curve according to the node vector and the optimized optimal control point.
2. The NURBS curve fitting method based on the improved second order oscillating PSO algorithm according to claim 1, wherein the discrete data points are parameterized, in particular: the method adopts a chord length parameterization method to obtain NURBS curve parameters corresponding to discrete data points, and the implementation mode is as follows:
the discrete data points are noted as { Q } i I=0, 1, …, m, i.e.: there are a total of m+1 discrete data points;
let the sum of the chord lengths between two adjacent discrete points be d,
the NURBS curve parameter acquisition mode is as follows:
wherein ,representing a parameter value corresponding to the i-th discrete data point; and (4) obtaining corresponding parameters of the NURBS curve by the simultaneous two formulas.
3. The NURBS curve fitting method based on the improved second-order oscillation PSO algorithm according to claim 1, wherein the points which are most capable of representing the shape and the characteristics of the points are screened out from the discrete data points by taking the inflection points and the curvature extreme points as selection criteria, and are marked as characteristic points M, specifically:
the feature points are expressed as m= { M i I=0, 1..s, s.ltoreq.s.ltoreq.m }, i.e. there are s+1 feature points in total;
first, the first and the last discrete data points Q 0 ,Q M Divided into feature points, i.e. Q 0 =M 0 ,Q m =M s; wherein ,M0 ,M s The first and last feature points are represented respectively.
4. A NURBS curve fitting method based on an improved second-order oscillating PSO algorithm according to claim 1 or 3, wherein the method for obtaining the inflection point is as follows: solving normal vectors between adjacent coordinate points comprises the following steps:
wherein ,Novi Representing the normal vector angle at the i-th point,a normal vector representing the i-th discrete data point to the i+1th discrete data point; when the normal vector included angle at the point is larger than the set threshold value, the concave-convex property of the curve at the point is considered to be changed, and the curve is marked as an inflection point;
the curvature extreme point obtaining mode is as follows: traversing all discrete data points and obtaining curvature k of each point i Average curvature k aver And a curvature maximum value k max The method comprises the steps of carrying out a first treatment on the surface of the Setting a curvature threshold value between the average curvature and the maximum curvature, denoted as k k
The curvature extreme point extraction method is shown as follows:
k i ≥k k or
namely: if the curvature of a certain point is not smaller than the set curvature threshold value, the certain point is considered as a curvature extreme point; if the curvature of a certain point is between the average curvature and the curvature threshold value and the curvature of the front and rear points is not greater than the average curvature, the point is also a curvature extreme point; otherwise, the curvature extreme point is not generated;
feature points representing the discrete data point prototype are obtained by combining the inflection points and the curvature extreme points.
5. The NURBS curve fitting method based on the improved second-order oscillating PSO algorithm of claim 1, wherein a node vector of the NURBS curve is obtained: and obtaining a node vector by adopting a rounding method based on the parameter values corresponding to the discrete data points.
6. The NURBS curve fitting method based on the improved second-order oscillation PSO algorithm according to claim 1, wherein the feature points are approximated by a least square method, and the initial control points are obtained by back calculation, specifically: keeping the initial control point at the beginning and the end consistent with the characteristic point, namely P 0 =M 0 =Q 0 ,P n =M s =Q m; wherein ,P0 ,P n Respectively representing initial control points at the beginning and the end; in addition, n-1 initial control points approach under the least square method, and the implementation steps are as follows:
taking the sum of squares of errors of corresponding points of the characteristic points and the parameter curves as an objective function, wherein the specific formula is as follows:
where χ represents the objective function value, M i Represents the i-th feature point, C (u i ) Then represents the corresponding value of NURBS curve at the i-th parameter:
removing points after the product of the first and last characteristic points and the basis function, and solving an approximate curve as follows:
ζ i =M i -N 0,k (u i )M 0 -N n,k (u i )M s
wherein ,ζi Representing the value at the i-th point in the approximation curve;
two formulas are obtained in parallel:
to minimize the objective function, the n-1 initial control points are biased to 0, and are sorted to obtain:
wherein γ=1, 2,..n-1;
from this, a system of equations comprising n-1 equations is obtained:
(N T N)P=ζ
wherein N is a (s-1) × (N-1) order matrix:
ζ and P are both (n-1) x 1 order matrices:
solving an equation set by using a Gaussian elimination method to obtain n-1 initial control points;
and integrating the first control point and the last control point to form a control point set, so as to obtain all initial control points.
7. The NURBS curve fitting method based on the improved second order oscillating PSO algorithm of claim 1, wherein an initial population of the initial control point coordinates is constructed and population initialization is performed, specifically: expanding the two-dimensional coordinates of the obtained initial control point set into a one-dimensional vector form, and respectively adding a random value between [ -1,1] to each element in the two-dimensional vector form; initializing the particle swarm, wherein the implementation steps are as follows:
initial particle group velocity: setting the initial velocity component of each individual to be a random value within the [ -6,6] interval;
initializing the value of an inertia factor and a learning factor of a particle swarm;
the maximum iteration number of the particle swarm is set.
8. The NURBS curve fitting method based on the improved second-order oscillating PSO algorithm according to claim 1, wherein an effective fitness function is established, specifically: taking the square sum of errors between the characteristic points and corresponding parameters of the NURBS curve as a fitness function, the method is defined as follows:
wherein fit (INP i ) Represents the fitness of the ith particle group individual, M j For the j-th feature point location vector,as feature point M j Parameterized values.
9. The NURBS curve fitting method based on the improved second-order oscillation PSO algorithm according to claim 1, wherein the NURBS curve is generated by fitting according to the node vector and the optimized optimal control point, specifically: definition of a k-degree NURBS curve is:
wherein k represents the times of NURBS spline curves, and u is an independent variable; p (P) i (i=0, 1,., n) represents n+1 control points; omega i As the weight corresponding to the control point, the first and last weight omega 0n > 0, the rest omega i ≥0;N i,k (u) is a k-th order NURBS curve basis function satisfying the De Boor recurrence relation:
provision for provision of
CN202110436477.4A 2021-04-22 2021-04-22 NURBS curve fitting method based on improved second-order oscillation PSO algorithm Active CN113111405B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110436477.4A CN113111405B (en) 2021-04-22 2021-04-22 NURBS curve fitting method based on improved second-order oscillation PSO algorithm

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110436477.4A CN113111405B (en) 2021-04-22 2021-04-22 NURBS curve fitting method based on improved second-order oscillation PSO algorithm

Publications (2)

Publication Number Publication Date
CN113111405A CN113111405A (en) 2021-07-13
CN113111405B true CN113111405B (en) 2023-08-29

Family

ID=76719589

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110436477.4A Active CN113111405B (en) 2021-04-22 2021-04-22 NURBS curve fitting method based on improved second-order oscillation PSO algorithm

Country Status (1)

Country Link
CN (1) CN113111405B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107451378A (en) * 2017-09-05 2017-12-08 电子科技大学 A kind of three-dimensional coordinates measurement blade profile samples point extracting method
CN111738397A (en) * 2020-06-17 2020-10-02 江苏师范大学 NURBS curve fitting method based on genetic particle swarm optimization

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10102671B2 (en) * 2017-02-09 2018-10-16 Wisconsin Alumni Research Foundation Systems for generalizing non-uniform rational B-spline and application of systems

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107451378A (en) * 2017-09-05 2017-12-08 电子科技大学 A kind of three-dimensional coordinates measurement blade profile samples point extracting method
CN111738397A (en) * 2020-06-17 2020-10-02 江苏师范大学 NURBS curve fitting method based on genetic particle swarm optimization

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于自适应遗传算法的B样条曲线拟合的参数优化;孙越泓;魏建香;夏德深;;计算机应用(07);全文 *

Also Published As

Publication number Publication date
CN113111405A (en) 2021-07-13

Similar Documents

Publication Publication Date Title
CN110516388B (en) Harmonic mapping-based curved surface discrete point cloud model circular cutter path generation method
Hajivassiliou et al. Simulation of multivariate normal rectangle probabilities and their derivatives theoretical and computational results
CN110728219B (en) 3D face generation method based on multi-column multi-scale graph convolution neural network
Gálvez et al. A new iterative mutually coupled hybrid GA–PSO approach for curve fitting in manufacturing
CN110390638B (en) High-resolution three-dimensional voxel model reconstruction method
CN115203865B (en) Product assembly process mechanical performance online prediction method based on digital twinning
CN113052955A (en) Point cloud completion method, system and application
CN112884236B (en) Short-term load prediction method and system based on VDM decomposition and LSTM improvement
CN112578089B (en) Air pollutant concentration prediction method based on improved TCN
CN115455588A (en) Turbine blade precision casting mold surface reversible deformation design method
CN111079353A (en) Method and device for rapid and uniform grid division applied to complex fluid analysis
CN110738363A (en) photovoltaic power generation power prediction model and construction method and application thereof
CN117593204B (en) Point cloud instance segmentation method based on super-voxel adjacent clustering
CN113111405B (en) NURBS curve fitting method based on improved second-order oscillation PSO algorithm
CN113724361A (en) Single-view three-dimensional reconstruction method based on deep learning
CN112232565A (en) Two-stage time sequence prediction method, prediction system, terminal and medium
CN115859521A (en) Neural network-based milling error reconstruction method and system
CN112597649B (en) Strong and weak coupling grid-free electrostatic field numerical calculation method
Winter et al. NURBS-based shape and parameter optimization of structural components with an adaptive amount of control points
Fan et al. Arbitrary surface data patching method based on geometric convolutional neural network
CN111340291B (en) Medium-and-long-term power load combined prediction system and method based on cloud computing technology
Letov et al. Volumetric cells: A framework for a bio-inspired geometric modelling method to support heterogeneous lattice structures
CN112991402A (en) Cultural relic point cloud registration method and system based on improved differential evolution algorithm
Almasri et al. Shape related constraints aware generation of Mechanical Designs through Deep Convolutional GAN
Beielstein et al. Design of evolutionary algorithms and applications in surface reconstruction

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
GR01 Patent grant
GR01 Patent grant