Fixed accidentally deleted function

release/4.3a0
Paul Drews 2015-02-25 14:20:26 -05:00
parent abfcfa1a17
commit 5c40d62b56
3 changed files with 14 additions and 0 deletions

View File

@ -87,6 +87,9 @@ namespace gtsam {
/** constructor from a rotation matrix */ /** constructor from a rotation matrix */
Rot3(const Matrix3& R); Rot3(const Matrix3& R);
/** constructor from a rotation matrix */
Rot3(const Matrix& 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
* Vector, due to implicit conversion from Vector to Quaternion * Vector, due to implicit conversion from Vector to Quaternion
* @param q The quaternion * @param q The quaternion

View File

@ -55,6 +55,13 @@ Rot3::Rot3(const Matrix3& R) {
rot_ = R; rot_ = R;
} }
/* ************************************************************************* */
Rot3::Rot3(const Matrix& R) {
if (R.rows()!=3 || R.cols()!=3)
throw invalid_argument("Rot3 constructor expects 3*3 matrix");
rot_ = R;
}
/* ************************************************************************* */ /* ************************************************************************* */
Rot3::Rot3(const Quaternion& q) : rot_(q.toRotationMatrix()) { Rot3::Rot3(const Quaternion& q) : rot_(q.toRotationMatrix()) {
} }

View File

@ -52,6 +52,10 @@ namespace gtsam {
Rot3::Rot3(const Matrix3& R) : Rot3::Rot3(const Matrix3& R) :
quaternion_(R) {} quaternion_(R) {}
/* ************************************************************************* */
Rot3::Rot3(const Matrix& R) :
quaternion_(Matrix3(R)) {}
/* ************************************************************************* */ /* ************************************************************************* */
Rot3::Rot3(const Quaternion& q) : Rot3::Rot3(const Quaternion& q) :
quaternion_(q) { quaternion_(q) {