diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-08-23 13:46:11 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-08-23 13:46:11 +0400 |
commit | 2e2ea1ae212c8a660eb468119a7fb1bce17a46b9 (patch) | |
tree | 1f45428f8f610b87e60e2d66df9df0a4946a1f28 /source | |
parent | 9f72bf78652ec7e8e586dbe3b5b648bce8a1cfc6 (diff) |
set function args in BLI_math_rotation as const where possible.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenlib/BLI_math_rotation.h | 8 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_rotation.c | 19 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_lamp.c | 1 |
3 files changed, 15 insertions, 13 deletions
diff --git a/source/blender/blenlib/BLI_math_rotation.h b/source/blender/blenlib/BLI_math_rotation.h index b3702d10d87..87c065f3016 100644 --- a/source/blender/blenlib/BLI_math_rotation.h +++ b/source/blender/blenlib/BLI_math_rotation.h @@ -66,7 +66,7 @@ float normalize_qt(float q[4]); float normalize_qt_qt(float q1[4], const float q2[4]); /* comparison */ -int is_zero_qt(float q[4]); +bool is_zero_qt(const float q[4]); /* interpolation */ void interp_qt_qtqt(float q[4], const float a[4], const float b[4], const float t); @@ -163,13 +163,13 @@ typedef struct DualQuat { float scale_weight; } DualQuat; -void copy_dq_dq(DualQuat *r, DualQuat *dq); +void copy_dq_dq(DualQuat *r, const DualQuat *dq); void normalize_dq(DualQuat *dq, float totw); -void add_weighted_dq_dq(DualQuat *r, DualQuat *dq, float weight); +void add_weighted_dq_dq(DualQuat *r, const DualQuat *dq, float weight); void mul_v3m3_dq(float r[3], float R[3][3], DualQuat *dq); void mat4_to_dquat(DualQuat *r, float base[4][4], float M[4][4]); -void dquat_to_mat4(float R[4][4], DualQuat *dq); +void dquat_to_mat4(float R[4][4], const DualQuat *dq); void quat_apply_track(float quat[4], short axis, short upflag); void vec_apply_track(float vec[3], short axis); diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c index 9fd8c479d6e..c9919e7be37 100644 --- a/source/blender/blenlib/intern/math_rotation.c +++ b/source/blender/blenlib/intern/math_rotation.c @@ -62,7 +62,7 @@ void copy_qt_qt(float q1[4], const float q2[4]) q1[3] = q2[3]; } -int is_zero_qt(float *q) +bool is_zero_qt(const float q[4]) { return (q[0] == 0 && q[1] == 0 && q[2] == 0 && q[3] == 0); } @@ -993,7 +993,7 @@ void quat_to_eul(float *eul, const float quat[4]) } /* XYZ order */ -void eul_to_quat(float *quat, const float eul[3]) +void eul_to_quat(float quat[4], const float eul[3]) { float ti, tj, th, ci, cj, ch, si, sj, sh, cc, cs, sc, ss; @@ -1018,7 +1018,7 @@ void eul_to_quat(float *quat, const float eul[3]) } /* XYZ order */ -void rotate_eul(float *beul, const char axis, const float ang) +void rotate_eul(float beul[3], const char axis, const float ang) { float eul[3], mat1[3][3], mat2[3][3], totmat[3][3]; @@ -1229,7 +1229,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_to_eulo2(float M[3][3], float *e1, float *e2, const short order) +static void mat3_to_eulo2(float M[3][3], float e1[3], float e2[3], const short order) { const RotOrderInfo *R = GET_ROTATIONORDER_INFO(order); short i = R->axis[0], j = R->axis[1], k = R->axis[2]; @@ -1478,9 +1478,10 @@ void mat4_to_dquat(DualQuat *dq, float basemat[4][4], float mat[4][4]) dq->trans[3] = 0.5f * ( t[0] * q[2] - t[1] * q[1] + t[2] * q[0]); } -void dquat_to_mat4(float mat[4][4], DualQuat *dq) +void dquat_to_mat4(float mat[4][4], const DualQuat *dq) { - float len, *t, q0[4]; + float len, q0[4]; + const float *t; /* regular quaternion */ copy_qt_qt(q0, dq->quat); @@ -1502,7 +1503,7 @@ void dquat_to_mat4(float mat[4][4], DualQuat *dq) /* note: this does not handle scaling */ } -void add_weighted_dq_dq(DualQuat *dqsum, DualQuat *dq, float weight) +void add_weighted_dq_dq(DualQuat *dqsum, const DualQuat *dq, float weight) { int flipped = 0; @@ -1530,7 +1531,7 @@ void add_weighted_dq_dq(DualQuat *dqsum, DualQuat *dq, float weight) if (flipped) /* we don't want negative weights for scaling */ weight = -weight; - copy_m4_m4(wmat, dq->scale); + copy_m4_m4(wmat, (float(*)[4])dq->scale); mul_m4_fl(wmat, weight); add_m4_m4m4(dqsum->scale, dqsum->scale, wmat); dqsum->scale_weight += weight; @@ -1609,7 +1610,7 @@ void mul_v3m3_dq(float co[3], float mat[3][3], DualQuat *dq) } } -void copy_dq_dq(DualQuat *dq1, DualQuat *dq2) +void copy_dq_dq(DualQuat *dq1, const DualQuat *dq2) { memcpy(dq1, dq2, sizeof(DualQuat)); } diff --git a/source/blender/makesrna/intern/rna_lamp.c b/source/blender/makesrna/intern/rna_lamp.c index ffc9ac0e52e..f59f3db3652 100644 --- a/source/blender/makesrna/intern/rna_lamp.c +++ b/source/blender/makesrna/intern/rna_lamp.c @@ -26,6 +26,7 @@ #include <stdlib.h> +#include "BLI_sys_types.h" #include "BLI_math_base.h" #include "BLI_math_rotation.h" |