6#include <Eigen/Geometry>
8#include "detail/macro.hpp"
9#include "detail/se2.hpp"
10#include "lie_group_base.hpp"
16template<
typename Scalar>
62template<
typename _Derived>
71 SMOOTH_INHERIT_TYPEDEFS;
90 Eigen::Map<Eigen::Vector2<Scalar>>
r2()
93 return Eigen::Map<Eigen::Vector2<Scalar>>(
static_cast<_Derived &
>(*this).data());
99 Eigen::Map<const Eigen::Vector2<Scalar>>
r2()
const
101 return Eigen::Map<const Eigen::Vector2<Scalar>>(
static_cast<const _Derived &
>(*this).data());
107 Eigen::Transform<Scalar, 2, Eigen::Isometry>
isometry()
const
109 return Eigen::Translation<Scalar, 2>(
r2()) * Eigen::Rotation2D<Scalar>(
so2().angle());
115 template<
typename EigenDerived>
116 Eigen::Vector2<Scalar>
operator*(
const Eigen::MatrixBase<EigenDerived> &
v)
const
128 template<
typename EigenDerived>
129 Eigen::Matrix<Scalar, 2, 3>
dr_action(
const Eigen::MatrixBase<EigenDerived> &
v)
const
131 Eigen::Matrix<Scalar, 2, 3>
ret;
149template<
typename _Scalar>
154template<
typename _Scalar>
157 static constexpr bool is_mutable =
true;
159 using Impl = SE2Impl<_Scalar>;
162 template<
typename NewScalar>
172template<
typename _Scalar>
177 SMOOTH_GROUP_API(
SE2);
186 template<
typename SO2Derived,
typename T2Derived>
196 explicit SE2(
const Eigen::Transform<Scalar, 2, Eigen::Isometry> &
t)
198 Eigen::Matrix2<Scalar>
rotmat =
t.rotation();
199 coeffs().x() =
t.translation().x();
200 coeffs().y() =
t.translation().y();
209template<
typename _Scalar>
219template<
typename _Scalar>
228template<
typename _Scalar>
231 static constexpr bool is_mutable =
false;
240template<
typename _Scalar>
245 SMOOTH_CONST_MAP_API();
253#if __has_include(<format>)
257template<
class Scalar>
258struct std::formatter<smooth::
SE2<Scalar>>
262 constexpr auto parse(std::format_parse_context & ctx)
265 for (
auto it = ctx.begin(); it != ctx.end(); ++
it) {
268 if (c ==
'}')
return it;
273 auto format(
const smooth::SE2<Scalar> & obj, std::format_context & ctx)
const
275 const auto fmtSting = std::format(
"r2: [{0}, {0}], so2: {0}", m_format);
276 return std::vformat_to(ctx.out(), fmtSting, std::make_format_args(obj.r2().x(), obj.r2().y(), obj.so2().angle()));
Base class for Lie group types.
typename traits::Scalar Scalar
Scalar type.
auto & coeffs() const
Access underlying storages.
static constexpr bool is_mutable
True if underlying storage supports modification.
Eigen::Matrix< Scalar, Dim, Dim > Matrix
Lie group matrix type.
Memory mapping of internal Lie group types.
Base class for SE2 Lie group types.
Map< const SO2< Scalar > > so2() const
Const access SO(2) part.
Eigen::Vector2< Scalar > operator*(const Eigen::MatrixBase< EigenDerived > &v) const
Tranformation action on 2D vector.
Eigen::Map< const Eigen::Vector2< Scalar > > r2() const
Const access R2 part.
Map< SO2< Scalar > > so2()
Access SO(2) part.
Eigen::Transform< Scalar, 2, Eigen::Isometry > isometry() const
Return as 2D Eigen transform.
Eigen::Map< Eigen::Vector2< Scalar > > r2()
Access R2 part.
SE3< Scalar > lift_se3() const
Lift to SE3.
Eigen::Matrix< Scalar, 2, 3 > dr_action(const Eigen::MatrixBase< EigenDerived > &v) const
Jacobian of rotation action w.r.t. group.
Storage implementation of SE2 Lie group.
SE2(const SO2Base< SO2Derived > &so2, const Eigen::MatrixBase< T2Derived > &r2)
Construct from SO2 and R2.
SE2(const Eigen::Transform< Scalar, 2, Eigen::Isometry > &t)
Construct from Eigen transform.
Storage implementation of SE3 Lie group.
typename traits::man< M >::Scalar Scalar
Manifold scalar type.
typename traits::man< M >::PlainObject PlainObject
Manifold default type.
Type trait that maps a type to Lie group operations.