A CmpMap is a compound Mapping which allows two component Mappings (of any class) to be
connected together to form a more complex Mapping. This connection may either be "
in series"
(where the first Mapping is used to transform the coordinates of each point and the second mapping is
then applied to the result), or "
in parallel"
(where one Mapping transforms the earlier
coordinates for each point and the second Mapping simultaneously transforms the later
coordinates).
Since a CmpMap is itself a Mapping, it can be used as a component in forming further CmpMaps. Mappings of arbitrary complexity may be built from simple individual Mappings in this way.
If the component Mappings are connected in series, then using the resulting CmpMap to transform coordinates will cause the first Mapping to be applied, followed by the second Mapping. If the inverse CmpMap transformation is requested, the two component Mappings will be applied in both the reverse order and the reverse direction.
When connecting two component Mappings in series, the number of output coordinates generated by the first Mapping (its Nout attribute) must equal the number of input coordinates accepted by the second Mapping (its Nin attribute).
If the component Mappings of a CmpMap are connected in parallel, then the first Mapping will be used to transform the earlier input coordinates for each point (and to produce the earlier output coordinates) and the second Mapping will be used simultaneously to transform the remaining input coordinates (to produce the remaining output coordinates for each point). If the inverse transformation is requested, each Mapping will still be applied to the same coordinates, but in the reverse direction.
When connecting two component Mappings in parallel, there is no restriction on the number of input and output coordinates for each Mapping.
Note that the component Mappings supplied are not copied by AST_CMPMAP (the new CmpMap simply retains a reference to them). They may continue to be used for other purposes, but should not be deleted. If a CmpMap containing a copy of its component Mappings is required, then a copy of the CmpMap should be made using AST_COPY.
A null Object pointer (AST__NULL) will be returned if this function is invoked with STATUS set to an error value, or if it should fail for any reason.