farm-ng-core
point.h
Go to the documentation of this file.
1 
2 // Copyright (c) 2011, Hauke Strasdat
3 // Copyright (c) 2012, Steven Lovegrove
4 // Copyright (c) 2021, farm-ng, inc.
5 //
6 // Use of this source code is governed by an MIT-style
7 // license that can be found in the LICENSE file or at
8 // https://opensource.org/licenses/MIT.
9 
10 #pragma once
11 
12 #include "sophus/concepts/utils.h"
13 
14 #include <Eigen/Core>
15 
16 namespace sophus {
17 namespace concepts {
18 
19 // These concept let us match Eigen's CRTP pattern and capture the true Derived
20 // type safely
21 
22 template <class TDerived>
23 concept EigenType = DerivedFrom<TDerived, Eigen::EigenBase<TDerived>>;
24 
25 template <class TDerived>
26 concept EigenDenseType = DerivedFrom<TDerived, Eigen::DenseBase<TDerived>>;
27 
28 template <class TDerived>
29 concept EigenMatrixType = DerivedFrom<TDerived, Eigen::MatrixBase<TDerived>>;
30 
31 template <class TDerived>
32 concept EigenArrayType = DerivedFrom<TDerived, Eigen::ArrayBase<TDerived>>;
33 
34 template <class TT1, typename TT2>
35 concept EigenSameDim = EigenDenseType<TT1> && EigenDenseType<TT2> &&
36  (TT1::RowsAtCompileTime == Eigen::Dynamic ||
37  TT1::RowsAtCompileTime == TT2::RowsAtCompileTime) &&
38  (TT1::ColsAtCompileTime == Eigen::Dynamic ||
39  TT1::ColsAtCompileTime == TT2::ColsAtCompileTime);
40 
41 template <int kRows, int kCols, typename TT>
42 concept EigenWithDim = EigenDenseType<TT> && TT::RowsAtCompileTime ==
43  kRows&& TT::ColsAtCompileTime == kCols;
44 
45 template <typename TT>
46 concept EigenVector3 = EigenDenseType<TT> && TT::RowsAtCompileTime == 3 &&
47  TT::ColsAtCompileTime == 1;
48 
49 template <int kRows, int kCols, typename TT>
50 concept EigenWithDimOrDynamic = EigenDenseType<TT> &&
51  (TT::RowsAtCompileTime == Eigen::Dynamic ||
52  TT::RowsAtCompileTime == kRows) &&
53  (TT::ColsAtCompileTime == Eigen::Dynamic ||
54  TT::ColsAtCompileTime == kCols);
55 ;
56 
57 template <class TT>
58 concept RealScalarType = std::is_floating_point_v<TT>;
59 
60 template <class TT>
61 concept IntegerScalarType = std::is_integral_v<TT>;
62 
63 template <class TT>
64 concept ScalarType = RealScalarType<TT> || IntegerScalarType<TT>;
65 
66 template <class TT>
68  EigenDenseType<TT> && std::is_floating_point_v<typename TT::Scalar>;
69 
70 template <class TT>
72  EigenDenseType<TT> && std::is_integral_v<typename TT::Scalar>;
73 
74 template <class TT>
75 concept RealPointType = RealScalarType<TT> || RealEigenDenseType<TT>;
76 
77 template <class TT>
78 concept IntegerPointType = IntegerScalarType<TT> || IntegerEigenDenseType<TT>;
79 
80 template <class TT>
81 concept PointType = RealPointType<TT> || IntegerPointType<TT>;
82 
83 } // namespace concepts
84 } // namespace sophus
sophus::concepts::EigenVector3
concept EigenVector3
Definition: point.h:46
sophus::concepts::PointType
concept PointType
Definition: point.h:81
sophus::concepts::ScalarType
concept ScalarType
Definition: point.h:64
sophus
Image MutImage, owning images types.
Definition: num_diff.h:20
sophus::concepts::EigenWithDimOrDynamic
concept EigenWithDimOrDynamic
Definition: point.h:50
sophus::concepts::IntegerScalarType
concept IntegerScalarType
Definition: point.h:61
sophus::concepts::RealEigenDenseType
concept RealEigenDenseType
Definition: point.h:67
utils.h
sophus::concepts::EigenMatrixType
concept EigenMatrixType
Definition: point.h:29
sophus::concepts::EigenType
concept EigenType
Definition: point.h:23
sophus::concepts::IntegerEigenDenseType
concept IntegerEigenDenseType
Definition: point.h:71
sophus::concepts::EigenSameDim
concept EigenSameDim
Definition: point.h:35
sophus::concepts::EigenWithDim
concept EigenWithDim
Definition: point.h:42
sophus::concepts::EigenDenseType
concept EigenDenseType
Definition: point.h:26
sophus::concepts::RealPointType
concept RealPointType
Definition: point.h:75
sophus::concepts::IntegerPointType
concept IntegerPointType
Definition: point.h:78
sophus::concepts::RealScalarType
concept RealScalarType
Definition: point.h:58
sophus::concepts::EigenArrayType
concept EigenArrayType
Definition: point.h:32