Registered Member
|
What's the explanation for why the order of the coefficients in the quaternion constructor (i.e. Quaternion q(w,x,y,z)) is different from the storage order? Is it likely to stay this way in the future for compatibility / historical reasons?
|
Moderator
|
For the storage order: this is to make sure that q.w() == q.vec().w(), q.x() == q.vec().x(), etc...
For the ctor, this is because the most common order to enumerate the quaternion of a coefficient is (w,x,y,z). |
Registered Member
|
I've gotten more used to seeing things enumerated in the storage order (4th element as the scalar part), which is what got me curious why the constructor was made differently. Oh well, I guess it's just a matter of preference and what books you read. Thanks
|
Registered Member
|
Hi,
I just found this post, dealing with eigen's Quaternion for the first time. If my voice counts, I would think rather strongly that the order should be the same in ctor as well as for storage, since one might use operator[] for component access. Either way it is, it is better than having 2 different ways IMHO. (In literature, from what I've seen the w+xi+yj+zk ordering is the most common, from what I've seen.) |
Registered users: Bing [Bot], Google [Bot], Sogou [Bot]