You may use a pointer to a FrameSet, such as we read in , to transform a set of points between the pixel coordinates of an image and the associated world coordinates. If you are working in two dimensions, proceed as follows:
double xpixel[ N ], ypixel[ N ]; double xworld[ N ], yworld[ N ]; ... astTran2( wcsinfo, N, xpixel, ypixel, 1, xworld, yworld );
Here, N is the number of points to be transformed, ``xpixel'' and ``ypixel'' hold the pixel coordinates, and ``xworld'' and ``yworld'' receive the returned world coordinates.5 To transform in the opposite direction, interchange the two pairs of arrays (so that the world coordinates are given as input) and change the fifth argument of astTran2 to zero.
To transform points in one dimension, use astTran1. In any other number of dimensions (or if the number of dimensions is initially unknown), use astTranN or astTranP. These functions are described in .
For more information about transforming coordinates, see
and . For
details of how to handle missing coordinates, see
AST A Library for Handling World Coordinate Systems in Astronomy