diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-06-23 03:58:52 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-06-23 03:58:52 +0400 |
commit | adba6952094388113cd750a252e28c3a32199b4e (patch) | |
tree | b5225e8e4a0c206d7c39c026f2f3a34529d300e9 | |
parent | 80ffe6f9b630e670fb58482caa3dd5f473a4f93f (diff) |
remove vec_rot_to_mat3(), replace with axis_angle_normalized_to_mat3()
-rw-r--r-- | source/blender/blenkernel/intern/armature.c | 4 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_math_rotation.h | 7 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_rotation.c | 29 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/drawobject.c | 4 | ||||
-rw-r--r-- | source/blender/editors/transform/transform.c | 20 |
5 files changed, 14 insertions, 50 deletions
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index d64ff4261dc..8fae3586439 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -1474,7 +1474,7 @@ void vec_roll_to_mat3(const float vec[3], const float roll, float mat[3][3]) theta = angle_normalized_v3v3(target, nor); /* Make Bone matrix*/ - vec_rot_to_mat3(bMatrix, axis, theta); + axis_angle_normalized_to_mat3(bMatrix, axis, theta); } else { /* if nor is a multiple of target ... */ @@ -1490,7 +1490,7 @@ void vec_roll_to_mat3(const float vec[3], const float roll, float mat[3][3]) } /* Make Roll matrix */ - vec_rot_to_mat3(rMatrix, nor, roll); + axis_angle_normalized_to_mat3(rMatrix, nor, roll); /* Combine and output result */ mul_m3_m3m3(mat, rMatrix, bMatrix); diff --git a/source/blender/blenlib/BLI_math_rotation.h b/source/blender/blenlib/BLI_math_rotation.h index b576ad7c8bb..b3702d10d87 100644 --- a/source/blender/blenlib/BLI_math_rotation.h +++ b/source/blender/blenlib/BLI_math_rotation.h @@ -106,13 +106,6 @@ void mat4_to_axis_angle(float axis[3], float *angle, float M[4][4]); void single_axis_angle_to_mat3(float R[3][3], const char axis, const float angle); -/****************************** Vector/Rotation ******************************/ -/* old axis angle code */ -/* TODO: the following calls should probably be deprecated sometime */ - -/* conversion */ -void vec_rot_to_mat3(float mat[3][3], const float vec[3], const float phi); - /******************************** XYZ Eulers *********************************/ void eul_to_quat(float quat[4], const float eul[3]); diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c index 38046825308..96664b776f0 100644 --- a/source/blender/blenlib/intern/math_rotation.c +++ b/source/blender/blenlib/intern/math_rotation.c @@ -861,35 +861,6 @@ void single_axis_angle_to_mat3(float mat[3][3], const char axis, const float ang } } -/****************************** Vector/Rotation ******************************/ -/* TODO: the following calls should probably be deprecated sometime */ - -/* TODO, replace use of this function with axis_angle_to_mat3() */ -void vec_rot_to_mat3(float mat[3][3], const float vec[3], const float phi) -{ - /* rotation of phi radials around vec */ - float vx, vx2, vy, vy2, vz, vz2, co, si; - - vx = vec[0]; - vy = vec[1]; - vz = vec[2]; - vx2 = vx * vx; - vy2 = vy * vy; - vz2 = vz * vz; - co = cosf(phi); - si = sinf(phi); - - mat[0][0] = vx2 + co * (1.0f - vx2); - mat[0][1] = vx * vy * (1.0f - co) + vz * si; - mat[0][2] = vz * vx * (1.0f - co) - vy * si; - mat[1][0] = vx * vy * (1.0f - co) - vz * si; - mat[1][1] = vy2 + co * (1.0f - vy2); - mat[1][2] = vy * vz * (1.0f - co) + vx * si; - mat[2][0] = vz * vx * (1.0f - co) + vy * si; - mat[2][1] = vy * vz * (1.0f - co) - vx * si; - mat[2][2] = vz2 + co * (1.0f - vz2); -} - /******************************** XYZ Eulers *********************************/ /* XYZ order */ diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 7d1864b8831..79ad62ee2e8 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -1160,8 +1160,8 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, short axis; /* setup a 45 degree rotation matrix */ - vec_rot_to_mat3(mat, imat[2], (float)M_PI / 4.0f); - + axis_angle_normalized_to_mat3(mat, imat[2], (float)M_PI / 4.0f); + /* vectors */ mul_v3_v3fl(v1, imat[0], circrad * 1.2f); mul_v3_v3fl(v2, imat[0], circrad * 2.5f); diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index ca31a4a98de..5ad5636bb21 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -3606,7 +3606,7 @@ static void applyRotation(TransInfo *t, float angle, float axis[3]) float mat[3][3]; int i; - vec_rot_to_mat3(mat, axis, angle); + axis_angle_normalized_to_mat3(mat, axis, angle); for (i = 0; i < t->total; i++, td++) { @@ -3618,10 +3618,10 @@ static void applyRotation(TransInfo *t, float angle, float axis[3]) if (t->con.applyRot) { t->con.applyRot(t, td, axis, NULL); - vec_rot_to_mat3(mat, axis, angle * td->factor); + axis_angle_normalized_to_mat3(mat, axis, angle * td->factor); } else if (t->flag & T_PROP_EDIT) { - vec_rot_to_mat3(mat, axis, angle * td->factor); + axis_angle_normalized_to_mat3(mat, axis, angle * td->factor); } ElementRotation(t, td, mat, t->around); @@ -3702,14 +3702,14 @@ void initTrackball(TransInfo *t) t->flag |= T_NO_CONSTRAINT; } -static void applyTrackball(TransInfo *t, float axis1[3], float axis2[3], float angles[2]) +static void applyTrackball(TransInfo *t, const float axis1[3], const float axis2[3], float angles[2]) { TransData *td = t->data; float mat[3][3], smat[3][3], totmat[3][3]; int i; - vec_rot_to_mat3(smat, axis1, angles[0]); - vec_rot_to_mat3(totmat, axis2, angles[1]); + axis_angle_normalized_to_mat3(smat, axis1, angles[0]); + axis_angle_normalized_to_mat3(totmat, axis2, angles[1]); mul_m3_m3m3(mat, smat, totmat); @@ -3721,8 +3721,8 @@ static void applyTrackball(TransInfo *t, float axis1[3], float axis2[3], float a continue; if (t->flag & T_PROP_EDIT) { - vec_rot_to_mat3(smat, axis1, td->factor * angles[0]); - vec_rot_to_mat3(totmat, axis2, td->factor * angles[1]); + axis_angle_normalized_to_mat3(smat, axis1, td->factor * angles[0]); + axis_angle_normalized_to_mat3(totmat, axis2, td->factor * angles[1]); mul_m3_m3m3(mat, smat, totmat); } @@ -3771,8 +3771,8 @@ int Trackball(TransInfo *t, const int UNUSED(mval[2])) ofs += BLI_snprintf(str + ofs, MAX_INFO_LEN - ofs, IFACE_(" Proportional size: %.2f"), t->prop_size); } - vec_rot_to_mat3(smat, axis1, phi[0]); - vec_rot_to_mat3(totmat, axis2, phi[1]); + axis_angle_normalized_to_mat3(smat, axis1, phi[0]); + axis_angle_normalized_to_mat3(totmat, axis2, phi[1]); mul_m3_m3m3(mat, smat, totmat); |