next up previous
Next: Using a FrameSet as a Frame
Up: Coordinate System Networks (FrameSets)
Previous: Using a FrameSet as a Mapping

Extracting a Mapping from a FrameSet  

Although it is very convenient to use a FrameSet when a Mapping is required ([*]), a FrameSet necessarily contains additional information and sometimes this might cause inefficiency or confusion. For example, if you wanted to use a Mapping contained in one FrameSet and insert it into another, it would probably not be efficient to insert the whole of the first FrameSet into the second one, although it would work.

In such a situation, the AST_GETMAPPING function allows you to extract a Mapping from a FrameSet. You do this by specifying the two Frames which the Mapping should inter-relate using their indices within the FrameSet. For example:

      MAP = AST_GETMAPPING( FRAMESET, 2, 3, STATUS )

would return a pointer to a Mapping that converted between Frames 2 and 3 in the FrameSet. Its inverse transformation would then convert in the opposite direction, i.e. between Frames 3 and 2. Note that this Mapping might not be independent of the Mappings contained within the FrameSet--i.e. they may share sub-Objects--so AST_COPY should be used to make a copy if you need to guarantee independence ([*]).

Very often, the Mapping returned by AST_GETMAPPING will be a compound Mapping, or CmpMap ([*]). This reflects the fact that conversion between the two Frames may need to be done via an intermediate coordinate system so that several stages may be involved. You can, however, easily simplify this Mapping (where this is possible) by using the AST_SIMPLIFY function ([*]) and this is recommended if you plan to use it for transforming a large amount of data.



next up previous
Next: Using a FrameSet as a Frame
Up: Coordinate System Networks (FrameSets)
Previous: Using a FrameSet as a Mapping

AST A Library for Handling World Coordinate Systems in Astronomy
Starlink User Note 210
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