slaFitxy -

SYNOPSYS

void slaFitxy(itype, np, xye)

PARAMETERS

int itype
int np
double ( *xye

DESCRIPTION


  Fit a linear model to relate two sets of [x,y] coordinates.

Given

     itype    int            type of model: 4 or 6 (note 1)
     np       int            number of samples (note 2)
     xye      double[np][2]  expected [x,y] for each sample
     xym      double[np][2]  measured [x,y] for each sample

Returned

     coeffs   double[6]      coefficients of model (note 3)
     *j       int            status:  0 = OK
                                     -1 = illegal itype
                                     -2 = insufficient data
                                     -3 = singular solution

Notes


    1)  itype, which must be either 4 or 6, selects the type of model
        fitted.  Both allowed itype values produce a model coeffs which
        consists of six coefficients, namely the zero points and, for
        each of xe and ye, the coefficient of xm and ym.  For itype=6,
        all six coefficients are independent, modelling squash and shear
        as well as origin, scale, and orientation.  However, itype=4
        selects the "solid body rotation" option;  the model coeffs
        still consists of the same six coefficients, but now two of
        them are used twice (appropriately signed).  Origin, scale
        and orientation are still modelled, but not squash or shear -
        the units of x and y have to be the same.

    2)  For nc=4, np must be at least 2.  For nc=6, np must be at
        least 3.

    3)  The model is returned in the array coeffs.  Naming the
elements of coeffs as follows

                    coeffs[0] = a
                    coeffs[1] = b
                    coeffs[2] = c
                    coeffs[3] = d
                    coeffs[4] = e
                    coeffs[5] = f

The model is

              xe = a + b*xm + c*ym
              ye = d + e*xm + f*ym

        For the "solid body rotation" option (itype=4), the
        magnitudes of b and f, and of c and e, are equal.  The
        signs of these coefficients depend on whether there is a
        sign reversal between xe,ye and xm,ym.  Fits are performed
        with and without a sign reversal and the best one chosen.

    4)  Error status values j=-1 and -2 leave coeffs unchanged;
        If j=-3 coeffs may have been changed.

  See also slaPxy, slaInvf, slaXy2xy, slaDcmpf

Called

 slaDmat, slaDmxv

  P.T.Wallace   Starlink   31 October 1993

SEE ALSO