Registered Member
|
What is in Eigen the best, fastest and memory conservative to map a vector of floats with the following data layout:
to a
where obviously every Vector3f contains the 3 elements x,y,z? |
Moderator
|
That's not possible, and the best is to map it as a Matrix<float,3,Dynamic,ColMajor> so that you can exploit all the poser of Eigen:
As you see, no more loops! If you want something like a std::vector<Vector3f>, you can cast '&vec.at(0)' to a Vector3f* pointer, and if you need the same API (.begin(), .end(), .size(), etc.) then you to write your own wrapper. |
Registered Member
|
Cool thanks, this is what I was looking for. I like to avoid loops and exploit vectorization when possible! In particular since the vector of float are vertices to be sent to GPU I can now simply apply eigen operations to the vertices and compare the GLSL shader results with CPU results
|
Registered users: Bing [Bot], Google [Bot], Sogou [Bot], Yahoo [Bot]