[Bf-blender-cvs] [02f083cdcec] master: BLI_math_rotation: properly name the quaternion power function.

Alexander Gavrilov noreply at git.blender.org
Sun Dec 23 13:52:03 CET 2018


Commit: 02f083cdcecf74a169114850337a99c802c53e34
Author: Alexander Gavrilov
Date:   Sun Dec 23 15:25:40 2018 +0300
Branches: master
https://developer.blender.org/rB02f083cdcecf74a169114850337a99c802c53e34

BLI_math_rotation: properly name the quaternion power function.

"angular mult factor" is a completely unintelligible description
for a function that raises a unit quaternion to the scalar power.

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

M	source/blender/blenlib/BLI_math_rotation.h
M	source/blender/blenlib/intern/math_rotation.c
M	source/blender/editors/sculpt_paint/sculpt.c

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

diff --git a/source/blender/blenlib/BLI_math_rotation.h b/source/blender/blenlib/BLI_math_rotation.h
index 5b1568ab902..2bc82bac8d8 100644
--- a/source/blender/blenlib/BLI_math_rotation.h
+++ b/source/blender/blenlib/BLI_math_rotation.h
@@ -53,7 +53,8 @@ void copy_qt_qt(float q[4], const float a[4]);
 void mul_qt_qtqt(float q[4], const float a[4], const float b[4]);
 void mul_qt_v3(const float q[4], float r[3]);
 void mul_qt_fl(float q[4], const float f);
-void mul_fac_qt_fl(float q[4], const float f);
+
+void pow_qt_fl_normalized(float q[4], const float f);
 
 void sub_qt_qtqt(float q[4], const float a[4], const float b[4]);
 
diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c
index 3e74173ef78..8e5b3f0000e 100644
--- a/source/blender/blenlib/intern/math_rotation.c
+++ b/source/blender/blenlib/intern/math_rotation.c
@@ -193,9 +193,10 @@ void sub_qt_qtqt(float q[4], const float q1[4], const float q2[4])
 	mul_qt_qtqt(q, q1, nq2);
 }
 
-/* angular mult factor */
-void mul_fac_qt_fl(float q[4], const float fac)
+/* raise a unit quaternion to the specified power */
+void pow_qt_fl_normalized(float q[4], const float fac)
 {
+	BLI_ASSERT_UNIT_QUAT(q);
 	const float angle = fac * saacos(q[0]); /* quat[0] = cos(0.5 * angle), but now the 0.5 and 2.0 rule out */
 	const float co = cosf(angle);
 	const float si = sinf(angle);
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index a4605eddd79..5694c760371 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -276,7 +276,7 @@ static void sculpt_rake_rotate(
 	sub_v3_v3v3(vec_rot, v_co, sculpt_co);
 
 	copy_qt_qt(q_interp, ss->cache->rake_rotation_symmetry);
-	mul_fac_qt_fl(q_interp, factor);
+	pow_qt_fl_normalized(q_interp, factor);
 	mul_qt_v3(q_interp, vec_rot);
 
 	add_v3_v3(vec_rot, sculpt_co);



More information about the Bf-blender-cvs mailing list