[Bf-blender-cvs] [0d3195c8112] master: Cleanup: add comments about dual quaternion scale handling.

Brecht Van Lommel noreply at git.blender.org
Sun Apr 7 11:30:24 CEST 2019


Commit: 0d3195c8112ca6815d0f78dbbb389a8f631fea3b
Author: Brecht Van Lommel
Date:   Sun Apr 7 11:29:31 2019 +0200
Branches: master
https://developer.blender.org/rB0d3195c8112ca6815d0f78dbbb389a8f631fea3b

Cleanup: add comments about dual quaternion scale handling.

Ref T63327

===================================================================

M	source/blender/blenlib/intern/math_rotation.c

===================================================================

diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c
index 90eb76f19d9..b1bed27d2bd 100644
--- a/source/blender/blenlib/intern/math_rotation.c
+++ b/source/blender/blenlib/intern/math_rotation.c
@@ -1958,7 +1958,9 @@ void add_weighted_dq_dq(DualQuat *dqsum, const DualQuat *dq, float weight)
 	dqsum->trans[2] += weight * dq->trans[2];
 	dqsum->trans[3] += weight * dq->trans[3];
 
-	/* interpolate scale - but only if needed */
+	/* Interpolate scale - but only if there is scale present. If any dual
+	 * quaternions without scale are added, they will be compensated for in
+	 * normalize_dq. */
 	if (dq->scale_weight) {
 		float wmat[4][4];
 
@@ -1981,7 +1983,10 @@ void normalize_dq(DualQuat *dq, float totweight)
 	mul_qt_fl(dq->quat, scale);
 	mul_qt_fl(dq->trans, scale);
 
+	/* Handle scale if needed. */
 	if (dq->scale_weight) {
+		/* Compensate for any dual quaternions added without scale. This is an
+		 * optimization so that we can skip the scale part when not needed. */
 		float addweight = totweight - dq->scale_weight;
 
 		if (addweight) {



More information about the Bf-blender-cvs mailing list