Re: [eigen] Constructing a matrix by scalar*

[ Thread Index | Date Index | More Archives ]


typedef Map<Vector3f> Vector3fm;

then Vector3fm exactly represents what you were looking for. For instance:

float d[3] = {1,2,3};
Vector3fm v(d);

v += Vector3::Random();

there is no copy, v stores only a single pointer. You can also directly use a "Map" object:

Vector3f::Map(d) += Vector3::Random();


On Thu, Nov 27, 2008 at 3:45 PM, Benjamin Schindler <bschindler@xxxxxxxxxxxxxxx> wrote:

I'm currently working with vtk and it has a pretty ugly way of dealing with vectors /- /at least in my opinion. So I thought I could use eigen2 to do some of the fixed-size vector-math I'm doing. I found that Matrix has a data() function which returns a raw pointer to the data so that's good. But What I'm missing is a constructor which constructs a i.e. vector3f from a float pointer without copying the data. If I want to efficiently interact between vtk and eigen, I think this is very crucial.

Is this somehow possibel?



Mail converted by MHonArc 2.6.19+