diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-02-25 15:14:48 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-02-25 15:18:55 +0300 |
commit | 213ac7b1aceea3b5a210e86a07402d4415c9a6b6 (patch) | |
tree | 8be3e42eb746e074974e393e8b913d66b924c014 /source/blender/blenlib/intern/math_rotation.c | |
parent | 54a5059fe93d7e43177ac2f903a6c28e5db8d978 (diff) |
Cleanup: use const args for BLI_math_rotation
Diffstat (limited to 'source/blender/blenlib/intern/math_rotation.c')
-rw-r--r-- | source/blender/blenlib/intern/math_rotation.c | 53 |
1 files changed, 29 insertions, 24 deletions
diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c index c8d4ce9690b..a8629e93483 100644 --- a/source/blender/blenlib/intern/math_rotation.c +++ b/source/blender/blenlib/intern/math_rotation.c @@ -291,7 +291,7 @@ void quat_to_mat4(float m[4][4], const float q[4]) m[3][3] = 1.0f; } -void mat3_normalized_to_quat(float q[4], float mat[3][3]) +void mat3_normalized_to_quat(float q[4], const float mat[3][3]) { double tr, s; @@ -339,7 +339,7 @@ void mat3_normalized_to_quat(float q[4], float mat[3][3]) normalize_qt(q); } -void mat3_to_quat(float q[4], float m[3][3]) +void mat3_to_quat(float q[4], const float m[3][3]) { float unit_mat[3][3]; @@ -349,7 +349,7 @@ void mat3_to_quat(float q[4], float m[3][3]) mat3_normalized_to_quat(q, unit_mat); } -void mat4_normalized_to_quat(float q[4], float m[4][4]) +void mat4_normalized_to_quat(float q[4], const float m[4][4]) { float mat3[3][3]; @@ -357,7 +357,7 @@ void mat4_normalized_to_quat(float q[4], float m[4][4]) mat3_normalized_to_quat(q, mat3); } -void mat4_to_quat(float q[4], float m[4][4]) +void mat4_to_quat(float q[4], const float m[4][4]) { float mat3[3][3]; @@ -365,7 +365,7 @@ void mat4_to_quat(float q[4], float m[4][4]) mat3_to_quat(q, mat3); } -void mat3_to_quat_is_ok(float q[4], float wmat[3][3]) +void mat3_to_quat_is_ok(float q[4], const float wmat[3][3]) { float mat[3][3], matr[3][3], matn[3][3], q1[4], q2[4], angle, si, co, nor[3]; @@ -1033,7 +1033,7 @@ void axis_angle_to_mat4(float mat[4][4], const float axis[3], const float angle) } /* 3x3 matrix to axis angle */ -void mat3_normalized_to_axis_angle(float axis[3], float *angle, float mat[3][3]) +void mat3_normalized_to_axis_angle(float axis[3], float *angle, const float mat[3][3]) { float q[4]; @@ -1042,7 +1042,7 @@ void mat3_normalized_to_axis_angle(float axis[3], float *angle, float mat[3][3]) mat3_normalized_to_quat(q, mat); quat_to_axis_angle(axis, angle, q); } -void mat3_to_axis_angle(float axis[3], float *angle, float mat[3][3]) +void mat3_to_axis_angle(float axis[3], float *angle, const float mat[3][3]) { float q[4]; @@ -1053,7 +1053,7 @@ void mat3_to_axis_angle(float axis[3], float *angle, float mat[3][3]) } /* 4x4 matrix to axis angle */ -void mat4_normalized_to_axis_angle(float axis[3], float *angle, float mat[4][4]) +void mat4_normalized_to_axis_angle(float axis[3], float *angle, const float mat[4][4]) { float q[4]; @@ -1064,7 +1064,7 @@ void mat4_normalized_to_axis_angle(float axis[3], float *angle, float mat[4][4]) } /* 4x4 matrix to axis angle */ -void mat4_to_axis_angle(float axis[3], float *angle, float mat[4][4]) +void mat4_to_axis_angle(float axis[3], float *angle, const float mat[4][4]) { float q[4]; @@ -1279,7 +1279,7 @@ static void mat3_normalized_to_eul2(const float mat[3][3], float eul1[3], float } /* XYZ order */ -void mat3_normalized_to_eul(float eul[3], float mat[3][3]) +void mat3_normalized_to_eul(float eul[3], const float mat[3][3]) { float eul1[3], eul2[3]; @@ -1293,7 +1293,7 @@ void mat3_normalized_to_eul(float eul[3], float mat[3][3]) copy_v3_v3(eul, eul1); } } -void mat3_to_eul(float eul[3], float mat[3][3]) +void mat3_to_eul(float eul[3], const float mat[3][3]) { float unit_mat[3][3]; normalize_m3_m3(unit_mat, mat); @@ -1301,13 +1301,13 @@ void mat3_to_eul(float eul[3], float mat[3][3]) } /* XYZ order */ -void mat4_normalized_to_eul(float eul[3], float m[4][4]) +void mat4_normalized_to_eul(float eul[3], const float m[4][4]) { float mat3[3][3]; copy_m3_m4(mat3, m); mat3_normalized_to_eul(eul, mat3); } -void mat4_to_eul(float eul[3], float m[4][4]) +void mat4_to_eul(float eul[3], const float m[4][4]) { float mat3[3][3]; copy_m3_m4(mat3, m); @@ -1576,7 +1576,7 @@ void eulO_to_mat3(float M[3][3], const float e[3], const short order) } /* returns two euler calculation methods, so we can pick the best */ -static void mat3_normalized_to_eulo2(float mat[3][3], float eul1[3], float eul2[3], const short order) +static void mat3_normalized_to_eulo2(const float mat[3][3], float eul1[3], float eul2[3], const short order) { const RotOrderInfo *R = get_rotation_order_info(order); short i = R->axis[0], j = R->axis[1], k = R->axis[2]; @@ -1620,7 +1620,7 @@ void eulO_to_mat4(float mat[4][4], const float e[3], const short order) } /* Convert 3x3 matrix to Euler angles (in radians). */ -void mat3_normalized_to_eulO(float eul[3], const short order, float m[3][3]) +void mat3_normalized_to_eulO(float eul[3], const short order, const float m[3][3]) { float eul1[3], eul2[3]; float d1, d2; @@ -1638,7 +1638,7 @@ void mat3_normalized_to_eulO(float eul[3], const short order, float m[3][3]) copy_v3_v3(eul, eul1); } } -void mat3_to_eulO(float eul[3], const short order, float m[3][3]) +void mat3_to_eulO(float eul[3], const short order, const float m[3][3]) { float unit_mat[3][3]; normalize_m3_m3(unit_mat, m); @@ -1646,7 +1646,7 @@ void mat3_to_eulO(float eul[3], const short order, float m[3][3]) } /* Convert 4x4 matrix to Euler angles (in radians). */ -void mat4_normalized_to_eulO(float eul[3], const short order, float m[4][4]) +void mat4_normalized_to_eulO(float eul[3], const short order, const float m[4][4]) { float mat3[3][3]; @@ -1655,7 +1655,7 @@ void mat4_normalized_to_eulO(float eul[3], const short order, float m[4][4]) mat3_normalized_to_eulO(eul, order, mat3); } -void mat4_to_eulO(float eul[3], const short order, float m[4][4]) +void mat4_to_eulO(float eul[3], const short order, const float m[4][4]) { float mat3[3][3]; copy_m3_m4(mat3, m); @@ -1665,7 +1665,8 @@ void mat4_to_eulO(float eul[3], const short order, float m[4][4]) /* uses 2 methods to retrieve eulers, and picks the closest */ -void mat3_normalized_to_compatible_eulO(float eul[3], float oldrot[3], const short order, float mat[3][3]) +void mat3_normalized_to_compatible_eulO( + float eul[3], const float oldrot[3], const short order, const float mat[3][3]) { float eul1[3], eul2[3]; float d1, d2; @@ -1686,7 +1687,8 @@ void mat3_normalized_to_compatible_eulO(float eul[3], float oldrot[3], const sho copy_v3_v3(eul, eul1); } } -void mat3_to_compatible_eulO(float eul[3], float oldrot[3], const short order, float mat[3][3]) +void mat3_to_compatible_eulO( + float eul[3], const float oldrot[3], const short order, const float mat[3][3]) { float unit_mat[3][3]; @@ -1694,7 +1696,8 @@ void mat3_to_compatible_eulO(float eul[3], float oldrot[3], const short order, f mat3_normalized_to_compatible_eulO(eul, oldrot, order, unit_mat); } -void mat4_normalized_to_compatible_eulO(float eul[3], float oldrot[3], const short order, float m[4][4]) +void mat4_normalized_to_compatible_eulO( + float eul[3], const float oldrot[3], const short order, const float m[4][4]) { float mat3[3][3]; @@ -1702,7 +1705,8 @@ void mat4_normalized_to_compatible_eulO(float eul[3], float oldrot[3], const sho copy_m3_m4(mat3, m); mat3_normalized_to_compatible_eulO(eul, oldrot, order, mat3); } -void mat4_to_compatible_eulO(float eul[3], float oldrot[3], const short order, float m[4][4]) +void mat4_to_compatible_eulO( + float eul[3], const float oldrot[3], const short order, const float m[4][4]) { float mat3[3][3]; @@ -1712,7 +1716,8 @@ void mat4_to_compatible_eulO(float eul[3], float oldrot[3], const short order, f mat3_normalized_to_compatible_eulO(eul, oldrot, order, mat3); } -void quat_to_compatible_eulO(float eul[3], float oldrot[3], const short order, const float quat[4]) +void quat_to_compatible_eulO( + float eul[3], const float oldrot[3], const short order, const float quat[4]) { float unit_mat[3][3]; @@ -1801,7 +1806,7 @@ void eulO_to_gimbal_axis(float gmat[3][3], const float eul[3], const short order * - added support for scaling */ -void mat4_to_dquat(DualQuat *dq, float basemat[4][4], float mat[4][4]) +void mat4_to_dquat(DualQuat *dq, const float basemat[4][4], const float mat[4][4]) { float *t, *q, dscale[3], scale[3], basequat[4], mat3[3][3]; float baseRS[4][4], baseinv[4][4], baseR[4][4], baseRinv[4][4]; |