Re: [eigen] initialize vector3d from array

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


On 11/6/2015 2:01 AM, Nico Schlömer wrote:
> Hi everyone,
> 
> I have a large array with the data organized like
> ```
> x0, y0, z0, x1, y1, z1, ...
> ```
> I would like to create some `const Vector3d` from these. How can I do
> that most efficiently?
> 
> Cheers,
> Nico

You can use a map:

double a[] = { ... };

Eigen::Map<const Eigen::Vector3d> > vec1(a);
Eigen::Map<const Eigen::Vector3d> > vec2(a + 3);

and so on.



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/