I try to read out elements from a 3D matrix created using the std c++ dynamic container for vectors. Below is how I initialize my matrix:
typedef vector<vector<vector<ClassA> > > matrix3D;
In my class named "ClassA", I have the following public members:
double a, b, c;
Then in my main file, I fill in the matrix with:
double varA=M_PI; double varB=varA; double varC=varA;
matrix3D[i][j][k].a = varA;
matrix3D[i][j][k].b = varB;
matrix3D[i][j][k].c = varC;
Now when I read the doubles into a vector created using Eigen/Dense library, the type of the vector becomes a matrix:
Vector3d vectorEigen;
vectorEigen << matrix3D[i][j][k].a, matrix3D[i][j][k].b, matrix3D[i][j][k].c;
and vectorEigen
becomes a variable of the type Eigen::Matrix<double, 3,1,0,3,1>
Does anybody have a clue what I have missed here?
vectorEigen
is not the real issue anymore. Maybe you're wrestling with some other issue? Actually, don't you needvectorEigen << matrix3D[i][j][k].a << matrix3D[i][j][k].b << matrix3D[i][j][k].c;
instead ofvectorEigen << matrix3D[i][j][k].a, matrix3D[i][j][k].b, matrix3D[i][j][k].c;
– WhiteVikingvectorEigen << matrix3D[i][j][k].a << matrix3D[i][j][k].b << matrix3D[i][j][k].c;
is giving me an error, unfortunately :( The problem occurs when I call the function which takes a Vector3d as input parameter. SubstitutingvectorEigen
as input parameter of the function causes the compiler to complain. And the reason is the function with an input of the typeEigen::Matrix<double, 3,1,0,3,1>
is undefined. – bull