14 #ifndef ECL_GEOMETRY_POSE3D_HPP_ 15 #define ECL_GEOMETRY_POSE3D_HPP_ 21 #include <ecl/linear_algebra.hpp> 23 #include <ecl/config/macros.hpp> 41 template <
class Float,
typename Enable =
void>
58 template<
typename Float>
64 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
79 Pose3D() : rot(RotationMatrix::Identity()), trans(Translation::Zero()) {}
92 template<
typename Rot,
typename Trans>
94 Pose3D(
const ecl::linear_algebra::EigenBase<Rot>& rotation,
const ecl::linear_algebra::EigenBase<Trans>& translation) :
105 template <enum Pose2DStorageType Storage_>
107 rot(RotationMatrix::Identity()),
108 trans(Translation::Zero())
110 rot.template block<2,2>(0,0) = pose.rotationMatrix();
111 trans.template segment<2>(0) = pose.translation();
121 template<
typename Trans>
122 Pose3D(
const ecl::linear_algebra::AngleAxis<Float>& angle_axis,
const ecl::linear_algebra::MatrixBase<Trans>& translation) :
123 rot(RotationMatrix::Identity()),
124 trans(Translation::Zero())
135 template<
typename Trans>
136 Pose3D(
const ecl::linear_algebra::Quaternion<Float>& quaternion,
const ecl::linear_algebra::MatrixBase<Trans>& translation) :
137 rot(quaternion.toRotationMatrix()),
146 rot(pose.rotation()),
147 trans(pose.translation())
160 template <enum Pose2DStorageType Storage_>
162 rot.template block<2,2>(0,0) = pose.rotationMatrix();
163 (rot.template block<2,1>(0,2)) << 0.0, 0.0;
164 (rot.template block<1,3>(2,0)) << 0.0, 0.0, 1.0;
165 trans.template segment<2>(0) = pose.translation();
176 rot = pose.rotation();
177 trans = pose.translation();
202 template <
typename Trans>
203 void translation(
const ecl::linear_algebra::MatrixBase<Trans>& translation) {
204 this->trans = translation;
218 const RotationMatrix&
rotation()
const {
return rot; }
241 inverse.rotation(rot.transpose());
242 inverse.translation(-1*(inverse.rot*trans));
250 template <
typename Float_>
252 return Pose3D<Float>(rotation()*pose.rotation(),translation() + rotation()*pose.translation());
263 template <
typename Float_>
266 *
this = (*this)*pose;
277 template <
typename Float_>
279 return pose.inverse()*(*this);
287 template <
typename OutputStream,
typename Float_>
288 friend OutputStream& operator<<(OutputStream &ostream , const Pose3D<Float_> &pose);
307 template <
typename OutputStream,
typename Float_>
308 OutputStream& operator<<(OutputStream &ostream , const Pose3D<Float_> &pose) {
312 for (
unsigned int i = 0; i < 3; ++i ) {
314 for (
unsigned int j = 0; j < 3; ++j ) {
315 ostream << format(pose.rot(i,j)) <<
" ";
318 ostream << format(pose.trans(i)) <<
" ]\n";
RotationMatrix & rotation()
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef Float Scalar
Eigen style declaration of the element type.
ecl::linear_algebra::Matrix< Float, 3, 3 > RotationMatrix
The type used to represent rotation matrices.
Pose3D(const Pose3D< Float > &pose)
Copy constructor for 3d poses.
Pose3D(const ecl::linear_algebra::Quaternion< Float > &quaternion, const ecl::linear_algebra::MatrixBase< Trans > &translation)
Initialise from an eigen Quaternion and a translation.
Default action for detection of a fundamental float type (false).
Pose3D(const ecl::linear_algebra::AngleAxis< Float > &angle_axis, const ecl::linear_algebra::MatrixBase< Trans > &translation)
Initialise from an eigen AngleAxis and a translation.
Parent template definition for Pose2D.
Pose3D< Float > relative(const Pose3D< Float_ > &pose) const
Relative pose between this pose and another.
Pose3D()
Initialise with zero rotation and zero translation.
Pose3D(const Pose2D< Float, Storage_ > &pose)
Initialise from a 2D pose.
void translation(const ecl::linear_algebra::MatrixBase< Trans > &translation)
Set the translation vector.
Pose3D(const ecl::linear_algebra::EigenBase< Rot > &rotation, const ecl::linear_algebra::EigenBase< Trans > &translation)
Initialise with rotation matrix and translation.
const RotationMatrix & rotation() const
Return a mutable handle to the translation vector.
Pose3D< Float > & operator=(const Pose2D< Float, Storage_ > &pose)
Assign from another Pose2D instance.
Pose3D< Float > & operator=(const Pose3D< Float > &pose)
Assign from another Pose2D instance.
void rotation(const RotationMatrix &rotation)
Set the rotational component.
Pose3D< Float > operator*(const Pose3D< Float_ > &pose) const
Combine this pose with the incoming pose.
Pose3D< Float > & operator*=(const Pose3D< Float_ > &pose)
Transform this pose by the specified input pose.
Translation & translation()
Return a mutable handle to the rotational storage component.
const Translation & translation() const
Return a const handle to the rotational storage component.
Parent template definition for Pose3D.
ecl::linear_algebra::Matrix< Float, 3, 1 > Translation
The type used to represent translations.
Enables the SFINAE concept.
RotationMatrix rotationMatrix() const
Return a const handle to the translation vector.
Pose3D< Float > inverse() const
Calculate the inverse pose.