Levan Shoshiashvili
Levan Shoshiashvili

Reputation: 103

Eigen Matrix of Vector3d gives strange error

I need container of 3D vectors and tried this:

//typedef Eigen::Matrix<Vector3d, -1, 1> Field3X;
typedef Eigen::Matrix<Vector3d, Dynamic, 1>  Field3X;
Field3X vecMat(3);
Vector3d v(1.0,3.0,4.0);

vecMat(0)=  v;
vecMat(1) = v;
vecMat(2) = v;
cout << "Here is vecMat:\n" << vecMat << endl;

Calling cout line gives strange error:

Error   3   error C2665: 'log10' : none of the 3 overloads could convert all 
the argument types  d:\eigen-eigen-
5a0156e40feb\eigen\src\Core\NumTraits.h 34  1   

What is better way to have array of Vector3d objects? p.s. yes I know, I can use stl vector with alignment macro, but which one is better for faster access an manipulations?

Upvotes: 0

Views: 567

Answers (1)

RHertel
RHertel

Reputation: 23788

The stream output operator << is not defined / overlaoded for the type that you want to display. You can use this instead:

for (int i = 0; i < vecMat.size(); ++i) {
 cout << "Here is vecMat(" << i << "):\n" << vecMat(i) << endl;
}

Upvotes: 1

Related Questions