Re: [eigen] Mapping array of scalars into quaternions |

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

*To*: eigen@xxxxxxxxxxxxxxxxxxx*Subject*: Re: [eigen] Mapping array of scalars into quaternions*From*: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>*Date*: Thu, 22 Oct 2009 12:01:02 +0200*Dkim-signature*: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=dtXUAtsDGXxj+UX4EHkJrnIPz+K7o3hz044tqI92ZO0=; b=melZGJrAKVzSEtQmmU87JYWjEM/r2VcTkpFnvPduJVfeg+D8xRM9u+iDoPDfliXsJJ Zl762Lw5q88xfSJnmBsFBgJY5PgXQJqBI3WdmdvQL4P+SnonEPqMrkpiXkuZS+SRUYIz P8pEBQw7Jghu14UIQpeBaSlN+WcQZVAjkXd1o=*Domainkey-signature*: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=lIT2cjy2ZMuRsLm1Yh1dSv9GwarDVh3+JEb+u090Cl32GnBBcLhhw0Rg5+Sdcyx93H H/Ia+ES3vjoABWkV7J+MeOl7FTof3g7agn7M+5pwrZlauxvLEs14U5V+a1cZ0XyPTXLm UvHQXw7tD+e4OhQBz2D4bm+sTUU/iMqXr7IH4=

On Wed, Oct 21, 2009 at 2:24 PM, Mathieu Gautier <mathieu.gautier@xxxxxx> wrote:

note that here sizeof(Frame) wont be 7 * sizeof(_Scalars), so I'd rather make v and q member functions returning Mapped objects.

Hi,

I want to implement a class which hold both a quaternion and a vector3 to discribe a position of a frame in respect to an other frame (Something similar to Frame in KDL). For some historic reason, the memory layout must be a continuous array of scalar (Scalar[7]), the 3 first scalars are the vector3 and the other are the quaternion. Besides I have to interface this structure with other libraries which return an array of 7 scalars. I also have to map array of 4 scalars into the Quaternion class.

I though of something like that :

template<typename _Scalars>

struct Frame {

_Scalars[7] data;

Map<Matrix<3,1,_Scalars>> v;

Map<Quaternion<_Scalars>> q;

};

and setting the Map accordingly. However, there's no such concept of Map for the Quaternion class or RotationBase.

So, I modified the Quaternion class to use either a Matrix<Scalar,4,1> to store the quaternion coefficients or a Map<Matrix<Scalar,4,1>> to map an array of scalars. I added a argument to the template prototype of the quaternion class which I call StorageType which is either the Matrix or Map<Matrix>.

Since I have almost no experience with Eigen, I don't know if it's the better choice and if it could cause alignement issues. I have attached my modifications as a patch. This implementation may be incomplete.

So, to summarize, the Frame class would be:

template<typename _Scalars>

struct Frame {

_Scalars[7] data;

Map<Matrix<3,1,_Scalars>> v;

QuaternionMap<_Scalars> q;

};

where v is a mapping of data and q a mapping of data+3.

note that here sizeof(Frame) wont be 7 * sizeof(_Scalars), so I'd rather make v and q member functions returning Mapped objects.

--

Mathieu Gautier

**References**:**[eigen] Mapping array of scalars into quaternions***From:*Mathieu Gautier

**Messages sorted by:**[ date | thread ]- Prev by Date:
**Re: [eigen] Eigen namspace** - Next by Date:
**Re: [eigen] Mapping array of scalars into quaternions** - Previous by thread:
**Re: [eigen] Mapping array of scalars into quaternions** - Next by thread:
**[eigen] Map: introduce "AlignedPointer" flag?**

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