diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-07-30 14:58:36 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-07-30 14:58:36 +0400 |
commit | 76e989d7b1303c877e8469513eae4ed746a8efe5 (patch) | |
tree | c67376b4919e0f3981ff11101164e76869a2832c /source/blender/blenlib | |
parent | 298a03ee634d2ef7eef0d4a7f1c23c7df7593a4c (diff) |
function renaming for own recently added BLI_math functions, suggested by Brecht.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_math_matrix.h | 2 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_math_vector.h | 6 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_matrix.c | 11 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_vector_inline.c | 9 |
4 files changed, 19 insertions, 9 deletions
diff --git a/source/blender/blenlib/BLI_math_matrix.h b/source/blender/blenlib/BLI_math_matrix.h index a4b0f449dc3..c305cc9a030 100644 --- a/source/blender/blenlib/BLI_math_matrix.h +++ b/source/blender/blenlib/BLI_math_matrix.h @@ -175,7 +175,7 @@ void mat4_to_size(float r[3], float M[4][4]); void translate_m4(float mat[4][4], float tx, float ty, float tz); void rotate_m4(float mat[4][4], const char axis, const float angle); void rotate_m2(float mat[2][2], const float angle); -void pivot_m4(float mat[4][4], const float pivot[3]); +void transform_pivot_set_m4(float mat[4][4], const float pivot[3]); void mat3_to_rot_size(float rot[3][3], float size[3], float mat3[3][3]); void mat4_to_loc_rot_size(float loc[3], float rot[3][3], float size[3], float wmat[4][4]); diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h index 6be679a90b6..38b377c640e 100644 --- a/source/blender/blenlib/BLI_math_vector.h +++ b/source/blender/blenlib/BLI_math_vector.h @@ -116,9 +116,9 @@ MINLINE void mul_v3_v3v3(float r[3], const float a[3], const float b[3]); MINLINE void mul_v4_fl(float r[4], float f); MINLINE void mul_v4_v4fl(float r[3], const float a[3], float f); MINLINE float mul_project_m4_v3_zfac(float mat[4][4], const float co[3]); -MINLINE float mul_m3_v3_single_x(float M[3][3], const float a[3]); -MINLINE float mul_m3_v3_single_y(float M[3][3], const float a[3]); -MINLINE float mul_m3_v3_single_z(float M[3][3], const float a[3]); +MINLINE float dot_m3_v3_row_x(float M[3][3], const float a[3]); +MINLINE float dot_m3_v3_row_y(float M[3][3], const float a[3]); +MINLINE float dot_m3_v3_row_z(float M[3][3], const float a[3]); MINLINE void madd_v3_v3fl(float r[3], const float a[3], float f); MINLINE void madd_v3_v3v3(float r[3], const float a[3], const float b[3]); diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c index 8565698110e..99342c4d6dc 100644 --- a/source/blender/blenlib/intern/math_matrix.c +++ b/source/blender/blenlib/intern/math_matrix.c @@ -1374,8 +1374,15 @@ void rotate_m2(float mat[2][2], const float angle) mat[1][0] = -mat[0][1]; } -/* scale or rotate around a non zero pivot */ -void pivot_m4(float mat[4][4], const float pivot[3]) +/** + * Scale or rotate around a pivot point, + * a convenience function to avoid having to do inline. + * + * Since its common to make a scale/rotation matrix that pivots around an arbitrary point. + * + * Typical use case is to make 3x3 matrix, copy to 4x4, then pass to this function. + */ +void transform_pivot_set_m4(float mat[4][4], const float pivot[3]) { float tmat[4][4]; diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c index eff735ef8d5..8e5040d983b 100644 --- a/source/blender/blenlib/intern/math_vector_inline.c +++ b/source/blender/blenlib/intern/math_vector_inline.c @@ -418,15 +418,18 @@ MINLINE float mul_project_m4_v3_zfac(float mat[4][4], const float co[3]) (mat[2][3] * co[2]) + mat[3][3]; } -MINLINE float mul_m3_v3_single_x(float M[3][3], const float a[3]) +/** + * Has the effect of mul_m3_v3(), on a single axis. + */ +MINLINE float dot_m3_v3_row_x(float M[3][3], const float a[3]) { return M[0][0] * a[0] + M[1][0] * a[1] + M[2][0] * a[2]; } -MINLINE float mul_m3_v3_single_y(float M[3][3], const float a[3]) +MINLINE float dot_m3_v3_row_y(float M[3][3], const float a[3]) { return M[0][1] * a[0] + M[1][1] * a[1] + M[2][1] * a[2]; } -MINLINE float mul_m3_v3_single_z(float M[3][3], const float a[3]) +MINLINE float dot_m3_v3_row_z(float M[3][3], const float a[3]) { return M[0][2] * a[0] + M[1][2] * a[1] + M[2][2] * a[2]; } |