[eigen] Re: Quaternion initialization from Block/segment (Eigen 3 beta 1) |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen <eigen@xxxxxxxxxxxxxxxxxxx>
- Subject: [eigen] Re: Quaternion initialization from Block/segment (Eigen 3 beta 1)
- From: Jens Andersen <jens.andersen@xxxxxxxxx>
- Date: Thu, 22 Jul 2010 19:56:47 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:content-type:mime-version :subject:from:in-reply-to:date:content-transfer-encoding:message-id :references:to:x-mailer; bh=9g85dm0zJ6jhgbLb0SLPRJ9mAgx7pyI46H3TRh/3ppY=; b=W+YINB78hrBQVBx4TVzpfIMTaW5Cb/R80g7Zx2tTvqsRHT7ExmFpxz4DlanY7zPtYz FPhlKf2iuiH+PQHbsjg6xw46kkcCWfOSF5+TqQXnbfRB83KC3SKUtzafNVm7U/AqWX9m o4MYoS1Bu0gaPkL9rCBqEw4yDveqw//RcJZ/U=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to:x-mailer; b=L9c9HbBKapl1LbSSEjTlDozEi2Vwy62EAtmkXM8uomOKDVf+/L7b7xIis1RjEm6Qat iqtqOQsuSfkl5rknoXAl+z/28e78XVGac7kxYUHFljh/6WkLAIC+91eLQ5MbFdeDV1gq cXxUsgyHX6lNxZb/qLRL2HWlXNUflkC80EthA=
On a similar note.
Is it possible to do the following in a smarter way?
X_new.segment(3,4) = Eigen::Vector4d(q.x(), q.y(), q.z(), q.w());
Since the Quaternion class allows to be initialized using a Vector4d, shouldn't it be possible to set it back as well?
either
X_new.segment(3,4) = q;
or even just
Eigen::Vector4d vec = q;
Neither compiles.
-Jens
On 22/07/2010, at 18.33, Jens Andersen wrote:
> Hi from a long time lurker, one-time poster
>
> I'm trying to use eigen to efficiently work with a quaternion stored inside an Eigen::VectorXd (a state vector in an EKF-based SLAM)
>
> I have attempted to do the following:
>
> Eigen::VectorXd myvector;
> Eigen::Quaternion q(myvector.segment(3,4));
>
> I'm not sure whether this method avoids the copy?
>
> This doesn't work however, and gives the following error:
> /some/path/SLAM/src/Eigen/src/Geometry/Quaternion.h:443:0
> /some/path/SLAM/src/Eigen/src/Geometry/Quaternion.h:443: error: incomplete type 'Eigen::ei_quaternionbase_assign_impl<Eigen::Block<Eigen::Matrix<double, -0x00000000000000001, 1, 0, -0x00000000000000001, 1>, -0x00000000000000001, 1, true>, -0x00000000000000001, 1>' used in nested name specifier
>
> To me, this makes me think that Quaternion doesn't understand Eigen::Block. Is this the case or am I doing something wrong?
>
> I can "work-around" it by doing
> Eigen::Quaternion q(Eigen::Vector4d(myvector.segment(3,4)));
> but this seems sort of unclean (And presumably requires more copying?)
>
> Thanks,
> -Jens
>