diff --git a/gtsam/geometry/Rot3.h b/gtsam/geometry/Rot3.h index a0775c449..4f5322961 100644 --- a/gtsam/geometry/Rot3.h +++ b/gtsam/geometry/Rot3.h @@ -32,6 +32,7 @@ #endif #endif +#include #include #include @@ -49,7 +50,7 @@ namespace gtsam { * @ingroup geometry * \nosubgrouping */ - class Rot3 { + class Rot3 : public Value { public: static const size_t dimension = 3; @@ -92,6 +93,9 @@ namespace gtsam { */ Rot3(const Quaternion& q); + /** Virtual destructor */ + virtual ~Rot3() {} + /* Static member function to generate some well known rotations */ /// Rotation around X axis as in http://en.wikipedia.org/wiki/Rotation_matrix, counterclockwise when looking from unchanging axis. @@ -184,6 +188,9 @@ namespace gtsam { /** equals with an tolerance */ bool equals(const Rot3& p, double tol = 1e-9) const; + /** equals implementing generic Value interface */ + virtual bool equals_(const Value& p, double tol = 1e-9) const { return CallDerivedEquals(this, p, tol); } + /// @} /// @name Group /// @{ @@ -235,7 +242,7 @@ namespace gtsam { static size_t Dim() { return dimension; } /// return dimensionality of tangent space, DOF = 3 - size_t dim() const { return dimension; } + virtual size_t dim() const { return dimension; } /** * The method retract() is used to map from the tangent space back to the manifold. @@ -265,6 +272,12 @@ namespace gtsam { /// Returns local retract coordinates in neighborhood around current rotation Vector localCoordinates(const Rot3& t2, Rot3::CoordinatesMode mode = ROT3_DEFAULT_COORDINATES_MODE) const; + /// Generic Value interface version of retract + virtual std::auto_ptr retract_(const Vector& omega) const { return CallDerivedRetract(this, omega); } + + /// Generic Value interface version of localCoordinates + virtual Vector localCoordinates_(const Value& value) const { return CallDerivedLocalCoordinates(this, value); } + /// @} /// @name Lie Group /// @{