You may use a pointer to a FrameSetFrameSet, such as we read in §3.4, 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:
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. 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
astTran2astTran2 to zero.
To transform points in one dimension, use astTran1astTran1. In any other number of dimensions (or if the number of dimensions is initially unknown), use astTranNastTranN or astTranPastTranP. These functions are described in Appendix B.
For more information about transforming coordinates, see §4.8 and §13.6. For details of how to handle missing coordinates, see §5.9.