coord_cloud

namespace nin {
    template <coordsys_traits CT, size_t N = std::dynamic_extent>
    class coord_cloud;
}

A coord_cloud is a collection of coordinate quantities that all belong to the same coordinate system. It is the batch counterpart of coord_value: instead of wrapping a single quantity, it wraps a container of them.

When N is a compile-time constant, the storage is std::array<quantity_type, N> (fixed size, stack-allocated). When N is std::dynamic_extent (the default), the storage is std::vector<quantity_type> (dynamic size, heap-allocated).

Transforming a cloud applies the same coord_tf to every element in a single call, which is more efficient than transforming each coord_value individually because the transformation is computed once and applied to all elements.

Nested types

Type Definition

coordsys_traits

CT

quantity_type

CT::quantity_type

container_type

std::array<quantity_type, N> or std::vector<quantity_type>

Member functions

(Constructor)

constructs a coordinate cloud

coord_cloud()

(1)

coord_cloud(coord_cloud const& copy)

(2)

coord_cloud(coord_cloud && move)

(3)

coord_cloud(container_type const& qties)

(4)

coord_cloud(coordsys<CT> cs, container_type qties = {})

(5)

coord_cloud(WCS_t, container_type qties = {})

(6)

coord_cloud(coordsys<CT> cs, coord_cloud values)

(7)

coord_cloud(WCS_t, coord_cloud values)

(8)

  • (1) Default constructor. Empty for dynamic clouds, N default elements for fixed.

  • (2)-(3) Copy and move.

  • (4) Constructs in WCS from a container of quantities.

  • (5)-(6) Constructs in a given coordinate system (or WCS).

  • (7)-(8) Transforms an existing cloud into a different coordinate system.

inCS

associated coordinate system

coordsys<CT> const& inCS() const

(1)

Returns the coordinate system this cloud is expressed in.

qty

access the raw container

container_type const& qty() const

(1)

container_type & qty()

(2)

  • (1) Returns a const reference to the underlying container.

  • (2) Returns a mutable reference.

map_to

transform to another coordinate system

auto map_to(bridges_and_target…​) const

(1)

Returns a new coord_cloud in the target coordinate system. Accepts a coordsys, WCS, or a chain of bridges followed by a target.