template class sophus::So2¶
Overview¶
So2 using default storage; derived from So2Base. More…
#include <so2.h> template <class TScalar, int kOptions> class So2 { public: // typedefs using Base = So2Base<So2<TScalar, kOptions>> ; using Scalar = TScalar ; using Transformation = typename Base::Transformation ; using Point = typename Base::Point ; using HomogeneousPoint = typename Base::HomogeneousPoint ; using Tangent = typename Base::Tangent ; using Adjoint = typename Base::Adjoint ; using ComplexMember = Eigen::Matrix<Scalar, 2, 1, kOptions> ; // fields static constexpr int kDoF = Base::kDoF; static constexpr int kNumParameters = Base::kNumParameters; // construction So2(); So2(So2 const& other); template <class TOtherDerived> So2(So2Base<TOtherDerived> const& other); So2(Transformation const& mat_r); So2(Scalar const& real, Scalar const& imag); template <class TD> So2(Eigen::MatrixBase<TD> const& complex); So2(Scalar theta); // methods SOPHUS_FUNC So2& operator=(So2 const& other); SOPHUS_FUNC ComplexMember const& unitComplex() const; template <class TOtherDerived> SOPHUS_FUNC So2Base<TDerived>& operator=(So2Base<TOtherDerived> const& other); static SOPHUS_FUNC So2<Scalar> exp(Tangent const& theta); static SOPHUS_FUNC Eigen::Matrix<Scalar, kNumParameters, kDoF> dxExpX(Tangent const& theta); static SOPHUS_FUNC Eigen::Matrix<Scalar, kNumParameters, kDoF> dxExpXAt0(); static SOPHUS_FUNC Eigen::Matrix<Scalar, 2, kDoF> dxExpXTimesPointAt0(Point const& point); static SOPHUS_FUNC Transformation dxiExpmatXAt0(int); static SOPHUS_FUNC Transformation generator(); static SOPHUS_FUNC Transformation hat(Tangent const& theta); template <class TS = Scalar> static SOPHUS_FUNC std::enable_if_t<std::is_floating_point<TS>::value, So2> fitToSo2(Transformation const& r); static SOPHUS_FUNC Tangent lieBracket(Tangent const&, Tangent const&); template <class TUniformRandomBitGenerator> static So2 sampleUniform(TUniformRandomBitGenerator& generator); static SOPHUS_FUNC Tangent vee(Transformation const& omega); protected: // fields ComplexMember unit_complex_; // methods SOPHUS_FUNC ComplexMember& mutUnitComplex(); };
Detailed Documentation¶
So2 using default storage; derived from So2Base.
Construction¶
So2()
Default constructor initializes unit complex number to identity rotation.
So2(So2 const& other)
Copy constructor.
template <class TOtherDerived> So2(So2Base<TOtherDerived> const& other)
Copy-like constructor from OtherDerived.
So2(Transformation const& mat_r)
Constructor from rotation matrix.
Precondition: rotation matrix need to be orthogonal with determinant of 1.
So2(Scalar const& real, Scalar const& imag)
Constructor from pair of real and imaginary number.
Precondition: The pair must not be close to zero.
template <class TD> So2(Eigen::MatrixBase<TD> const& complex)
Constructor from 2-vector.
Precondition: The vector must not be close to zero.
So2(Scalar theta)
Constructor from an rotation angle.
Methods¶
SOPHUS_FUNC So2& operator=(So2 const& other)
Define copy-assignment operator explicitly. The definition of implicit copy assignment operator is deprecated in presence of a user-declared copy constructor (-Wdeprecated-copy in clang >= 13).
SOPHUS_FUNC ComplexMember const& unitComplex() const
Accessor of unit complex number.
template <class TOtherDerived> SOPHUS_FUNC So2Base<TDerived>& operator=(So2Base<TOtherDerived> const& other)
Assignment-like operator from OtherDerived.
static SOPHUS_FUNC So2<Scalar> exp(Tangent const& theta)
Group exponential.
This functions takes in an element of tangent space (= rotation angle theta
) and returns the corresponding element of the group SO(2).
To be more specific, this function computes expmat(hat(omega))
with expmat(.)
being the matrix exponential and hat(.)
being the hat() -operator of SO(2).
static SOPHUS_FUNC Eigen::Matrix<Scalar, kNumParameters, kDoF> dxExpX(Tangent const& theta)
Returns derivative of exp(x) wrt. x.
static SOPHUS_FUNC Eigen::Matrix<Scalar, kNumParameters, kDoF> dxExpXAt0()
Returns derivative of exp(x) wrt. x_i at x=0.
static SOPHUS_FUNC Eigen::Matrix<Scalar, 2, kDoF> dxExpXTimesPointAt0(Point const& point)
Returns derivative of exp(x) * p wrt. x_i at x=0.
static SOPHUS_FUNC Transformation dxiExpmatXAt0(int)
Returns derivative of expmat(x)
wrt. x_i at x=0
, with expmat(.)
being the matrix exponential.
static SOPHUS_FUNC Transformation generator()
Returns the infinitesimal generators of SO(2).
The infinitesimal generators of SO(2) is:
| 0 -1 |
| 1 0 |
static SOPHUS_FUNC Transformation hat(Tangent const& theta)
hat-operator
It takes in the scalar representation theta
(= rotation angle) and returns the corresponding matrix representation of Lie algebra element.
Formally, the hat() -operator of SO(2) is defined as
hat(.): R^2 -> R^{2x2}, hat(theta) = theta * G
with G
being the infinitesimal generator of SO(2).
The corresponding inverse is the vee() -operator, see below.
template <class TS = Scalar> static SOPHUS_FUNC std::enable_if_t<std::is_floating_point<TS>::value, So2> fitToSo2(Transformation const& r)
Returns closed So2 given arbitrary 2x2 matrix.
static SOPHUS_FUNC Tangent lieBracket(Tangent const&, Tangent const&)
Lie bracket.
It returns the Lie bracket of SO(2). Since SO(2) is a commutative group, the Lie bracket is simple 0
.
template <class TUniformRandomBitGenerator> static So2 sampleUniform(TUniformRandomBitGenerator& generator)
Draw uniform sample from SO(2) manifold.
static SOPHUS_FUNC Tangent vee(Transformation const& omega)
vee-operator
It takes the 2x2-matrix representation Omega
and maps it to the corresponding scalar representation of Lie algebra.
This is the inverse of the hat() -operator, see above.
Precondition: Omega
must have the following structure:
| 0 -a |
| a 0 |
SOPHUS_FUNC ComplexMember& mutUnitComplex()
Mutator of complex number is protected to ensure class invariant.