coordsys_traits

namespace nin {
    template <typename CT>
    concept coordsys_traits;
}

Any space of coordinate systems must satisfy the coordsys_traits concept. A traits type defines three things: what coordinates look like, what transformations look like, and how to apply and compose those transformations. This is the extension point for defining entirely new kinds of coordinate systems — R2, R3, or any user-defined space.

Requirements

A type CT satisfies coordsys_traits if it provides:

Requirement Description

CT::quantity_type

The generalized coordinate type. Must be std::semiregular with noexcept default construction and move.

CT::tf_data_type

The transformation data type. Must be std::semiregular with noexcept default construction and move. Must be a different type from quantity_type.

CT::invert_tf(tf_data_type tf) → tf_data_type

Static function. Returns the inverse of a transformation.

CT::compose_tf(tf_data_type after, tf_data_type first) → tf_data_type

Static function. Composes two transformations so that applying the result is equivalent to applying first then after.

CT::transform_coords(tf_data_type tf, quantity_type qty) → convertible_to<quantity_type>

Static function (noexcept). Applies a transformation to coordinates and returns the transformed coordinates. The return type only needs to be convertible to quantity_type, which lets implementations return an expression-template proxy when useful.

quantity_type and tf_data_type must be distinct types to prevent accidental misuse — a transformation is not a coordinate and vice versa.

See also

For a step-by-step recipe on introducing a new coordinate space, see How to define a new coordinate-system traits type.