[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [46033] trunk/blender/source/blender/ blenlib/intern/math_rotation.c: patch [#31104] Correct comment for mul_qt_v3

Campbell Barton ideasman42 at gmail.com
Sat Apr 28 13:45:29 CEST 2012


Revision: 46033
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=46033
Author:   campbellbarton
Date:     2012-04-28 11:45:28 +0000 (Sat, 28 Apr 2012)
Log Message:
-----------
patch [#31104] Correct comment for mul_qt_v3
from Bill Currie (taniwha)

Modified Paths:
--------------
    trunk/blender/source/blender/blenlib/intern/math_rotation.c

Modified: trunk/blender/source/blender/blenlib/intern/math_rotation.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/math_rotation.c	2012-04-28 10:36:33 UTC (rev 46032)
+++ trunk/blender/source/blender/blenlib/intern/math_rotation.c	2012-04-28 11:45:28 UTC (rev 46033)
@@ -78,7 +78,23 @@
 	q[2] = t2;
 }
 
-/* Assumes a unit quaternion */
+/**
+ * \note:
+ * Assumes a unit quaternion?
+ *
+ * infact not, but you may wan't to use a unit quat, read on...
+ *
+ * Shortcut for 'q v q*' when \a v is actually a quaternion.
+ * This removes the need for converting a vector to a quaternion,
+ * calculating q's conjugate and converting back to a vector.
+ * It also happens to be faster (17+,24* vs * 24+,32*).
+ * If \a q is not a unit quaternion, then \a v will be both rotated by
+ * the same amount as if q was a unit quaternion, and scaled by the square of
+ * the length of q.
+ *
+ * For people used to python mathutils, its like:
+ * def mul_qt_v3(q, v): (q * Quaternion((0.0, v[0], v[1], v[2])) * q.conjugated())[1:]
+ */
 void mul_qt_v3(const float q[4], float v[3])
 {
 	float t0, t1, t2;




More information about the Bf-blender-cvs mailing list