This bugzilla service is closed. All entries have been migrated to https://gitlab.com/libeigen/eigen
Bug 719 - [Feature Request] non-vector quaternions
Summary: [Feature Request] non-vector quaternions
Status: NEW
Alias: None
Product: Eigen
Classification: Unclassified
Component: Geometry (show other bugs)
Version: unspecified
Hardware: All All
: Normal enhancement
Assignee: Nobody
URL:
Whiteboard:
Keywords:
Depends on: 560
Blocks:
  Show dependency treegraph
 
Reported: 2013-12-19 11:21 UTC by J Baxter
Modified: 2019-12-04 12:53 UTC (History)
4 users (show)



Attachments

Description J Baxter 2013-12-19 11:21:48 UTC
Hello; I would like to float the idea of whether it might be possible to generalize the current implementation of quaternions as 4-vectors (internally, 4 by 1 matrices) to allow N columns of quaternions, stored within a 4 by N matrix internally.

My motivation is quaternion-based rigid body dynamics. The positions of N rigid bodies can gracefully be represented by an 3 by N matrix; this allows elegant features of Eigen like broadcasting and reductions to be used in place of more verbose for loops, and likely opens up optimization opportunities to the compiler.

It is my understanding that it is currently not possible to similarly aggregate quaternions without doing something complicated and error-prone like storing the quaternions as 4-vectors in a matrix, converting to quaternion type when read from the matrix and converting back to vector type when writing back to the matrix.

As far as implementation goes, would there be any issues with a simple wrapper around Matrix automating the conversion described in the previous paragraph? It might make sense to call the class something like QuaternionColumns. That may be cleaner than generalizing Quaternion itself.

Thank you very much for your consideration and time!
Comment 1 Christoph Hertzberg 2013-12-19 11:59:41 UTC
Maybe this could be solved by allowing standard linear algebra on quaternions (bug 560) and then allow matrixes like

  Matrix<Quaterniond, Dynamic, 1> Qn; // A vector of quaternions.

At the moment, you can use a quaternion map on each column (for both reading and writing).

  typedef Matrix<double, 4, Dynamic, ColMajor> QuatN;

  QuatN Qn;

  // Make Qi a read/write Quaternion view to the i-th column of Qn:
  QuaternionMapAlignedd  Qi(Qn.col(i).data());

lose the `Aligned` if you can't guarantee alignment for some reasons.
Comment 2 Nobody 2019-12-04 12:53:37 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/719.

Note You need to log in before you can comment on or make changes to this bug.