|Re: [eigen] Rigid Transformations in eigen: discussion thread|
[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Rigid Transformations in eigen: discussion thread
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Thu, 17 Sep 2009 12:42:17 -0400
- 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=GA8kF1hxN108o+8yvhZvZAOH69PWj5iZlL0waNhzECA=; b=kMGEsE/e7FSKPui4dvTP+ZSQ7I/5O6DvNZvKEf2VHI+P4QTLKWy3UHgveEBypXhtgb 5/Crcww1fx9u0c3n91KYH871nOc2x1y9XKNtghqUH/ppJCyHQ3ZQKZsq5crHbrB2e9OE rXrZjlXqVKNh4uGMM3USVjG+XoqH00b7rK90Q=
- 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=p1rByBvm7OU8Pjm3LeoT8iTW/Y3PsSGJBuC6kk712FaIaonsyhnFzGYMU0LNycTVYj 7f1PvYfOfvKDOVORgFby8sFtSynWzfVzx82L+L7YaiHTCdY1e2IHtRVzTIkUKqdtxmAN jRHeEQHPUVsBHxqXfLeyFT8kI+NNb1FfBlBlQ=
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:
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.