# function transcoords

Transform a set of coordinates from one image to another. The coordinate transformation matrix is described by a first order polynomial if the number of reference sources is <= 6, else a second order polynomial is used. The transformation function will be calculated using a least squares fit to given coordinates. Note that if either in REFSTARS or in IMSTARS a coordinate is exactly (-1, -1), this star will not be used to calculate the transformation matrix.
**Syntax**

*result* = transcoords(MASTERLIST, REFSTARS, IMSTARS [, xerror, yerror][, /silent] [, /linear] [, /cubic] [, /rotation])
**Arguments**

MASTERLIST: | A matrix 2xn with the coordinates to be transformed |

REFSTARS: | A matrix 2xm (m >= 3) with positions of the reference stars in the reference frame (= masterlist) |

IMSTARS: | A matrix 2xm (same size as REFSTARS) with the positions of the same stars in the image to be transformed. |

xerror: | If set to a named variable, the residual error of the coordinate transform in the first axis is returned. |

yerror: | If set to a named variable, the residual error of the coordinate transform in the second axis is returned. |

**Switches**

/silent: | Printing of output is suppressed |

/linear: | A 1st order polynomial is fitted (even when more than 6 reference sources are supplied) |

/cubic: | A 3rd order polynomial is fitted (at least 10 reference sources) |

/rotation: | A rotational transformation is fitted (at least 4 reference sources): x' = x0 + f*cos(a)*x - f*sin(a)*y, y' = y0 + f*sin(a)*x + f*cos(a)*y |

**See also**

function transmatrix

function transform