Go to the documentation of this file.
4 #ifndef SOPHUS_SIM2_HPP
5 #define SOPHUS_SIM2_HPP
11 template <
class Scalar_,
int Options = 0>
20 template <
class Scalar_,
int Options>
21 struct traits<
Sophus::Sim2<Scalar_, Options>> {
27 template <
class Scalar_,
int Options>
28 struct traits<Map<
Sophus::Sim2<Scalar_>, Options>>
29 : traits<Sophus::Sim2<Scalar_, Options>> {
32 using RxSO2Type = Map<Sophus::RxSO2<Scalar>, Options>;
35 template <
class Scalar_,
int Options>
36 struct traits<Map<
Sophus::Sim2<Scalar_> const, Options>>
37 : traits<Sophus::Sim2<Scalar_, Options> const> {
40 using RxSO2Type = Map<Sophus::RxSO2<Scalar>
const, Options>;
58 template <
class Derived>
61 using Scalar =
typename Eigen::internal::traits<Derived>::Scalar;
63 typename Eigen::internal::traits<Derived>::TranslationType;
64 using RxSO2Type =
typename Eigen::internal::traits<Derived>::RxSO2Type;
68 static int constexpr
DoF = 4;
73 static int constexpr
N = 3;
85 template <
typename OtherDerived>
86 using ReturnScalar =
typename Eigen::ScalarBinaryOpTraits<
87 Scalar,
typename OtherDerived::Scalar>::ReturnType;
89 template <
typename OtherDerived>
92 template <
typename Po
intDerived>
95 template <
typename HPo
intDerived>
107 res.template block<2, 2>(0, 0) =
rxso2().matrix();
120 template <
class NewScalarType>
152 Scalar const theta = theta_sigma[0];
153 Scalar const sigma = theta_sigma[1];
156 details::calcWInv<Scalar, 2>(Omega, theta, sigma,
scale());
176 homogenious_matrix.template topLeftCorner<2, 3>() =
matrix2x3();
177 homogenious_matrix.row(2) =
179 return homogenious_matrix;
186 matrix.template topLeftCorner<2, 2>() =
rxso2().matrix();
197 template <
class OtherDerived>
210 template <
typename OtherDerived>
225 template <
typename PointDerived,
226 typename =
typename std::enable_if<
229 Eigen::MatrixBase<PointDerived>
const& p)
const {
235 template <
typename HPointDerived,
236 typename =
typename std::enable_if<
239 Eigen::MatrixBase<HPointDerived>
const& p)
const {
255 return Line(rotatedLine.origin() +
translation(), rotatedLine.direction());
272 template <
typename OtherDerived,
273 typename =
typename std::enable_if<
274 std::is_same<Scalar, ReturnScalar<OtherDerived>>::value>::type>
277 *
static_cast<Derived*
>(
this) = *
this * other;
286 rxso2().setComplex(z);
292 typename Eigen::internal::traits<Derived>::RxSO2Type::ComplexType
const&
294 return rxso2().complex();
300 return rxso2().rotationMatrix();
306 return static_cast<Derived*
>(
this)->
rxso2();
312 return static_cast<Derived const*
>(
this)->
rxso2();
322 rxso2().setRotationMatrix(R);
338 rxso2().setScaledRotationMatrix(sR);
350 return static_cast<Derived const*
>(
this)->
translation();
355 template <
class Scalar_,
int Options>
356 class Sim2 :
public Sim2Base<Sim2<Scalar_, Options>> {
368 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
380 template <
class OtherDerived>
383 static_assert(std::is_same<typename OtherDerived::Scalar, Scalar>::value,
384 "must be same Scalar type");
389 template <
class OtherDerived,
class D>
393 static_assert(std::is_same<typename OtherDerived::Scalar, Scalar>::value,
394 "must be same Scalar type");
395 static_assert(std::is_same<typename D::Scalar, Scalar>::value,
396 "must be same Scalar type");
407 static_assert(std::is_same<typename D::Scalar, Scalar>::value,
408 "must be same Scalar type");
417 :
rxso2_((T.template topLeftCorner<2, 2>()).eval()),
488 Scalar const theta = a[2];
489 Scalar const sigma = a[3];
492 Matrix2<Scalar> const W = details::calcW<Scalar, 2>(Omega, theta, sigma);
521 SOPHUS_ENSURE(i >= 0 || i <= 3,
"i should be in range [0,3].");
543 Omega.template topLeftCorner<2, 2>() =
545 Omega.col(2).template head<2>() = a.template head<2>();
546 Omega.row(2).setZero();
562 Scalar const theta1 = a[2];
563 Scalar const theta2 = b[2];
564 Scalar const sigma1 = a[3];
565 Scalar const sigma2 = b[3];
568 res[0] = -theta1 * upsilon2[1] + theta2 * upsilon1[1] +
569 sigma1 * upsilon2[0] - sigma2 * upsilon1[0];
570 res[1] = theta1 * upsilon2[0] - theta2 * upsilon1[0] +
571 sigma1 * upsilon2[1] - sigma2 * upsilon1[1];
584 template <
class UniformRandomBitGenerator>
586 std::uniform_real_distribution<Scalar> uniform(
Scalar(-1),
Scalar(1));
606 upsilon_omega_sigma.template head<2>() = Omega.col(2).template head<2>();
607 upsilon_omega_sigma.template tail<2>() =
609 return upsilon_omega_sigma;
617 template <
class Scalar,
int Options>
619 static_assert(std::is_standard_layout<Sim2>::value,
620 "Assume standard layout for the use of offsetof check below.");
624 "This class assumes packed storage and hence will only work "
625 "correctly depending on the compiler (options) - in "
626 "particular when using [this->data(), this-data() + "
627 "num_parameters] to access the raw data in a contiguous fashion.");
637 template <
class Scalar_,
int Options>
638 class Map<
Sophus::Sim2<Scalar_>, Options>
650 EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Map);
653 using Base::operator*=;
654 using Base::operator*;
658 translation_(coeffs +
Sophus::RxSO2<
Scalar>::num_parameters) {}
682 Map<Sophus::RxSO2<Scalar>, Options>
rxso2_;
689 template <
class Scalar_,
int Options>
690 class Map<
Sophus::Sim2<Scalar_> const, Options>
701 using Base::operator*=;
702 using Base::operator*;
706 translation_(coeffs +
Sophus::RxSO2<
Scalar>::num_parameters) {}
722 Map<Sophus::RxSO2<Scalar>
const, Options>
const rxso2_;
typename Eigen::internal::traits< Map< Sophus::Sim2< Scalar_ > const, Options > >::RxSO2Type RxSO2Type
SOPHUS_FUNC Sim2< Scalar > inverse() const
Map< Sophus::Vector2< Scalar > const, Options > TranslationType
SOPHUS_FUNC Sim2< NewScalarType > cast() const
SOPHUS_FUNC Sim2(Sim2Base< OtherDerived > const &other)
typename Base::HomogeneousPoint HomogeneousPoint
SOPHUS_FUNC void setRotationMatrix(Matrix2< Scalar > &R)
typename Base::Transformation Transformation
SOPHUS_FUNC TranslationType const & translation() const
typename Base::HomogeneousPoint HomogeneousPoint
TranslationMember translation_
SOPHUS_FUNC Matrix2< Scalar > rotationMatrix() const
Map< Sophus::Vector2< Scalar >, Options > translation_
typename Eigen::ScalarBinaryOpTraits< Scalar, typename OtherDerived::Scalar >::ReturnType ReturnScalar
typename Eigen::internal::traits< Map< Sophus::Sim2< Scalar_ > const, Options > >::TranslationType TranslationType
Vector< Scalar, 3, Options > Vector3
Matrix< Scalar, N, N > Transformation
typename Base::Point Point
Matrix< Scalar, 2, 2 > Matrix2
SOPHUS_FUNC Map< Sophus::Vector2< Scalar >, Options > const & translation() const
Accessor of translation vector.
#define SOPHUS_ENSURE(expr,...)
SOPHUS_FUNC HomogeneousPointProduct< HPointDerived > operator*(Eigen::MatrixBase< HPointDerived > const &p) const
SOPHUS_FUNC Line operator*(Line const &l) const
SOPHUS_FUNC TranslationMember const & translation() const
SOPHUS_FUNC void setScale(Scalar const &scale)
Map< Sophus::RxSO2< Scalar > const, Options > RxSO2Type
Vector< Scalar, 2, Options > Vector2
SOPHUS_FUNC RxSo2Member const & rxso2() const
SOPHUS_FUNC Adjoint Adj() const
static constexpr int num_parameters
static SOPHUS_FUNC Tangent vee(Transformation const &Omega)
SOPHUS_FUNC Sim2Base & operator=(Sim2Base const &other)=default
SOPHUS_FUNC Map< Sophus::Vector2< Scalar >, Options > & translation()
SOPHUS_FUNC Sim2Base< Derived > & operator*=(Sim2Base< OtherDerived > const &other)
SOPHUS_FUNC Sim2(Matrix< Scalar, 3, 3 > const &T)
SOPHUS_FUNC Transformation matrix() const
SOPHUS_FUNC void setScaledRotationMatrix(Matrix2< Scalar > const &sR)
SOPHUS_FUNC Map< Sophus::Vector2< Scalar > const, Options > const & translation() const
static SOPHUS_FUNC Sim2< Scalar > exp(Tangent const &a)
typename Base::Transformation Transformation
typename Eigen::internal::traits< Map< Sophus::Sim2< Scalar_ > const, Options > >::Scalar Scalar
SOPHUS_FUNC Sim2Product< OtherDerived > operator*(Sim2Base< OtherDerived > const &other) const
static SOPHUS_FUNC RxSO2< Scalar > exp(Tangent const &a)
typename Base::Tangent Tangent
SOPHUS_FUNC Sim2(Vector2< Scalar > const &complex_number, Eigen::MatrixBase< D > const &translation)
static constexpr int N
Group transformations are 3x3 matrices.
SOPHUS_FUNC Map< Sophus::RxSO2< Scalar >, Options > & rxso2()
Sophus::Vector2< Scalar, Options > TranslationType
SOPHUS_FUNC Map< Sophus::RxSO2< Scalar > const, Options > const & rxso2() const
Eigen::Matrix< Scalar, M, N > Matrix
typename Base::Point Point
SOPHUS_FUNC RxSo2Member & rxso2()
SOPHUS_FUNC RxSO2Type & rxso2()
typename Base::Adjoint Adjoint
const Map< Sophus::Vector2< Scalar > const, Options > translation_
static SOPHUS_FUNC Tangent vee(Transformation const &Omega)
SOPHUS_FUNC TranslationType & translation()
typename Base::Transformation Transformation
typename Base::Tangent Tangent
SOPHUS_FUNC Matrix< Scalar, 2, 3 > matrix2x3() const
Vector2< Scalar, Options > TranslationMember
SOPHUS_FUNC Map< Sophus::RxSO2< Scalar >, Options > const & rxso2() const
SOPHUS_FUNC RxSO2Type const & rxso2() const
SOPHUS_FUNC void setComplex(Vector2< Scalar > const &z)
typename Base::Adjoint Adjoint
SOPHUS_FUNC Scalar * data()
Vector3< Scalar > HomogeneousPoint
Vector< Scalar, DoF > Tangent
SOPHUS_FUNC Sophus::Vector< Scalar, num_parameters > params() const
static SOPHUS_FUNC Transformation hat(Tangent const &theta)
Matrix< Scalar, DoF, DoF > Adjoint
const Map< Sophus::RxSO2< Scalar > const, Options > rxso2_
Vector3< ReturnScalar< HPointDerived > > HomogeneousPointProduct
static SOPHUS_FUNC Transformation generator(int i)
SOPHUS_FUNC Eigen::internal::traits< Derived >::RxSO2Type::ComplexType const & complex() const
static SOPHUS_FUNC Transformation hat(Tangent const &a)
SOPHUS_FUNC Tangent log() const
SOPHUS_FUNC TranslationMember & translation()
typename Base::Point Point
static SOPHUS_FUNC Tangent lieBracket(Tangent const &a, Tangent const &b)
Eigen::Matrix< Scalar, M, 1, Options > Vector
typename Base::HomogeneousPoint HomogeneousPoint
SOPHUS_FUNC Map(Scalar const *coeffs)
SOPHUS_FUNC Scalar const * data() const
Sim2 using default storage; derived from Sim2Base.
EIGEN_MAKE_ALIGNED_OPERATOR_NEW SOPHUS_FUNC Sim2()
Map< Sophus::RxSO2< Scalar >, Options > rxso2_
SOPHUS_FUNC Map(Scalar *coeffs)
Vector2< ReturnScalar< PointDerived > > PointProduct
static SOPHUS_FUNC Transformation hat(Tangent const &a)
static SOPHUS_FUNC Transformation Dxi_exp_x_matrix_at_0(int i)
static Sim2 sampleUniform(UniformRandomBitGenerator &generator)
ParametrizedLine< Scalar, 2, Options > ParametrizedLine2
typename Base::Tangent Tangent
typename Base::Adjoint Adjoint
ParametrizedLine2< Scalar > Line
SOPHUS_FUNC Sim2Base< Derived > & operator=(Sim2Base< OtherDerived > const &other)
SOPHUS_FUNC PointProduct< PointDerived > operator*(Eigen::MatrixBase< PointDerived > const &p) const
SOPHUS_FUNC Scalar scale() const
SOPHUS_FUNC Sim2(RxSO2Base< OtherDerived > const &rxso2, Eigen::MatrixBase< D > const &translation)
sophus
Author(s): Hauke Strasdat
autogenerated on Wed Mar 2 2022 01:01:48