astQuadApprox

Obtain a quadratic approximation to a 2D Mapping

Description:

This function returns the co-efficients of a quadratic fit to the supplied Mapping over the input area specified by " lbnd" and " ubnd" . The Mapping must have 2 inputs, but may have any number of outputs. The i th Mapping output is modelled as a quadratic function of the 2 inputs (x,y):

output_i = a_i_0 + a_i_1x + a_i_2y + a_i_3xy + a_i_4xx + a_i_5yy

The " fit" array is returned holding the values of the co-efficients a_0_0, a_0_1, etc.

Synopsis

int QuadApprox( AstMapping this, const double lbnd[2], const double ubnd[2], int nx, int ny, double fit, double rms )

Parameters:

this
Pointer to the Mapping.
lbnd
Pointer to an array of doubles containing the lower bounds of a box defined within the input coordinate system of the Mapping. The number of elements in this array should equal the value of the Mapping s Nin attribute. This box should specify the region over which the fit is to be performed.
ubnd
Pointer to an array of doubles containing the upper bounds of the box specifying the region over which the fit is to be performed.
nx
The number of points to place along the first Mapping input. The first point is at " lbnd[0]" and the last is at " ubnd[0]" . If a value less than three is supplied a value of three will be used.
ny
The number of points to place along the second Mapping input. The first point is at " lbnd[1]" and the last is at " ubnd[1]" . If a value less than three is supplied a value of three will be used.
fit
Pointer to an array of doubles in which to return the co-efficients of the quadratic approximation to the specified transformation. This array should have at least " 6Nout" , elements. The first 6 elements hold the fit to the first Mapping output. The next 6 elements hold the fit to the second Mapping output, etc. So if the Mapping has 2 inputs and 2 outputs the quadratic approximation to the forward transformation is:

X_out = fit[0] + fit[1]X_in + fit[2]Y_in + fit[3]X_inY_in + fit[4]X_inX_in + fit[5]Y_inY_in Y_out = fit[6] + fit[7]X_in + fit[8]Y_in + fit[9]X_inY_in + fit[10]X_inX_in + fit[11]Y_inY_in

rms
Pointer to a double in which to return the RMS residual between the fit and the Mapping, summed over all Mapping outputs.

Returned Value

astQuadApprox()
If a quadratic approximation was created, a non-zero value is returned. Otherwise zero is returned and the fit co-efficients are set to AST__BAD.

Notes: