Example—the UnitMap

The UnitMapUnitMap is the simplest of Mappings. It is a null MappingMapping. Its purpose is simply to copy coordinate values, unaltered, from its input to its output and vice versa.

A UnitMap has no additional attributes beyond those of a basic Mapping. Its NinNin and NoutNout attributes are always equal and are specified by the first argument supplied to its constructor. For example:


\begin{terminalv}
AstUnitMap *unitmap;
\par
...
\par
unitmap = astUnitMap( 2, '''' );
\end{terminalv}

will create a UnitMap that copies 2-dimensional coordinates. Inverting a UnitMap has no effect beyond changing the value of its InvertInvert attribute.

The main use of a UnitMap is to allow a Mapping to be supplied when one is required (as an argument to a function, for example) but you wish it to leave coordinate values unchanged.