DART  6.10.1
MathTypes.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011-2021, The DART development contributors
3  * All rights reserved.
4  *
5  * The list of contributors can be found at:
6  * https://github.com/dartsim/dart/blob/master/LICENSE
7  *
8  * This file is provided under the following "BSD-style" License:
9  * Redistribution and use in source and binary forms, with or
10  * without modification, are permitted provided that the following
11  * conditions are met:
12  * * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above
15  * copyright notice, this list of conditions and the following
16  * disclaimer in the documentation and/or other materials provided
17  * with the distribution.
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
19  * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
20  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
23  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
26  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
27  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
29  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30  * POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 #ifndef DART_MATH_MATHTYPES_HPP_
34 #define DART_MATH_MATHTYPES_HPP_
35 
36 #include <map>
37 #include <vector>
38 
39 #include <Eigen/Dense>
40 
42 #include "dart/common/Memory.hpp"
43 
44 //------------------------------------------------------------------------------
45 // Types
46 //------------------------------------------------------------------------------
47 namespace Eigen {
48 
49 using Vector6d = Matrix<double, 6, 1>;
50 using Matrix6d = Matrix<double, 6, 6>;
51 
53  const Eigen::Vector3d& _angular, const Eigen::Vector3d& _linear)
54 {
55  Vector6d composition;
56  composition << _angular, _linear;
57  return composition;
58 }
59 
60 // Deprecated
61 using EIGEN_V_VEC3D = std::vector<Eigen::Vector3d>;
62 
63 // Deprecated
64 using EIGEN_VV_VEC3D = std::vector<std::vector<Eigen::Vector3d>>;
65 
66 #if EIGEN_VERSION_AT_LEAST(3, 2, 1) && EIGEN_VERSION_AT_MOST(3, 2, 8)
67 
68 // Deprecated in favor of dart::common::aligned_vector
69 template <typename _Tp>
70 using aligned_vector
71  = std::vector<_Tp, dart::common::detail::aligned_allocator_cpp11<_Tp>>;
72 
73 // Deprecated in favor of dart::common::aligned_map
74 template <typename _Key, typename _Tp, typename _Compare = std::less<_Key>>
75 using aligned_map = std::map<
76  _Key,
77  _Tp,
78  _Compare,
79  dart::common::detail::aligned_allocator_cpp11<std::pair<const _Key, _Tp>>>;
80 
81 #else
82 
83 // Deprecated in favor of dart::common::aligned_vector
84 template <typename _Tp>
85 using aligned_vector = std::vector<_Tp, Eigen::aligned_allocator<_Tp>>;
86 
87 // Deprecated in favor of dart::common::aligned_map
88 template <typename _Key, typename _Tp, typename _Compare = std::less<_Key>>
89 using aligned_map = std::map<
90  _Key,
91  _Tp,
92  _Compare,
93  Eigen::aligned_allocator<std::pair<const _Key, _Tp>>>;
94 
95 #endif
96 
97 // Deprecated in favor of dart::common::make_aligned_shared
98 template <typename _Tp, typename... _Args>
99 DART_DEPRECATED(6.2)
100 std::shared_ptr<_Tp> make_aligned_shared(_Args&&... __args)
101 {
103  std::forward<_Args>(__args)...);
104 }
105 
106 } // namespace Eigen
107 
108 namespace dart {
109 namespace math {
110 
112 using LinearJacobian = Eigen::Matrix<double, 3, Eigen::Dynamic>;
113 using AngularJacobian = Eigen::Matrix<double, 3, Eigen::Dynamic>;
114 using Jacobian = Eigen::Matrix<double, 6, Eigen::Dynamic>;
115 
116 } // namespace math
117 } // namespace dart
118 
119 #endif // DART_MATH_MATHTYPES_HPP_
#define DART_DEPRECATED(version)
Definition: Deprecated.hpp:51
Definition: Random-impl.hpp:92
std::shared_ptr< _Tp > make_aligned_shared(_Args &&... __args)
Definition: MathTypes.hpp:100
Matrix< double, 6, 1 > Vector6d
Definition: MathTypes.hpp:49
std::vector< _Tp, Eigen::aligned_allocator< _Tp > > aligned_vector
Definition: MathTypes.hpp:85
Vector6d compose(const Eigen::Vector3d &_angular, const Eigen::Vector3d &_linear)
Definition: MathTypes.hpp:52
std::vector< Eigen::Vector3d > EIGEN_V_VEC3D
Definition: MathTypes.hpp:61
std::map< _Key, _Tp, _Compare, Eigen::aligned_allocator< std::pair< const _Key, _Tp > >> aligned_map
Definition: MathTypes.hpp:93
std::vector< std::vector< Eigen::Vector3d > > EIGEN_VV_VEC3D
Definition: MathTypes.hpp:64
Matrix< double, 6, 6 > Matrix6d
Definition: MathTypes.hpp:50
Eigen::Matrix< double, 6, Eigen::Dynamic > Jacobian
Definition: MathTypes.hpp:114
Eigen::Matrix< double, 3, Eigen::Dynamic > AngularJacobian
Definition: MathTypes.hpp:113
Eigen::Matrix< double, 3, Eigen::Dynamic > LinearJacobian
Definition: MathTypes.hpp:112
Eigen::Matrix6d Inertia
Definition: MathTypes.hpp:111
Definition: BulletCollisionDetector.cpp:65
Definition: SharedLibraryManager.hpp:46