mapCS

namespace nin {
    auto mapCS(coordsys<C1> from, coordsys<CF> to);
    auto mapCS(coordsys<C1> from, WCS_t);
    auto mapCS(WCS_t, coordsys<CF> to);
    auto mapCS(coordsys<C1> from, bridges..., coordsys<CF> to);
    auto mapCS(coordsys<C1> from, bridges..., WCS_t);
    auto mapCS(WCS_t, bridges..., coordsys<CF> to);
    void mapCS(WCS_t, WCS_t) = delete;
}

mapCS() creates a coord_tf transformation function between two coordinate systems. All template parameters are deduced from the arguments — no explicit template parameters are needed.

Without bridges

When both endpoints share the same coordsys_traits, no bridge is needed. mapCS() traverses the kinematic tree from from up to WCS, then from WCS down to to, and composes the result into a single coord_tf:

mapCS — same-space overloads

coord_tf mapCS(coordsys<CT> from, coordsys<CT> to)

(1)

coord_tf mapCS(coordsys<CT> from, WCS)

(2)

coord_tf mapCS(WCS, coordsys<CT> to)

(3)

void mapCS(WCS, WCS) = delete

(7)

  • (1) Between two coordinate systems of the same type.

  • (2) From a coordinate system to WCS.

  • (3) From WCS to a coordinate system.

  • (7) WCS to WCS is deleted — it would be a no-op identity.

With bridges

When the source and target coordinate systems live in different spaces, one or more bridges must be provided as intermediate arguments. Each bridge satisfies coordsys_bridge_traits and defines how to convert coordinates from one space to the next:

mapCS — bridge overloads

coord_tf mapCS(coordsys<C1> from, bridges…​, coordsys<CF> to)

(4)

coord_tf mapCS(coordsys<C1> from, bridges…​, WCS)

(5)

coord_tf mapCS(WCS, bridges…​, coordsys<CF> to)

(6)

  • (4) With one or more bridges between different coordinate system types.

  • (5)-(6) Bridges with WCS as one endpoint.

The traversal proceeds segment by segment: within each space, the tree is walked as usual; at each bridge, the convert() function translates the intermediate result into the next space.