This bugzilla service is closed. All entries have been migrated to

Bug 459

Summary: [feature request] Quaternion as rotation & scaling
Product: Eigen Reporter: Hauke Strasdat <strasdat>
Component: GeometryAssignee: Nobody <eigen.nobody>
Status: DECISIONNEEDED ---    
Severity: Feature Request CC: chtz, gael.guennebaud, hauke.heibel, jacob.benoit.1
Priority: Normal    
Version: 3.1   
Hardware: All   
OS: All   
Bug Depends on: 560, 758    
Bug Blocks:    
Description Flags
strasdat: review? (gael.guennebaud)
Another patch: Rotate and scale a vector strasdat: review? (gael.guennebaud)

Description Hauke Strasdat 2012-05-05 23:57:08 UTC
Created attachment 267 [details]

While unit quaternions represent rotations in 3d, general quaternions 
can be interpreted as the group of rotation and scaling. It would be nice if corresponding feature would be added to the Quaternion class. 
I added a patch which contains the conversion from a general quaternion 
to a matrix of rotation & scaling.
Comment 1 Hauke Strasdat 2012-05-06 18:41:38 UTC
Created attachment 268 [details]
Another patch: Rotate and scale a vector

Another patch: Rotate and scale a vector
Comment 2 Gael Guennebaud 2012-05-14 13:08:08 UTC
thanks for the patches, I'm too busy ATM, I'll look at it next week.
Comment 3 Christoph Hertzberg 2014-06-15 04:14:21 UTC
Both things would be more consistent with the `q*[0;v]*q.conjugate()` definition of quaternion rotation using this definition:

	  Scalar scale = this->squaredNorm();
	  Vector3 imag_cross_v = this->vec().cross(v);
	  imag_cross_v += imag_cross_v;
	  return scale*v + (this->w() * imag_cross_v
	                      + this->vec().cross(imag_cross_v));

This would also save a sqrt, an if-branch, and a division.
Furthermore, the result would be smooth everywhere (Hauke's implementation is not near zero).
For the matrix conversion the changes are equivalent. 

Drawback: For scaling with s, the quaternion must be scaled with sqrt(s) -- but that would actually make it more obvious that scaling with negative numbers is not possible (or rather that scaling with -1.0 has no effect).
Comment 4 Gael Guennebaud 2014-06-16 13:30:30 UTC
I agree that it should follow the standard way to apply quaternions to vector, i.e.: 'q*[0;v]*q.conjugate()' . The conversion to matrices should be factorized to avoid duplicated code.
Comment 5 Nobody 2019-12-04 11:39:01 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to'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: