Synopsis
PDX_MSGT gdx_LeastSquaresNurbCurve(long option, double inpts[], int np, int nci, double **par, int p_flg, double **knots, int k_flg, double ders[], int nt, int ncps, int order, double toler, int model, T_GDX_NURB_CURVE **gdx_cur)
Purpose
Create GDX NURB Curve by least squares fit of point data.
Description
This routine does a least squares curve fit to point data. The curve is constrained to interpolate the first and last data points. First derivative vectors may (optionally) also be specified at the two endpoints; in this case, they will be precisely interpolated. The point data may be either 2D or 3D.
Input
option
Not used.
inpts
Data points to be fitted (2 or 3 coordinates per point).
np
Number of points in the array, pts (and par).
nci
Number of coordinates per point (2 or 3).
par
The parameter values at which the data points in array, inpts, are assumed (see p_flg).
p_flg
A flag: -1 : No values in par. This routine will compute the par values and discard them before returning. (Uses normalized relative chord length method). 0 : No values in par. This routine will compute the par values and return them in the array par. (Normalized relative chord length). The memory for array par will be allocated in this routine. 1 : The parameter values are in par.
knots
The knot vector (see k_flg).
k_flg
A flag: -1 : No values in knots. This routine will compute the knots (equally spaced). The knots will not be returned. 0 : No values in knots. This routine will compute the knots (equally spaced) and return them in the array knots. Memory allocated in this routine. 1 : The knots are in array knots.
ders
First derivative vectors at the endpoints (see nt). May be 2D or 3D (see nci).
nt
Flag, specifying the content of the array, ders: 0 : No derivatives in ders. 1 : Derivative at start point only. -1 : Derivative at end point only. 2 : Derivative at both ends.
ncps
Number of control points to use for the curve fit. The following inequality must hold: order <= ncps < np-abs(nt)-4.
order
Order of the b-spline curve.
toler
The tolerance for determining if values are the same
model
The GDX model for entity creation
Output
par
(if p_flg == 0).
knots
(if k_flg == 0).
gdx_cur
The GDX NURB Curve fitted to the data.
Return
GDX_NOERR
GDX_BADDATA (order<=ncps<np-abs(nt)-4 not true )
GDX_SINGULAREQS (singular system of equations)
GDX_COINPNTS (coincident data points)
Low level error return
.fi