@@ -39,6 +39,7 @@ using dynamicgraph::ExceptionSignal;
39
39
*/
40
40
namespace Eigen {
41
41
typedef EIGEN_DEFAULT_DENSE_INDEX_TYPE eigen_index;
42
+
42
43
inline std::istringstream& operator >> (std::istringstream &iss,
43
44
dynamicgraph::Vector &inst) {
44
45
unsigned int _size;
@@ -88,7 +89,8 @@ namespace Eigen {
88
89
unsigned int _rowsize;
89
90
double _dbl_val;
90
91
char _ch;
91
- boost::format fmt (" Failed to enter %s as vector. Reenter as [N](val1,val2,val3,...,valN)" );
92
+ boost::format fmt (" Failed to enter %s as matrix. Reenter as ((val11,val12,val13,...,val1N),...,(valM1,valM2,...,valMN))" );
93
+ MatrixXd _tmp_matrix;
92
94
fmt %iss.str ();
93
95
if (iss>> _ch && _ch != ' [' ){
94
96
throw ExceptionSignal (ExceptionSignal::GENERIC, fmt.str ());
@@ -101,7 +103,7 @@ namespace Eigen {
101
103
if (iss.fail ())
102
104
throw ExceptionSignal (ExceptionSignal::GENERIC,fmt.str ());
103
105
else {
104
- inst .resize (_rowsize,_colsize);
106
+ _tmp_matrix .resize (_rowsize,_colsize);
105
107
if (iss >> _ch && _ch != ' ]' )
106
108
throw ExceptionSignal (ExceptionSignal::GENERIC, fmt.str ());
107
109
else {
@@ -115,7 +117,7 @@ namespace Eigen {
115
117
iss >> _dbl_val;
116
118
if (iss.peek () == ' ,' || iss.peek () == ' ' )
117
119
iss.ignore ();
118
- inst (j,i) = _dbl_val;
120
+ _tmp_matrix (j,i) = _dbl_val;
119
121
}
120
122
if (iss >> _ch && _ch != ' )' )
121
123
throw ExceptionSignal (ExceptionSignal::GENERIC, fmt.str ());
@@ -128,13 +130,14 @@ namespace Eigen {
128
130
}
129
131
}
130
132
}
133
+ inst = _tmp_matrix;
131
134
return iss;
132
135
}
133
136
134
137
135
138
inline std::istringstream& operator >> (std::istringstream &iss,
136
139
Transform<double ,3 ,Affine> &inst) {
137
- Matrix4d M; iss >> M; inst = M; return iss; }
140
+ MatrixXd M; iss >> M; inst. matrix () = M; return iss; }
138
141
139
142
140
143
@@ -157,12 +160,12 @@ namespace Eigen {
157
160
158
161
inline std::ostream& operator << (std::ostream &os,
159
162
AngleAxisd quat) {
160
- Vector4d v ; v (0 ) = quat.angle (); v.tail <3 >() = quat.axis ();
163
+ VectorXd v ( 4 ) ; v (0 ) = quat.angle (); v.tail <3 >() = quat.axis ();
161
164
os << v; return os; }
162
165
163
166
inline std::istringstream& operator >> (std::istringstream &iss,
164
167
AngleAxisd &inst) {
165
- Vector4d v ; iss >>v;
168
+ VectorXd v ( 4 ) ; iss >>v;
166
169
inst.angle () = v (0 ); inst.axis () = v.tail <3 >();
167
170
return iss; }
168
171
0 commit comments