# Synopsis

PDX_MSGT gdx_HybridNurbSurfFit(long option, double ***pnts, int model, long npu, long npv, double **upar, double **vpar, int p_flg, double **uknots, double **vknots, int k_flg, long nucps, long nvcps, int uord, int vord, T_GDX_NURB_SURF **gdx_ns)

# Purpose

Create GDX NURB Surface by interpolation/least squares fit.

# Description

This routine does a hybrid surface fit to a mesh of point data. It uses interpolation in one direction, and least squares approximation in the other. The resulting surface approximates the given points. The four corner data points are fit precisely.

# Input

## option

### GDX_UINTERPOLATE

If set, the u-direction points are interpolated first, then the resulting control points are least squares approximated in the v-direction. The default is to interpolate first in the v-direction, then approximate in the u-direction.

## pnts

[npv][npu][3].

## 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

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.

## 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

## 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. The knots will not be returned. 0 : No values in uknots and vknots. This routine will compute the knots 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. If GDX_UINTERPOLATE is set, this value is ignored, and the value npu is used. The following inequalities must hold:

## uord

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

## nvcps

Number of v-direction control points in the fitted surface. If GDX_UINTERPOLATE is not set, this value is ignored, and the value npv is used. The following inequalities must hold:

## 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_ns

The GDX NURB Surface fitted to the data.

# Return

          GDX_NOERR
          GDX_BADDATA
          GDX_SINGULAREQS
          Low level error return
          .fi