Skip to content

Commit 8cff599

Browse files
Rohan Budhirajaolivier-stasse
authored andcommitted
[c++] update the ostream output format for MatrixHomogeneous to [M,N]((,,,),(,,,),(,,,))
1 parent 198c54d commit 8cff599

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

include/dynamic-graph/eigen-io.h

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,21 @@ namespace Eigen {
138138

139139

140140

141+
142+
/* \brief Eigen Homogeneous Matrix output
143+
*
144+
* Matrix format: [M,N]((val11,val12,val13,...,val1N),...,(valM1,valM2,...,valMN))
145+
* e.g. [2,5]((1 23 32.2 12.12 32),(2 32 23 92.01 19.2))
146+
*/
147+
141148
inline std::ostream& operator << (std::ostream &os,
142149
Transform<double,3,Affine> MH) {
143-
os << MH.matrix(); return os; }
150+
IOFormat boostFmt(StreamPrecision, DontAlignCols,
151+
",", ",",
152+
"(",")",
153+
"(",")");
154+
155+
os << "[4,4]"<< MH.matrix().format(boostFmt); return os; }
144156

145157

146158
inline std::ostream& operator << (std::ostream &os,

include/dynamic-graph/linear-algebra.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#ifndef DYNAMIC_GRAPH_LINEAR_ALGEBRA_H
1919
#define DYNAMIC_GRAPH_LINEAR_ALGEBRA_H
2020
#include <Eigen/Core>
21+
#include <Eigen/Geometry>
2122

2223
namespace dynamicgraph {
2324
typedef Eigen::MatrixXd Matrix;

0 commit comments

Comments
 (0)