Fixed comments in Rot3Q (were just copied and pasted from Rot3M)

release/4.3a0
Richard Roberts 2012-01-01 19:27:29 +00:00
parent f30a03b68f
commit fb1c933418
3 changed files with 22 additions and 18 deletions

View File

@ -184,8 +184,6 @@ namespace gtsam {
boost::optional<Matrix&> H1=boost::none, boost::optional<Matrix&> H1=boost::none,
boost::optional<Matrix&> H2=boost::none) const; boost::optional<Matrix&> H2=boost::none) const;
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
private: private:
/** Serialization function */ /** Serialization function */
friend class boost::serialization::access; friend class boost::serialization::access;

View File

@ -11,7 +11,7 @@
/** /**
* @file Rot3.h * @file Rot3.h
* @brief Contains a typedef to the default 3D rotation implementation determined at compile time * @brief Contains a typedef to the default 3D rotation implementation determined at compile time, see Rot3M and Rot3Q.
* @author Richard Roberts * @author Richard Roberts
*/ */

View File

@ -11,10 +11,8 @@
/** /**
* @file Rot3Q.h * @file Rot3Q.h
* @brief 3D Rotation represented as 3*3 matrix * @brief 3D Rotation represented as a quaternion
* @author Alireza Fathi * @author Richard Roberts
* @author Christian Potthast
* @author Frank Dellaert
*/ */
// \callgraph // \callgraph
@ -27,11 +25,15 @@
namespace gtsam { namespace gtsam {
typedef Eigen::Quaternion<double,Eigen::DontAlign> Quaternion; ///< Typedef to an Eigen Quaternion<double> /// Typedef to an Eigen Quaternion<double>, we disable alignment because
/// geometry objects are stored in boost pool allocators, Values containers,
/// and and these pool allocators do not support alignment.
typedef Eigen::Quaternion<double, Eigen::DontAlign> Quaternion;
/** /**
* @brief 3D Rotations represented as rotation matrices * @brief 3D Rotations represented as quaternions
* @ingroup geometry * @ingroup geometry
* \nosubgrouping
*/ */
class Rot3Q { class Rot3Q {
public: public:
@ -43,6 +45,9 @@ namespace gtsam {
public: public:
/// @name Constructors and named constructors
/// @{
/** default constructor, unit rotation */ /** default constructor, unit rotation */
Rot3Q() : quaternion_(Quaternion::Identity()) {} Rot3Q() : quaternion_(Quaternion::Identity()) {}
@ -53,7 +58,7 @@ namespace gtsam {
r1.y(), r2.y(), r3.y(), r1.y(), r2.y(), r3.y(),
r1.z(), r2.z(), r3.z()).finished()) {} r1.z(), r2.z(), r3.z()).finished()) {}
/** constructor from doubles in *row* order !!! */ /** constructor from a rotation matrix, as doubles in *row-major* order !!! */
Rot3Q(double R11, double R12, double R13, Rot3Q(double R11, double R12, double R13,
double R21, double R22, double R23, double R21, double R22, double R23,
double R31, double R32, double R33) : double R31, double R32, double R33) :
@ -62,7 +67,7 @@ namespace gtsam {
R21, R22, R23, R21, R22, R23,
R31, R32, R33).finished()) {} R31, R32, R33).finished()) {}
/** constructor from matrix */ /** constructor from a rotation matrix */
Rot3Q(const Matrix& R) : quaternion_(Eigen::Matrix3d(R)) {} Rot3Q(const Matrix& R) : quaternion_(Eigen::Matrix3d(R)) {}
/** Constructor from a quaternion. This can also be called using a plain /** Constructor from a quaternion. This can also be called using a plain
@ -71,7 +76,7 @@ namespace gtsam {
*/ */
Rot3Q(const Quaternion& q) : quaternion_(q) {} Rot3Q(const Quaternion& q) : quaternion_(q) {}
/** Constructor from a rotation matrix rotation Rot3M */ /** Constructor from a rotation matrix in a Rot3M */
Rot3Q(const Rot3M& r) : quaternion_(Eigen::Matrix3d(r.matrix())) {} Rot3Q(const Rot3M& r) : quaternion_(Eigen::Matrix3d(r.matrix())) {}
/* Static member function to generate some well known rotations */ /* Static member function to generate some well known rotations */
@ -99,7 +104,7 @@ namespace gtsam {
static Rot3Q roll (double t) { return Rx(t); } // positive roll is to right (increasing yaw in aircraft) static Rot3Q roll (double t) { return Rx(t); } // positive roll is to right (increasing yaw in aircraft)
static Rot3Q ypr (double y, double p, double r) { return RzRyRx(r,p,y);} static Rot3Q ypr (double y, double p, double r) { return RzRyRx(r,p,y);}
/** Create from Quaternion parameters */ /** Create from Quaternion coefficients */
static Rot3Q quaternion(double w, double x, double y, double z) { Quaternion q(w, x, y, z); return Rot3Q(q); } static Rot3Q quaternion(double w, double x, double y, double z) { Quaternion q(w, x, y, z); return Rot3Q(q); }
/** /**
@ -127,6 +132,7 @@ namespace gtsam {
static Rot3Q rodriguez(double wx, double wy, double wz) static Rot3Q rodriguez(double wx, double wy, double wz)
{ return rodriguez(Vector_(3,wx,wy,wz));} { return rodriguez(Vector_(3,wx,wy,wz));}
/// @}
/// @name Testable /// @name Testable
/// @{ /// @{
@ -140,12 +146,12 @@ namespace gtsam {
/// @name Group /// @name Group
/// @{ /// @{
/// identity for group operation /// identity rotation for group operation
inline static Rot3Q identity() { inline static Rot3Q identity() {
return Rot3Q(); return Rot3Q();
} }
/// derivative of inverse rotation R^T s.t. inverse(R)*R = Rot3Q() /// derivative of inverse rotation R^T s.t. inverse(R)*R = identity
Rot3Q inverse(boost::optional<Matrix&> H1=boost::none) const { Rot3Q inverse(boost::optional<Matrix&> H1=boost::none) const {
if (H1) *H1 = -matrix(); if (H1) *H1 = -matrix();
return Rot3Q(quaternion_.inverse()); return Rot3Q(quaternion_.inverse());
@ -226,7 +232,9 @@ namespace gtsam {
*/ */
Vector rpy() const; Vector rpy() const;
/** Compute the quaternion representation of this rotation. /** Compute the quaternion representation of this rotation - this is to
* maintain a standard Rot3 API with Rot3M, but here just returns the
* internal quaternion.
* @return The quaternion * @return The quaternion
*/ */
Quaternion toQuaternion() const { return quaternion_; } Quaternion toQuaternion() const { return quaternion_; }
@ -255,8 +263,6 @@ namespace gtsam {
Point3 unrotate(const Point3& p, Point3 unrotate(const Point3& p,
boost::optional<Matrix&> H1=boost::none, boost::optional<Matrix&> H2=boost::none) const; boost::optional<Matrix&> H1=boost::none, boost::optional<Matrix&> H2=boost::none) const;
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
private: private:
/** Serialization function */ /** Serialization function */
friend class boost::serialization::access; friend class boost::serialization::access;