OpenKalman
Classes | Static Public Attributes | List of all members
OpenKalman::interface::detail::PolarBase< T, Min, Max, d_i, a_i, d2_i, x_i, y_i > Struct Template Reference

Static Public Attributes

static constexpr bool is_specialized = true
 
static constexpr auto dimension = [](const T&) { return std::integral_constant<std::size_t, 2>{}; }
 
static constexpr auto stat_dimension = [](const T&) { return std::integral_constant<std::size_t, 3>{}; }
 
static constexpr auto is_euclidean = [](const T&) { return std::false_type{}; }
 
static constexpr auto hash_code
 
static constexpr auto to_stat_space
 Maps a polar coordinate to coordinates in Euclidean space. More...
 
static constexpr auto from_stat_space
 Maps a coordinate in Euclidean space to an element. More...
 
static constexpr auto wrap
 Perform modular wrapping of polar coordinates. More...
 

Member Data Documentation

◆ from_stat_space

template<typename T, typename Min, typename Max, std::size_t d_i, std::size_t a_i, std::size_t d2_i, std::size_t x_i, std::size_t y_i>
constexpr auto OpenKalman::interface::detail::PolarBase< T, Min, Max, d_i, a_i, d2_i, x_i, y_i >::from_stat_space
static
Initial value:
= [](const T&, auto&& data_view)
{
decltype(auto) d = collections::get<d2_i>(std::forward<decltype(data_view)>(data_view));
decltype(auto) x = collections::get<x_i>(std::forward<decltype(data_view)>(data_view));
decltype(auto) y = collections::get<y_i>(std::forward<decltype(data_view)>(data_view));
using R = values::real_type_of_t<values::real_type_of_t<collections::common_collection_type_t<decltype(data_view)>>>;
if constexpr (min == -stdex::numbers::pi_v<R> and max == stdex::numbers::pi_v<R>)
{
return make_ordered_range(std::forward<decltype(d)>(d), values::atan2(std::forward<decltype(y)>(y), std::forward<decltype(x)>(x)));
}
else
{
constexpr auto period = values::cast_to<R>(values::operation(std::minus{}, Max{}, Min{}));
constexpr auto scale = values::operation(std::divides{}, period, values::fixed_2pi<R>{});
auto phi = values::operation(std::multiplies{}, values::atan2(std::forward<decltype(y)>(y), std::forward<decltype(x)>(x)), scale);
return make_ordered_range(std::forward<decltype(d)>(d),
values::internal::update_real_part(std::move(phi), values::operation(wrap_phi{}, values::real(phi))));
}
}

Maps a coordinate in Euclidean space to an element.

This function takes x, y, and z Cartesian coordinates representing a location on a unit half-cylinder, and converts them to polar coordinates.

Note
Although this performs bounds checking on the angle, it does not check to ensure the distance is positive.

◆ hash_code

template<typename T, typename Min, typename Max, std::size_t d_i, std::size_t a_i, std::size_t d2_i, std::size_t x_i, std::size_t y_i>
constexpr auto OpenKalman::interface::detail::PolarBase< T, Min, Max, d_i, a_i, d2_i, x_i, y_i >::hash_code
static
Initial value:
= [](const T&)
{
constexpr auto a = coordinates::internal::get_descriptor_hash_code(coordinates::Angle<Min, Max>{});
constexpr auto bits = std::numeric_limits<std::size_t>::digits;
if constexpr (bits < 32)
return std::integral_constant<std::size_t, a - 0x97C1_uz + d_i * 0x1000_uz>{};
else if constexpr (bits < 64)
return std::integral_constant<std::size_t, a - 0x97C195FE_uz + d_i * 0x10000000_uz>{};
else
return std::integral_constant<std::size_t, a - 0x97C195FEC488C0BC_uz + d_i * 0x1000000000000000_uz>{};
}

◆ to_stat_space

template<typename T, typename Min, typename Max, std::size_t d_i, std::size_t a_i, std::size_t d2_i, std::size_t x_i, std::size_t y_i>
constexpr auto OpenKalman::interface::detail::PolarBase< T, Min, Max, d_i, a_i, d2_i, x_i, y_i >::to_stat_space
static

Maps a polar coordinate to coordinates in Euclidean space.

This function takes a set of polar coordinates and converts them to x, y, and z Cartesian coordinates representing a location on a unit half-cylinder (z is the long axis).

◆ wrap

template<typename T, typename Min, typename Max, std::size_t d_i, std::size_t a_i, std::size_t d2_i, std::size_t x_i, std::size_t y_i>
constexpr auto OpenKalman::interface::detail::PolarBase< T, Min, Max, d_i, a_i, d2_i, x_i, y_i >::wrap
static
Initial value:
= [](const T&, auto&& data_view)
{
decltype(auto) d = collections::get<d_i>(std::forward<decltype(data_view)>(data_view));
decltype(auto) phi = collections::get<a_i>(std::forward<decltype(data_view)>(data_view));
auto d_real = values::real(values::real(d));
auto phi_real = values::real(values::real(phi));
return make_ordered_range(
values::internal::update_real_part(std::forward<decltype(d)>(d), values::abs(d_real)),
values::internal::update_real_part(std::forward<decltype(phi)>(phi), values::operation(wrap_phi_mod{}, std::move(d_real), std::move(phi_real))));
}

Perform modular wrapping of polar coordinates.

The wrapping operation is equivalent to mapping to, and then back from, Euclidean space.


The documentation for this struct was generated from the following file: