Creating FrameSets with astConvert

Before considering the important subject of using FrameSets to convert between coordinate systems (§14.2), let us return briefly to reconsider the output generated by astConvertastConvert. We used this function earlier (§12), when converting between the coordinate systems represented by various kinds of FrameFrame, and indicated that it returns a FrameSetFrameSet to represent the coordinate conversion it identifies. We are now in a position to examine the structure of this FrameSet.

Take our earlier example (§12.1) of converting between the celestial coordinate systems represented by two SkyFrames:


\begin{terminalv}
...

This will produce a pointer, “cvt”, to the FrameSet shown in Figure 15.

Figure 15: The FrameSet produced when astConvert is used to convert between the coordinate systems represented by two SkyFrames. The source SkyFrameSkyFrame becomes the base Frame, while the destination SkyFrame becomes the current Frame. The MappingMapping between them implements the required conversion.
[width=0.7]sun211_figures/fsconvert

As can be seen, this FrameSet contains just two Frames. The source Frame supplied to astConvert becomes its base Frame, while the destination Frame becomes its current Frame. (The FrameSet, of course, simply holds pointers to these Frames, rather than making copies.) The Mapping which relates the base Frame to the current Frame is the one which implements the required conversion.

As we noted earlier (§12.1), the FrameSet returned by astConvert may be used both as a Mapping and as a Frame to perform most of the functions you are likely to need. However, the Mapping may be extracted for use on its own if necessary, using astGetMappingastGetMapping (§13.7), for example:


\begin{terminalv}
AstMapping *mapping;
\par
...
\par
mapping = astGetMapping( cvt, AST__BASE, AST__CURRENT );
\end{terminalv}