Re: [eigen] Quaternion initialization from Block/segment (Eigen 3 beta 1)

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


Thank you!
Works perfectly now :)

-Jens

On 22/07/2010, at 20.46, Gael Guennebaud wrote:

> On Thu, Jul 22, 2010 at 6:33 PM, Jens Andersen <jens.andersen@xxxxxxxxx> wrote:
>> Eigen::VectorXd myvector;
>> Eigen::Quaternion q(myvector.segment(3,4));
>> 
>> I'm not sure whether this method avoids the copy?
> 
> To make it compile you have to set the vector length at compile time:
> 
> Eigen::Quaternion q(myvector.segment<4>(3));
> 
> And indeed this copy the data to a new array. In Eigen3 you can map
> external memory as a Quaternion without any copy using Map:
> 
> Map<Quaterniond> q(myvector.segment(3,4).data());
> 
> or
> 
> Map<Quaterniond> q(&myvector(3));
> 
> gael
> 
> 




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