Re: [eigen] Rigid Transformations in eigen: discussion thread |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Rigid Transformations in eigen: discussion thread
- From: Rohit Garg <rpg.314@xxxxxxxxx>
- Date: Thu, 17 Sep 2009 22:22:32 +0530
- 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 :content-transfer-encoding; bh=plH232gmVkCkxd9cWdGA31YIF6aee1DWbHbrX8R9SI8=; b=F4Pu0dpzg5ON4It3uelNzogb1xZAfaXtzvO1id8SWlt0kAg7voPWw00ihm/jBscah/ nRE7WzMLJkkZsagdhsZlAPnWjoX/hsNc2dQqdspcqa70IHq5ZrAOZlb60aBjd2LWSVi7 f847s9PIjqhsTZOmnYskvyUv/Mzh40Ec3eWGg=
- 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:content-transfer-encoding; b=PWy4+XrtMA481m1EHSK5edf6SOjU0xEXwfxpQQLzPszxZJPkhcast5ZUqTRzZr0Esq TkqtqJtoUr3G23me3cr63YGZyzWlPttMcUqBVKjWtehEhYhrn+UUIZQ54e7xztu5azp2 dylx8hl71fOfUgTyRvITu7SwSfZWOkDnOarJE=
On Thu, Sep 17, 2009 at 10:12 PM, Benoit Jacob <jacob.benoit.1@xxxxxxxxx> wrote:
> 2009/9/17 Benoit Jacob <jacob.benoit.1@xxxxxxxxx>:
>> Here's a little idea to make it more easy for the user to do his own
>> operations like sum.
>
> Oh, I just thought about something better, with fewer changes:
>
> Since your 2 quats are an array, you know they're adjacent in memory,
> so you can just make the coeffs() method reinterpret_cast the address
> of the first quat!
>
> So you keep the same data members that you currently have, and add this method:
>
> Vector8Type &coeffs()
> {
> return *reinterpret_cast<Vector8Type*>(&m_quats[0]);
> }
>
> Actually you could also do this with a Map<Vector8Type> but 1) you'd
> have to do ForceAligned or something like that to tell him that the
> ptr is aligned, i don't remember exactly how that works, and 2) that
> would be just more complicated code for the same thing.
>
> Notice that this reinterpret_cast trick only works with fixed-size
> objects! If you had dynamic size objects, the Map<...> would be the
> only way to do that.
>
> Also here we're assuming that quaternions and vector8's have the same
> alignment requirements. That's currently always true. It'll be false
> in the future if a platform has 256 bit packets.
If you are talking about AVX, then AFAIK, it won't need 32 byte
alignment. It'll happily work with 16 byte aligned pointers.
>
> Benoit
>
>
>
--
Rohit Garg
http://rpg-314.blogspot.com/
Senior Undergraduate
Department of Physics
Indian Institute of Technology
Bombay