diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-04-07 12:29:31 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-04-07 12:30:03 +0300 |
commit | 0d3195c8112ca6815d0f78dbbb389a8f631fea3b (patch) | |
tree | 2f40c34fc3d5e51a4fe9c51b67d0ac8ac839ae4d /source/blender/blenlib | |
parent | e031ace3d1d06c8c55b22c64bffc2988fa1d4153 (diff) |
Cleanup: add comments about dual quaternion scale handling.
Ref T63327
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/intern/math_rotation.c | 7 |
1 files changed, 6 insertions, 1 deletions
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) { |