diff options
author | Campbell Barton <campbell@blender.org> | 2022-08-21 08:06:28 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-08-22 04:20:40 +0300 |
commit | b04514da5d19f69a504372ef5c6a204ca82c2e65 (patch) | |
tree | 3bd0f0bbf02071675c4ead5126eac422c205e2d9 /source/blender/blenlib/BLI_math_rotation.h | |
parent | 5bd1d63115e2867c90c1426ff506a2cc3823f3ef (diff) |
Cleanup: match names between functions & declarations
Mostly update the declarations, in some cases rename in the function
especially when the names used were inconstant with related functions.
Diffstat (limited to 'source/blender/blenlib/BLI_math_rotation.h')
-rw-r--r-- | source/blender/blenlib/BLI_math_rotation.h | 74 |
1 files changed, 43 insertions, 31 deletions
diff --git a/source/blender/blenlib/BLI_math_rotation.h b/source/blender/blenlib/BLI_math_rotation.h index b8ab74d95ff..d4b97b85134 100644 --- a/source/blender/blenlib/BLI_math_rotation.h +++ b/source/blender/blenlib/BLI_math_rotation.h @@ -71,7 +71,7 @@ void mul_qt_fl(float q[4], float f); /** * Raise a unit quaternion to the specified power. */ -void pow_qt_fl_normalized(float q[4], float f); +void pow_qt_fl_normalized(float q[4], float fac); void sub_qt_qtqt(float q[4], const float a[4], const float b[4]); @@ -109,8 +109,8 @@ void add_qt_qtqt(float q[4], const float a[4], const float b[4], float t); /* Conversion. */ -void quat_to_mat3(float mat[3][3], const float q[4]); -void quat_to_mat4(float mat[4][4], const float q[4]); +void quat_to_mat3(float m[3][3], const float q[4]); +void quat_to_mat4(float m[4][4], const float q[4]); /** * Apply the rotation of \a a to \a q keeping the values compatible with \a old. @@ -157,7 +157,10 @@ void rotation_between_quats_to_quat(float q[4], const float q1[4], const float q * \param r_twist: if not NULL, receives the twist quaternion. * \returns twist angle. */ -float quat_split_swing_and_twist(const float q[4], int axis, float r_swing[4], float r_twist[4]); +float quat_split_swing_and_twist(const float q_in[4], + int axis, + float r_swing[4], + float r_twist[4]); float angle_normalized_qt(const float q[4]); float angle_normalized_qtqt(const float q1[4], const float q2[4]); @@ -172,7 +175,7 @@ float angle_signed_qtqt(const float q1[4], const float q2[4]); /** * TODO: don't what this is, but it's not the same as #mat3_to_quat. */ -void mat3_to_quat_is_ok(float q[4], const float mat[3][3]); +void mat3_to_quat_is_ok(float q[4], const float wmat[3][3]); /* Other. */ @@ -235,16 +238,16 @@ void axis_angle_to_mat4(float R[4][4], const float axis[3], float angle); /** * 3x3 matrix to axis angle. */ -void mat3_normalized_to_axis_angle(float axis[3], float *angle, const float M[3][3]); +void mat3_normalized_to_axis_angle(float axis[3], float *angle, const float mat[3][3]); /** * 4x4 matrix to axis angle. */ -void mat4_normalized_to_axis_angle(float axis[3], float *angle, const float M[4][4]); -void mat3_to_axis_angle(float axis[3], float *angle, const float M[3][3]); +void mat4_normalized_to_axis_angle(float axis[3], float *angle, const float mat[4][4]); +void mat3_to_axis_angle(float axis[3], float *angle, const float mat[3][3]); /** * 4x4 matrix to axis angle. */ -void mat4_to_axis_angle(float axis[3], float *angle, const float M[4][4]); +void mat4_to_axis_angle(float axis[3], float *angle, const float mat[4][4]); /** * Quaternions to Axis Angle. */ @@ -283,19 +286,19 @@ void eul_to_mat3(float mat[3][3], const float eul[3]); void eul_to_mat4(float mat[4][4], const float eul[3]); void mat3_normalized_to_eul(float eul[3], const float mat[3][3]); -void mat4_normalized_to_eul(float eul[3], const float mat[4][4]); +void mat4_normalized_to_eul(float eul[3], const float m[4][4]); void mat3_to_eul(float eul[3], const float mat[3][3]); void mat4_to_eul(float eul[3], const float mat[4][4]); void quat_to_eul(float eul[3], const float quat[4]); -void mat3_normalized_to_compatible_eul(float eul[3], const float old[3], float mat[3][3]); -void mat3_to_compatible_eul(float eul[3], const float old[3], float mat[3][3]); +void mat3_normalized_to_compatible_eul(float eul[3], const float oldrot[3], float mat[3][3]); +void mat3_to_compatible_eul(float eul[3], const float oldrot[3], float mat[3][3]); void quat_to_compatible_eul(float eul[3], const float oldrot[3], const float quat[4]); -void rotate_eul(float eul[3], char axis, float angle); +void rotate_eul(float beul[3], char axis, float angle); /* Order independent. */ -void compatible_eul(float eul[3], const float old[3]); +void compatible_eul(float eul[3], const float oldrot[3]); void add_eul_euleul(float r_eul[3], float a[3], float b[3], short order); void sub_eul_euleul(float r_eul[3], float a[3], float b[3], short order); @@ -323,15 +326,15 @@ typedef enum eEulerRotationOrders { /** * Construct quaternion from Euler angles (in radians). */ -void eulO_to_quat(float quat[4], const float eul[3], short order); +void eulO_to_quat(float q[4], const float e[3], short order); /** * Construct 3x3 matrix from Euler angles (in radians). */ -void eulO_to_mat3(float mat[3][3], const float eul[3], short order); +void eulO_to_mat3(float M[3][3], const float e[3], short order); /** * Construct 4x4 matrix from Euler angles (in radians). */ -void eulO_to_mat4(float mat[4][4], const float eul[3], short order); +void eulO_to_mat4(float mat[4][4], const float e[3], short order); /** * Euler Rotation to Axis Angle. */ @@ -344,17 +347,17 @@ void eulO_to_gimbal_axis(float gmat[3][3], const float eul[3], short order); /** * Convert 3x3 matrix to Euler angles (in radians). */ -void mat3_normalized_to_eulO(float eul[3], short order, const float mat[3][3]); +void mat3_normalized_to_eulO(float eul[3], short order, const float m[3][3]); /** * Convert 4x4 matrix to Euler angles (in radians). */ -void mat4_normalized_to_eulO(float eul[3], short order, const float mat[4][4]); -void mat3_to_eulO(float eul[3], short order, const float mat[3][3]); -void mat4_to_eulO(float eul[3], short order, const float mat[4][4]); +void mat4_normalized_to_eulO(float eul[3], short order, const float m[4][4]); +void mat3_to_eulO(float eul[3], short order, const float m[3][3]); +void mat4_to_eulO(float eul[3], short order, const float m[4][4]); /** * Convert quaternion to Euler angles (in radians). */ -void quat_to_eulO(float eul[3], short order, const float quat[4]); +void quat_to_eulO(float e[3], short order, const float q[4]); /** * Axis Angle to Euler Rotation. */ @@ -363,18 +366,27 @@ void axis_angle_to_eulO(float eul[3], short order, const float axis[3], float an /* Uses 2 methods to retrieve eulers, and picks the closest. */ void mat3_normalized_to_compatible_eulO(float eul[3], - const float old[3], + const float oldrot[3], short order, const float mat[3][3]); void mat4_normalized_to_compatible_eulO(float eul[3], - const float old[3], + const float oldrot[3], short order, const float mat[4][4]); -void mat3_to_compatible_eulO(float eul[3], const float old[3], short order, const float mat[3][3]); -void mat4_to_compatible_eulO(float eul[3], const float old[3], short order, const float mat[4][4]); -void quat_to_compatible_eulO(float eul[3], const float old[3], short order, const float quat[4]); - -void rotate_eulO(float eul[3], short order, char axis, float angle); +void mat3_to_compatible_eulO(float eul[3], + const float oldrot[3], + short order, + const float mat[3][3]); +void mat4_to_compatible_eulO(float eul[3], + const float oldrot[3], + short order, + const float mat[4][4]); +void quat_to_compatible_eulO(float eul[3], + const float oldrot[3], + short order, + const float quat[4]); + +void rotate_eulO(float beul[3], short order, char axis, float angle); /** \} */ @@ -383,7 +395,7 @@ void rotate_eulO(float eul[3], short order, char axis, float angle); * \{ */ void copy_dq_dq(DualQuat *r, const DualQuat *dq); -void normalize_dq(DualQuat *dq, float totw); +void normalize_dq(DualQuat *dq, float totweight); void add_weighted_dq_dq(DualQuat *dq_sum, const DualQuat *dq, float weight); void mul_v3m3_dq(float r[3], float R[3][3], DualQuat *dq); @@ -400,7 +412,7 @@ void vec_apply_track(float vec[3], short axis); * Lens/angle conversion (radians). */ float focallength_to_fov(float focal_length, float sensor); -float fov_to_focallength(float fov, float sensor); +float fov_to_focallength(float hfov, float sensor); float angle_wrap_rad(float angle); float angle_wrap_deg(float angle); |