Because a CmpMap is itself a Mapping, any existing CmpMap can substitute () as a component Mapping when constructing a new CmpMap using astCmpMap. This has the effect of nesting one CmpMap inside another and opens up many new possibilities. For example, combining three Mappings in series can be accomplished as follows:
AstMapping *map1, *map2, *map3; ... cmpmap = astCmpMap( map1, astCmpMap( map2, map3, 1, "" ), 1, "" );
The way in which the individual component Mappings are grouped within the nested CmpMaps is not usually important.
A similar technique can be used to combine multiple Mappings in parallel and, of course, mixed series and parallel combinations are also possible (Figure ). There is no built-in limit to how many CmpMaps may be nested in this way, so this mechanism provides an indefinitely extensible method of building complex Mappings out of the elemental building blocks provided by AST.
In practice, you might not need to construct such complex CmpMaps
yourself very frequently, but they will often be returned by AST
routines. Nested CmpMaps underlie the library's entire ability to
represent a wide range of different coordinate transformations.
AST A Library for Handling World Coordinate Systems in Astronomy