next up previous 264
Next: Adapting a Transformation Function to Individual IntraMaps
Up: Creating Your Own Private Mappings (IntraMaps)
Previous: Restricted Implementations of Transformation Functions


Variable Numbers of Coordinates

In our earlier examples, we have used a fixed number of input and output coordinates when registering a coordinate transformation function. It is not necessary to impose this restriction, however, if the transformation function can cope with a variable number of coordinates (as with the example in [*]). We indicate the acceptability of a variable number when registering the transformation function by supplying the value AST__ANY for the number of input and/or output coordinates, as follows:

astIntraReg( "SqrTran", AST__ANY, AST__ANY, SqrTran, 0,
             purpose, author, contact );

The result is that an IntraMap may now be created with any number of input and output coordinates. For example:

AstIntraMap *intramap1, *intramap2;

...

intramap1 = astIntraMap( "SqrTran", 1, 1, "" );
intramap2 = astIntraMap( "SqrTran", 3, 3, "Invert=1" );

It is possible to fix either the number of input or output coordinates (by supplying an explicit number to astIntraReg), but more subtle restrictions on the number of coordinates, such as requiring that Nin and Nout be equal, are not supported. This means that:

intramap = astIntraMap( "SqrTran", 1, 2, "" );

will be accepted without error, although the transformation function cannot actually handle such a combination sensibly. If this is important, it would be worth adding a check within the transformation function itself, so that the error would be detected when it came to be used.


next up previous 264
Next: Adapting a Transformation Function to Individual IntraMaps
Up: Creating Your Own Private Mappings (IntraMaps)
Previous: Restricted Implementations of Transformation Functions

AST A Library for Handling World Coordinate Systems in Astronomy
Starlink User Note 211
R.F. Warren-Smith & D.S. Berry
24th May 2011
E-mail:ussc@star.rl.ac.uk

Copyright (C) 2009 Science \& Technology Facilities Council