next up previous
Next: Converting between FrameSet Coordinate Systems
Up: Higher Level Operations on FrameSets
Previous: Higher Level Operations on FrameSets

Creating FrameSets with astConvert  

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

Take our earlier example ([*]) of converting between the celestial coordinate systems represented by two SkyFrames:

#include "ast.h"
AstFrameSet *cvt;
AstSkyFrame *skyframe1, *skyframe2;

...

skyframe1 = astSkyFrame( "System=FK4-NO-E, Epoch=B1958, Equinox=B1960" );
skyframe2 = astSkyFrame( "System=Ecliptic, Equinox=J2010.5" );

cvt = astConvert( skyframe1, skyframe2, "" );

This will produce a pointer, ``cvt'', to the FrameSet shown in the Figure below.


  
Figure: The FrameSet produced when astConvert is used to convert between the coordinate systems represented by two SkyFrames. The source SkyFrame becomes the base Frame, while the destination SkyFrame becomes the current Frame. The Mapping between them implements the required conversion.
\begin{figure}
\includegraphics [scale=1.0]{sun211_figures/fsconvert.eps}

 \end{figure}

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 ([*]), 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 astGetMapping ([*]), for example:

AstMapping *mapping;

...

mapping = astGetMapping( cvt, AST__BASE, AST__CURRENT );


next up previous
Next: Converting between FrameSet Coordinate Systems
Up: Higher Level Operations on FrameSets
Previous: Higher Level Operations on FrameSets

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

Copyright (C) 2003 Central Laboratory of the Research Councils