### astSelectorMap

Create a SelectorMap

#### Description:

This function creates a new SelectorMap and optionally initialises its attributes.

A SelectorMap is a Mapping that identifies which Region contains a given input position.

A SelectorMap encapsulates a number of Regions that all have the same number of axes and represent the same coordinate Frame. The number of inputs (Nin attribute) of the SelectorMap equals the number of axes spanned by one of the encapsulated Region. All SelectorMaps have only a single output. SelectorMaps do not define an inverse transformation.

For each input position, the forward transformation of a SelectorMap searches through the encapsulated Regions (in the order supplied when the SelectorMap was created) until a Region is found which contains the input position. The index associated with this Region is returned as the SelectorMap output value (the index value is the position of the Region within the list of Regions supplied when the SelectorMap was created, starting at 1 for the first Region). If an input position is not contained within any Region, a value of zero is returned by the forward transformation.

If a compound Mapping contains a SelectorMap in series with its own inverse, the combination of the two adjacent SelectorMaps will be replaced by a UnitMap when the compound Mapping is simplified using astSimplify.

In practice, SelectorMaps are often used in conjunction with SwitchMaps.

#### Synopsis

AstSelectorMap $\ast$astSelectorMap( int nreg, AstRegion $\ast$regs[], double badval, const char $\ast$options, ... )

#### Parameters:

##### nreg
The number of supplied Regions.
##### regs
An array of pointers to the Regions. All the supplied Regions must relate to the same coordinate Frame. The number of axes in this coordinate Frame defines the number of inputs for the SelectorMap.
##### badval
The value to be returned by the forward transformation of the SelectorMap for any input positions that have a bad (AST__BAD) value on any axis.
##### options
Pointer to a null-terminated string containing an optional comma-separated list of attribute assignments to be used for initialising the new SelectorMap. The syntax used is identical to that for the astSet function and may include " printf" format specifiers identified by " %" symbols in the normal way.
##### ...
If the " options" string contains " %" format specifiers, then an optional list of additional arguments may follow it in order to supply values to be substituted for these specifiers. The rules for supplying these are identical to those for the astSet function (and for the C " printf" function).

#### Returned Value

##### astSelectorMap()
A pointer to the new SelectorMap.

#### Notes:

• Deep copies are taken of the supplied Regions. This means that any subsequent changes made to the component Regions using the supplied pointers will have no effect on the SelectorMap.

• A null Object pointer (AST__NULL) will be returned if this function is invoked with the AST error status set, or if it should fail for any reason.