Synopsis

PDX_MSGT gdx_LeastSquaresNurbSurf(long option, double pts[], int model, int npu, int npv, double **upar, double **vpar, int p_flg, double **uknots, double **vknots, int k_flg, int nucps, int nvcps, int uord, int vord, T_GDX_NURB_SURF **gdx_sur)

Purpose

Create GDX NURB Surface by least squares fit of point data.

Description

This routine does a least squares surface fit to a mesh of point data. The surface is constrained to interpolate the four corner data points precisely.

Input

option

Not used.

pts

The rectangular mesh of data points to be fitted. The array is accessed as 1-dimensional, but in the index order: pts[npv][npu][3] (rightmost index varies the fastest).

model

The GDX model for entity creation.

npu

Number of data points in the u-direction.

npv

Number of data points in the v-direction.

upar

The u-direction parameter values (npu of them). See p_flg.

vpar

The v-direction parameter values (npv of them). See p_flg.

p_flg

A flag: -1 : No values in upar and vpar. This routine will compute the upar and vpar values and discard them before returning. Uses averaging of the normalized relative chord lengths. 0 : No values in upar and vpar. This routine will compute them and return them in the arrays upar and vpar. Uses averaging of the normalized relative chord lengths. The memory for arrays upar and vpar will be allocated in this routine. 1 : The parameter values are in upar and vpar.

uknots

The u-knot vector (see k_flg).

vknots

The v-knot vector (see k_flg).

k_flg

A flag: -1 : No values in uknots and vknots. This routine will compute the knots (equally spaced). The knots will not be returned. 0 : No values in uknots and vknots. This routine will compute the knots (equally spaced) and return them in the arrays uknots and vknots. Memory allocated in this routine. 1 : The knots are in arrays uknots and vknots.

nucps

Number of u-direction control points in the fitted surface. The following inequality must hold: uord <= nucps < npu-4.

nvcps

Number of v-direction control points in the fitted surface. The following inequality must hold: vord <= nvcps < npv-4.

uord

Order of the b-spline surface in the u-direction.

vord

Order of the b-spline surface in the v-direction.

Output

upar

(if p_flg == 0).

vpar

(if p_flg == 0).

uknots

(if k_flg == 0).

vknots

(if k_flg == 0).

gdx_sur

The GDX NURB Surface fitted to the data.

Return

      GDX_NOERR
      GDX_BADDATA  (uord<=nucps<npu-4 or vord<=nvcps<npv-4 not true )
      GDX_SINGULAREQS  (singular system of equations)
      Low level error return
      .fi