sophus_printers.hpp
Go to the documentation of this file.
1 // Copyright 2024 Ekumen, Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef BELUGA_TESTING_SOPHUS_PRINTERS_HPP
16 #define BELUGA_TESTING_SOPHUS_PRINTERS_HPP
17 
23 #include <iostream>
24 
25 #include <sophus/se2.hpp>
26 #include <sophus/so2.hpp>
27 #include <sophus/types.hpp>
28 
29 namespace Eigen { // NOLINT
30 
32 
39 template <class Scalar, int Rows, int Cols>
40 std::ostream& operator<<(std::ostream& os, const Eigen::Matrix<Scalar, Rows, Cols>& t) {
41  static const auto kSingleLine = Eigen::IOFormat{
42  Eigen::StreamPrecision, //
43  Eigen::DontAlignCols, //
44  ", ", // coefficient separator
45  ", ", // row separator
46  };
47  return os << "(" << t.format(kSingleLine) << ")";
48 }
49 
50 } // namespace Eigen
51 
52 namespace Sophus { // NOLINT
53 
55 
60 template <class Scalar>
61 std::ostream& operator<<(std::ostream& os, const Sophus::SO2<Scalar>& t) {
62  return os << t.unit_complex();
63 }
64 
66 
71 template <class Scalar>
72 std::ostream& operator<<(std::ostream& os, const Sophus::SE2<Scalar>& t) {
73  return os << "(" << t.so2() << ", " << t.translation() << ")";
74 }
75 
76 } // namespace Sophus
77 
78 #endif
Sophus::SO2
Eigen
Eigen::operator<<
std::ostream & operator<<(std::ostream &os, const Eigen::Matrix< Scalar, Rows, Cols > &t)
Printer for Eigen matrices.
Definition: sophus_printers.hpp:40
Sophus::SE2::so2
SOPHUS_FUNC SO2Member & so2()
Sophus::operator<<
std::ostream & operator<<(std::ostream &os, const Sophus::SO2< Scalar > &t)
Printer for SO2 elements.
Definition: sophus_printers.hpp:61
se2.hpp
types.hpp
Sophus
Sophus::SE2
so2.hpp
Sophus::SE2::translation
SOPHUS_FUNC TranslationMember & translation()
Sophus::SO2::unit_complex
SOPHUS_FUNC ComplexMember const & unit_complex() const


beluga
Author(s):
autogenerated on Tue Jul 16 2024 02:59:53