OpenKalman
wrap_angles.hpp
Go to the documentation of this file.
1 /* This file is part of OpenKalman, a header-only C++ library for
2  * Kalman filters and other recursive filters.
3  *
4  * Copyright (c) 2022-2024 Christopher Lee Ogden <ogden@gatech.edu>
5  *
6  * This Source Code Form is subject to the terms of the Mozilla Public
7  * License, v. 2.0. If a copy of the MPL was not distributed with this
8  * file, You can obtain one at https://mozilla.org/MPL/2.0/.
9  */
10 
16 #ifndef OPENKALMAN_WRAP_ANGLES_HPP
17 #define OPENKALMAN_WRAP_ANGLES_HPP
18 
19 namespace OpenKalman
20 {
21 #ifdef __cpp_concepts
22  template<indexible Arg>
23  constexpr indexible decltype(auto)
24 #else
25  template<typename Arg, std::enable_if_t<indexible<Arg>, int> = 0>
26  constexpr decltype(auto)
27 #endif
28  wrap_angles(Arg&& arg)
29  {
30  if constexpr (coordinates::euclidean_pattern<vector_space_descriptor_of_t<Arg, 0>> or identity_matrix<Arg> or zero<Arg>)
31  {
32  return std::forward<Arg>(arg);
33  }
34  else if constexpr (interface::wrap_angles_defined_for<Arg, Arg&&>)
35  {
36  return interface::library_interface<std::decay_t<Arg>>::wrap_angles(std::forward<Arg>(arg), get_vector_space_descriptor<0>(arg));
37  }
38  else
39  {
40  return from_euclidean(to_euclidean(std::forward<Arg>(arg)), get_vector_space_descriptor<0>(arg));
41  }
42  }
43 
44 
45 } // namespace OpenKalman
46 
47 #endif //OPENKALMAN_WRAP_ANGLES_HPP
decltype(auto) constexpr from_euclidean(Arg &&arg, const V &v)
Project the Euclidean vector space associated with index 0 to coordinates::pattern v after applying d...
Definition: from_euclidean.hpp:35
constexpr bool indexible
T is a generalized tensor type.
Definition: indexible.hpp:32
The root namespace for OpenKalman.
Definition: basics.hpp:34
decltype(auto) constexpr to_euclidean(Arg &&arg)
Project the vector space associated with index 0 to a Euclidean space for applying directional statis...
Definition: to_euclidean.hpp:38