We now consider the process of converting between the coordinate
systems represented by two FrameSets. This is a most important
operation, as a subsequent example ()
will show, and is illustrated in the Figure below.
Recalling (
Figure: Conversion between two FrameSets is performed by establishing a link between a pair of Frames, one from each FrameSet. If conversion between these two Frames is possible, then a route for converting between the current Frames of both FrameSets can also be found. In practice, there may be many ways of pairing Frames to find the ``missing link'', so the Frames' Domain attribute may be used to narrow the choice.
INTEGER FRAMESETA, FRAMESETB
...
CVT = AST_CONVERT( FRAMESETA, FRAMESETB, 'SKY', STATUS )
When using FrameSets, we are presented with considerably more
conversion options than when using Frames alone. This is because each
current Frame is related to all the other Frames in its respective
FrameSet. Therefore, if we can establish a link between any pair of
Frames, one from each FrameSet, we can form a complete conversion path
between the two current Frames (Figure ).
This expanded range of options is, of course, precisely the
intention. By connecting Frames together within a FrameSet, we have
extended the range of coordinate systems that can be reached from any
one of them. We are therefore no longer restricted to converting
between Frames with the same Domain value (),
but can go via a range of intermediate coordinate systems in
order to make the connection we require. Transformation between
different domains has therefore become possible because, in assembling
the FrameSets, we provided the additional information needed to
inter-relate them.
It is important to appreciate, however, that the choice of ``missing link'' is crucial in determining the conversion that results. Although each FrameSet may be perfectly self-consistent internally, this does not mean that all conversion paths through the combined network of Mappings are equivalent. Quite the contrary in fact: everything depends on where the inter-connecting link between the two FrameSets is made. In practice, there may be a large number of possible pairings of Frames and hence of possible links. Other factors must therefore be used to restrict the choice. These are:
In the example above we supplied the string ``SKY'' as the third argument of AST_CONVERT. This constitutes a request that a pair of Frames with the Domain value SKY (i.e. representing celestial coordinate systems) should be used to inter-relate the two FrameSets. Note that this does not specify which celestial coordinate system to use, but is a general request that the two FrameSets be inter-related using coordinates on the celestial sphere.
Of course, it may be that this request cannot be met because there may not be a celestial coordinate system in both FrameSets. If this is likely to happen, we can supply a list of preferences, or a domain search path, as the third argument to AST_CONVERT, such as the following:
CVT = AST_CONVERT( FRAMESETA, FRAMESETB, 'SKY,PIXEL,GRID,', STATUS )
Now, if the two FrameSets cannot be inter-related using the SKY domain, AST_CONVERT will attempt to use the PIXEL domain instead. If this also fails, it will try the GRID domain. A blank field in the domain search path (here indicated by the final comma) allows any Domain value to be used. This can be employed as a last resort when all else has failed.
If astConvert succeeds in identifying a conversion, it will return a
pointer to a FrameSet () in which the
source and destination Frames are inter-connected by the required
Mapping. In this case, of course, these Frames will be the current
Frames of the two FrameSets, but in all other respects the returned
FrameSet is the same as when converting between Frames.
Very importantly, however, AST_CONVERT may modify the FrameSets you
are converting between. It does this, in order to indicate which
pairing of Frames was used to inter-relate them, by changing the Base
attribute for each FrameSet so that the Frame used in the pairing
becomes its base Frame ().
Finally, note that AST_CONVERT may also be used to convert between a FrameSet and a Frame, or vice versa. If a pointer to a Frame is supplied for either the first or second argument, it will behave like a FrameSet containing only a single Frame.
AST A Library for Handling World Coordinate Systems in Astronomy