diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-09-11 00:45:47 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-09-11 00:45:47 +0400 |
commit | ab8d88ac18f7310889d11d21f94fdca400b428e0 (patch) | |
tree | 4745687538eee2c08ab0c6327f52a4799afbe924 /source/blender/blenlib/intern/math_rotation.c | |
parent | 734eaab54542644f6a031858b4ca280cd565dc6a (diff) |
add angle_to_mat2 utility function.
Diffstat (limited to 'source/blender/blenlib/intern/math_rotation.c')
-rw-r--r-- | source/blender/blenlib/intern/math_rotation.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c index c9919e7be37..6bac102e1b1 100644 --- a/source/blender/blenlib/intern/math_rotation.c +++ b/source/blender/blenlib/intern/math_rotation.c @@ -817,7 +817,8 @@ void mat4_to_axis_angle(float axis[3], float *angle, float mat[4][4]) quat_to_axis_angle(axis, angle, q); } -void single_axis_angle_to_mat3(float mat[3][3], const char axis, const float angle) +/* rotation matrix from a single axis */ +void axis_angle_to_mat3_single(float mat[3][3], const char axis, const float angle) { const float angle_cos = cosf(angle); const float angle_sin = sinf(angle); @@ -862,6 +863,18 @@ void single_axis_angle_to_mat3(float mat[3][3], const char axis, const float ang } } +void angle_to_mat2(float mat[2][2], const float angle) +{ + const float angle_cos = cosf(angle); + const float angle_sin = sinf(angle); + + /* 2D rotation matrix */ + mat[0][0] = angle_cos; + mat[0][1] = angle_sin; + mat[1][0] = -angle_sin; + mat[1][1] = angle_cos; +} + /******************************** XYZ Eulers *********************************/ /* XYZ order */ |