Added matrix dimension check in constructor (because MATLAB crashed)

release/4.3a0
Frank Dellaert 2012-01-16 16:10:15 +00:00
parent 7bd41e92d4
commit c58aa67a25
1 changed files with 7 additions and 4 deletions

View File

@ -49,10 +49,13 @@ Rot3::Rot3(double R11, double R12, double R13,
r3_(Point3(R13, R23, R33)) {} r3_(Point3(R13, R23, R33)) {}
/* ************************************************************************* */ /* ************************************************************************* */
Rot3::Rot3(const Matrix& R): Rot3::Rot3(const Matrix& R) {
r1_(Point3(R(0,0), R(1,0), R(2,0))), if (R.rows()!=3 || R.cols()!=3)
r2_(Point3(R(0,1), R(1,1), R(2,1))), throw invalid_argument("Rot3 constructor expects 3*3 matrix");
r3_(Point3(R(0,2), R(1,2), R(2,2))) {} r1_ = Point3(R(0, 0), R(1, 0), R(2, 0));
r2_ = Point3(R(0, 1), R(1, 1), R(2, 1));
r3_ = Point3(R(0, 2), R(1, 2), R(2, 2));
}
/* ************************************************************************* */ /* ************************************************************************* */
Rot3::Rot3(const Quaternion& q) { Rot3::Rot3(const Quaternion& q) {