Go to the documentation of this file.
4 #ifndef SOPHUS_SIM3_HPP
5 #define SOPHUS_SIM3_HPP
11 template <
class Scalar_,
int Options = 0>
20 template <
class Scalar_,
int Options>
21 struct traits<
Sophus::Sim3<Scalar_, Options>> {
27 template <
class Scalar_,
int Options>
28 struct traits<Map<
Sophus::Sim3<Scalar_>, Options>>
29 : traits<Sophus::Sim3<Scalar_, Options>> {
32 using RxSO3Type = Map<Sophus::RxSO3<Scalar>, Options>;
35 template <
class Scalar_,
int Options>
36 struct traits<Map<
Sophus::Sim3<Scalar_> const, Options>>
37 : traits<Sophus::Sim3<Scalar_, Options> const> {
40 using RxSO3Type = Map<Sophus::RxSO3<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 RxSO3Type =
typename Eigen::internal::traits<Derived>::RxSO3Type;
69 static int constexpr
DoF = 7;
74 static int constexpr
N = 4;
86 template <
typename OtherDerived>
87 using ReturnScalar =
typename Eigen::ScalarBinaryOpTraits<
88 Scalar,
typename OtherDerived::Scalar>::ReturnType;
90 template <
typename OtherDerived>
93 template <
typename Po
intDerived>
96 template <
typename HPo
intDerived>
109 res.template block<3, 3>(0, 0) =
rxso3().matrix();
113 res.template block<3, 3>(3, 3) = R;
121 template <
class NewScalarType>
152 auto omega_sigma_and_theta =
rxso3().logAndTheta();
154 omega_sigma_and_theta.tangent.template head<3>();
155 Scalar sigma = omega_sigma_and_theta.tangent[3];
158 Omega, omega_sigma_and_theta.theta, sigma,
scale());
161 res.segment(3, 3) = omega;
178 homogenious_matrix.template topLeftCorner<3, 4>() =
matrix3x4();
179 homogenious_matrix.row(3) =
181 return homogenious_matrix;
188 matrix.template topLeftCorner<3, 3>() =
rxso3().matrix();
199 template <
class OtherDerived>
212 template <
typename OtherDerived>
227 template <
typename PointDerived,
228 typename =
typename std::enable_if<
231 Eigen::MatrixBase<PointDerived>
const& p)
const {
237 template <
typename HPointDerived,
238 typename =
typename std::enable_if<
241 Eigen::MatrixBase<HPointDerived>
const& p)
const {
257 return Line(rotatedLine.origin() +
translation(), rotatedLine.direction());
263 template <
typename OtherDerived,
264 typename =
typename std::enable_if<
265 std::is_same<Scalar, ReturnScalar<OtherDerived>>::value>::type>
268 *
static_cast<Derived*
>(
this) = *
this * other;
288 rxso3().setQuaternion(quat);
294 return rxso3().quaternion();
300 return rxso3().rotationMatrix();
306 return static_cast<Derived*
>(
this)->
rxso3();
312 return static_cast<Derived const*
>(
this)->
rxso3();
322 rxso3().setRotationMatrix(R);
338 rxso3().setScaledRotationMatrix(sR);
350 return static_cast<Derived const*
>(
this)->
translation();
355 template <
class Scalar_,
int Options>
356 class Sim3 :
public Sim3Base<Sim3<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");
403 template <
class D1,
class D2>
407 static_assert(std::is_same<typename D1::Scalar, Scalar>::value,
408 "must be same Scalar type");
409 static_assert(std::is_same<typename D2::Scalar, Scalar>::value,
410 "must be same Scalar type");
419 :
rxso3_(T.template topLeftCorner<3, 3>()),
483 Scalar const sigma = a[6];
489 Matrix3<Scalar> const W = details::calcW<Scalar, 3>(Omega, theta, sigma);
537 SOPHUS_ENSURE(i >= 0 || i <= 6,
"i should be in range [0,6].");
559 Omega.template topLeftCorner<3, 3>() =
561 Omega.col(3).template head<3>() = a.template head<3>();
562 Omega.row(3).setZero();
586 sigma1 * upsilon2 - sigma2 * upsilon1;
587 res.template segment<3>(3) = omega1.cross(omega2);
599 template <
class UniformRandomBitGenerator>
601 std::uniform_real_distribution<Scalar> uniform(
Scalar(-1),
Scalar(1));
623 upsilon_omega_sigma.template head<3>() = Omega.col(3).template head<3>();
624 upsilon_omega_sigma.template tail<4>() =
626 return upsilon_omega_sigma;
634 template <
class Scalar,
int Options>
636 static_assert(std::is_standard_layout<Sim3>::value,
637 "Assume standard layout for the use of offsetof check below.");
641 "This class assumes packed storage and hence will only work "
642 "correctly depending on the compiler (options) - in "
643 "particular when using [this->data(), this-data() + "
644 "num_parameters] to access the raw data in a contiguous fashion.");
654 template <
class Scalar_,
int Options>
655 class Map<
Sophus::Sim3<Scalar_>, Options>
667 EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Map);
670 using Base::operator*=;
671 using Base::operator*;
675 translation_(coeffs +
Sophus::RxSO3<
Scalar>::num_parameters) {}
699 Map<Sophus::RxSO3<Scalar>, Options>
rxso3_;
706 template <
class Scalar_,
int Options>
707 class Map<
Sophus::Sim3<Scalar_> const, Options>
719 using Base::operator*=;
720 using Base::operator*;
724 translation_(coeffs +
Sophus::RxSO3<
Scalar>::num_parameters) {}
740 Map<Sophus::RxSO3<Scalar>
const, Options>
const rxso3_;
Vector4< Scalar > HomogeneousPoint
SOPHUS_FUNC TranslationType & translation()
typename Eigen::internal::traits< Map< Sophus::Sim3< Scalar_ > const, Options > >::RxSO3Type RxSO3Type
static SOPHUS_FUNC Tangent lieBracket(Tangent const &a, Tangent const &b)
typename Base::Adjoint Adjoint
SOPHUS_FUNC Scalar const * data() const
static SOPHUS_FUNC Transformation hat(Tangent const &a)
Map< Sophus::Vector3< Scalar > const, Options > TranslationType
typename Eigen::internal::traits< Map< Sophus::Sim3< Scalar_ > const, Options > >::Scalar Scalar
SOPHUS_FUNC Sim3(Matrix< Scalar, 4, 4 > const &T)
SOPHUS_FUNC Sim3Base< Derived > & operator=(Sim3Base< OtherDerived > const &other)
SOPHUS_FUNC Matrix< Scalar, 3, 4 > matrix3x4() const
SOPHUS_FUNC TranslationMember const & translation() const
typename Base::HomogeneousPoint HomogeneousPoint
typename Base::Transformation Transformation
SOPHUS_FUNC Sim3< Scalar > inverse() const
SOPHUS_FUNC Sim3Product< OtherDerived > operator*(Sim3Base< OtherDerived > const &other) const
Vector< Scalar, 3, Options > Vector3
SOPHUS_FUNC void setQuaternion(Eigen::Quaternion< Scalar > const &quat)
typename Base::Point Point
static constexpr int num_parameters
static SOPHUS_FUNC Transformation generator(int i)
#define SOPHUS_ENSURE(expr,...)
const Map< Sophus::Vector3< Scalar > const, Options > translation_
SOPHUS_FUNC Map(Scalar *coeffs)
SOPHUS_FUNC QuaternionType const & quaternion() const
static Sim3 sampleUniform(UniformRandomBitGenerator &generator)
typename Base::Point Point
SOPHUS_FUNC RxSo3Member const & rxso3() const
Matrix< Scalar, N, N > Transformation
ParametrizedLine< Scalar, 3, Options > ParametrizedLine3
SOPHUS_FUNC Map(Scalar const *coeffs)
SOPHUS_FUNC Sim3< NewScalarType > cast() const
SOPHUS_FUNC Tangent log() const
SOPHUS_FUNC PointProduct< PointDerived > operator*(Eigen::MatrixBase< PointDerived > const &p) const
Map< Sophus::RxSO3< Scalar > const, Options > RxSO3Type
SOPHUS_FUNC Scalar * data()
static SOPHUS_FUNC RxSO3< Scalar > expAndTheta(Tangent const &a, Scalar *theta)
Map< Sophus::RxSO3< Scalar >, Options > rxso3_
SOPHUS_FUNC Sim3Base< Derived > & operator*=(Sim3Base< OtherDerived > const &other)
Vector3< ReturnScalar< PointDerived > > PointProduct
SOPHUS_FUNC Map< Sophus::RxSO3< Scalar >, Options > & rxso3()
SOPHUS_FUNC Map< Sophus::Vector3< Scalar >, Options > const & translation() const
Accessor of translation vector.
Vector< Scalar, DoF > Tangent
SOPHUS_FUNC void setScaledRotationMatrix(Matrix3< Scalar > const &sR)
SOPHUS_FUNC Map< Sophus::Vector3< Scalar >, Options > & translation()
Eigen::Matrix< Scalar, M, N > Matrix
typename Eigen::ScalarBinaryOpTraits< Scalar, typename OtherDerived::Scalar >::ReturnType ReturnScalar
SOPHUS_FUNC Map< Sophus::RxSO3< Scalar > const, Options > const & rxso3() const
static SOPHUS_FUNC Transformation hat(Tangent const &omega)
SOPHUS_FUNC void setScale(Scalar const &scale)
SOPHUS_FUNC Sophus::Vector< Scalar, num_parameters > params() const
SOPHUS_FUNC RxSO3Type const & rxso3() const
static SOPHUS_FUNC Transformation hat(Tangent const &a)
TranslationMember translation_
typename Base::HomogeneousPoint HomogeneousPoint
SOPHUS_FUNC Transformation matrix() const
typename Base::Transformation Transformation
static SOPHUS_FUNC Transformation Dxi_exp_x_matrix_at_0(int i)
typename Base::Tangent Tangent
Sophus::Vector3< Scalar, Options > TranslationType
Vector4< ReturnScalar< HPointDerived > > HomogeneousPointProduct
typename Eigen::internal::traits< Map< Sophus::Sim3< Scalar_ > const, Options > >::TranslationType TranslationType
SOPHUS_FUNC Sim3Base & operator=(Sim3Base const &other)=default
typename Base::Transformation Transformation
SOPHUS_FUNC Matrix3< Scalar > rotationMatrix() const
ParametrizedLine3< Scalar > Line
SOPHUS_FUNC Map< Sophus::RxSO3< Scalar >, Options > const & rxso3() const
SOPHUS_FUNC HomogeneousPointProduct< HPointDerived > operator*(Eigen::MatrixBase< HPointDerived > const &p) const
SOPHUS_FUNC Scalar scale() const
SOPHUS_FUNC void setRotationMatrix(Matrix3< Scalar > &R)
const Map< Sophus::RxSO3< Scalar > const, Options > rxso3_
Matrix< Scalar, 3, 3 > Matrix3
Map< Sophus::Vector3< Scalar >, Options > translation_
typename Base::Tangent Tangent
Vector< Scalar, 4 > Vector4
SOPHUS_FUNC Adjoint Adj() const
Sim3 using default storage; derived from Sim3Base.
static constexpr int N
Group transformations are 4x4 matrices.
typename Base::Tangent Tangent
static SOPHUS_FUNC Tangent vee(Transformation const &Omega)
Eigen::Matrix< Scalar, M, 1, Options > Vector
Matrix< Scalar, DoF, DoF > Adjoint
static SOPHUS_FUNC Sim3< Scalar > exp(Tangent const &a)
SOPHUS_FUNC RxSO3Type & rxso3()
SOPHUS_FUNC TranslationMember & translation()
SOPHUS_FUNC Sim3(RxSO3Base< OtherDerived > const &rxso3, Eigen::MatrixBase< D > const &translation)
typename Base::Adjoint Adjoint
SOPHUS_FUNC Line operator*(Line const &l) const
EIGEN_MAKE_ALIGNED_OPERATOR_NEW SOPHUS_FUNC Sim3()
SOPHUS_FUNC Sim3(Eigen::QuaternionBase< D1 > const &quaternion, Eigen::MatrixBase< D2 > const &translation)
static SOPHUS_FUNC Tangent vee(Transformation const &Omega)
SOPHUS_FUNC Map< Sophus::Vector3< Scalar > const, Options > const & translation() const
Vector3< Scalar, Options > TranslationMember
SOPHUS_FUNC Sim3(Sim3Base< OtherDerived > const &other)
typename Base::Point Point
typename RxSO3Type::QuaternionType QuaternionType
typename Base::Adjoint Adjoint
typename Base::HomogeneousPoint HomogeneousPoint
SOPHUS_FUNC TranslationType const & translation() const
SOPHUS_FUNC RxSo3Member & rxso3()
sophus
Author(s): Hauke Strasdat
autogenerated on Wed Mar 2 2022 01:01:48