9#include "detail/macro.hpp"
10#include "detail/so2.hpp"
11#include "lie_group_base.hpp"
16template<
typename Scalar>
60template<
typename _Derived>
69 SMOOTH_INHERIT_TYPEDEFS;
81 const auto &
x =
static_cast<const _Derived &
>(*this).coeffs().y();
82 const auto &
y =
static_cast<const _Derived &
>(*this).coeffs().x();
97 const auto &
x =
static_cast<const _Derived &
>(*this).coeffs().y();
98 const auto &
y =
static_cast<const _Derived &
>(*this).coeffs().x();
113 return Eigen::Vector2<Scalar>(
114 static_cast<const _Derived &
>(*this).coeffs().y(),
static_cast<const _Derived &
>(*this).coeffs().x());
120 std::complex<Scalar>
u1()
const
122 return std::complex<Scalar>(
123 static_cast<const _Derived &
>(*this).coeffs().y(),
static_cast<const _Derived &
>(*this).coeffs().x());
129 template<
typename EigenDerived>
130 Eigen::Vector2<Scalar>
operator*(
const Eigen::MatrixBase<EigenDerived> &
v)
const
142 template<
typename EigenDerived>
143 Eigen::Matrix<Scalar, 2, 1>
dr_action(
const Eigen::MatrixBase<EigenDerived> &
v)
const
157 using std::cos, std::sin;
165template<
typename _Scalar>
170template<
typename _Scalar>
173 static constexpr bool is_mutable =
true;
175 using Impl = SO2Impl<_Scalar>;
178 template<
typename NewScalar>
188template<
typename _Scalar>
192 SMOOTH_GROUP_API(
SO2);
208 m_coeffs.x() =
qz /
n;
209 m_coeffs.y() =
qw /
n;
219 using std::cos, std::sin;
232 explicit SO2(
const std::complex<Scalar> & c)
236 const Scalar n =
sqrt(c.imag() * c.imag() + c.real() * c.real());
237 m_coeffs.x() = c.imag() /
n;
238 m_coeffs.y() = c.real() /
n;
243template<
typename _Scalar>
253template<
typename _Scalar>
262template<
typename _Scalar>
265 static constexpr bool is_mutable =
false;
274template<
typename _Scalar>
279 SMOOTH_CONST_MAP_API();
288#if __has_include(<format>)
292template<
class Scalar>
293struct std::formatter<smooth::
SO2<Scalar>>
297 constexpr auto parse(std::format_parse_context & ctx)
300 for (
auto it = ctx.begin(); it != ctx.end(); ++
it) {
303 if (c ==
'}')
return it;
308 auto format(
const smooth::SO2<Scalar> & obj, std::format_context & ctx)
const
310 return std::vformat_to(ctx.out(), m_format, std::make_format_args(obj.angle()));
Base class for Lie group types.
typename traits::Scalar Scalar
Scalar type.
Tangent log() const noexcept
Lie group logarithm.
static Matrix hat(const Eigen::MatrixBase< TangentDerived > &a) noexcept
Lie algebra hat map.
Matrix matrix() const noexcept
Return as matrix Lie group element in .
Eigen::Matrix< Scalar, Dim, Dim > Matrix
Lie group matrix type.
Memory mapping of internal Lie group types.
Base class for SO2 Lie group types.
std::complex< Scalar > u1() const
Unit complex number (U(1)) representation.
Eigen::Vector2< Scalar > unit_complex() const
Unit complex number (U(1)) representation.
Scalar angle_ccw() const
Angle representation in clockwise direction, in range.
Scalar angle() const
Angle representation, in range.
SO3< Scalar > lift_so3() const
Lift to SO3.
Scalar angle_cw() const
Angle representation in clockwise direction, in range.
Eigen::Vector2< Scalar > operator*(const Eigen::MatrixBase< EigenDerived > &v) const
Rotation action on 2D vector.
Eigen::Matrix< Scalar, 2, 1 > dr_action(const Eigen::MatrixBase< EigenDerived > &v) const
Jacobian of rotation action w.r.t. group.
Storage implementation of SO2 Lie group.
SO2(const std::complex< Scalar > &c)
Construct from unit complex number.
SO2(const Scalar &qz, const Scalar &qw)
Construct from coefficients.
SO2(const Scalar &angle)
Construct from angle.
Storage implementation of SO3 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.