Having written your coordinate transformation function, the next step is to register it with AST. Registration is performed using astIntraReg, as follows:
void SqrTran( AstMapping *, int, int, const double *[], int, int, double *[] ); const char *author, *contact, *purpose; ... purpose = "Square each coordinate value"; author = "R.F. Warren-Smith & D.S. Berry"; contact = "http://www.starlink.ac.uk/cgi-bin/htxserver/sun211.htx/?xref_SqrTran"; astIntraReg( "SqrTran", 2, 2, SqrTran, 0, purpose, author, contact );
Note that you should also provide a function prototype to describe the transformation function (the implementation of the function itself would suffice, of course).
The first argument to astIntraReg is a name by which the transformation function will be known. This will be used when we come to create an IntraMap and is case sensitive. We recommend that you use the actual function name here and make this sufficiently unusual that it is unlikely to clash with any other functions in most people's software.
The next two arguments specify the number of input and output
coordinates which the transformation function will handle. These
correspond with the Nin and Nout attributes of the IntraMap we will
create. Here, we have set them both to 2, which means that we will
only be able to create IntraMaps with 2 input and 2 output coordinates
(despite the fact that the transformation function can actually handle
other dimensionalities). We will see later
() how to remove this
restriction.
The fourth argument should contain a set of flags which describe the
transformation function in a little more detail. We will return to
this shortly ( &
). For now, we supply a value of zero.
The remaining arguments are character strings which document the
transformation function, mainly for the benefit of anyone who is
unfortunate enough to encounter a reference to it in their data which
they cannot interpret. As explained above
(), you should try and avoid this, but
accidents will happen, so you should always provide strings containing
the following:
The idea is that anyone finding an IntraMap in their data, but lacking
the necessary transformation function, should be able to contact the
author and make a sensible enquiry in order to obtain it. If you
expect many enquiries, you may like to set up a World Wide Web page
and use that instead (in the example above, we use the WWW address of
the relevant part of this document).
AST A Library for Handling World Coordinate Systems in Astronomy