From 6959ad5e6f68e04fda56acd83b6a98f0c0c7ad7b Mon Sep 17 00:00:00 2001 From: Duy-Nguyen Ta Date: Thu, 8 Aug 2013 08:51:52 +0000 Subject: [PATCH] Fix error when wrapping a library using Rot3 to matlab: "type stored... is N5gtsam4Rot3E but requested type was N5gtsam4Rot3E", because gtsam is linked 2 times: one with the library, one with the mex, and somehow Rot3 is not virtual and exists in both. Moving print implementation to cpp seems to fix this problem. --- gtsam/geometry/Rot3.h | 2 +- gtsam/geometry/Rot3M.cpp | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gtsam/geometry/Rot3.h b/gtsam/geometry/Rot3.h index 9c99cd7aa..53895d7bb 100644 --- a/gtsam/geometry/Rot3.h +++ b/gtsam/geometry/Rot3.h @@ -181,7 +181,7 @@ namespace gtsam { /// @{ /** print */ - void print(const std::string& s="R") const { gtsam::print((Matrix)matrix(), s);} + void print(const std::string& s="R") const; /** equals with an tolerance */ bool equals(const Rot3& p, double tol = 1e-9) const; diff --git a/gtsam/geometry/Rot3M.cpp b/gtsam/geometry/Rot3M.cpp index 2663f1bf8..36f4ac258 100644 --- a/gtsam/geometry/Rot3M.cpp +++ b/gtsam/geometry/Rot3M.cpp @@ -69,6 +69,11 @@ Rot3::Rot3(const Matrix& R) { /* ************************************************************************* */ Rot3::Rot3(const Quaternion& q) : rot_(q.toRotationMatrix()) {} +/* ************************************************************************* */ +void Rot3::print(const std::string& s) const { + gtsam::print((Matrix)matrix(), s); +} + /* ************************************************************************* */ Rot3 Rot3::Rx(double t) { double st = sin(t), ct = cos(t);