diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-10-22 19:08:17 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-10-22 19:09:28 +0300 |
commit | 80470b639c1c5091541c56ae80212fa8e5148913 (patch) | |
tree | f86e47e0213f7e93a5aa9adfec33380700ff51c4 /source/blender/editors/space_view3d/view3d_edit.c | |
parent | 0d54aa9c024261851bef24a3ebfd2bd875fec380 (diff) |
BLI_math: axis_angle_to_quat_single
Useful to avoid defining a vector for an axis-aligned rotation.
Matches axis_angle_to_mat3_single behavior.
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_edit.c')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_edit.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index cee0af933d0..aa533626ffc 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -1097,7 +1097,7 @@ static void viewrotate_apply(ViewOpsData *vod, int x, int y) mul_qt_qtqt(quat_local_x, vod->viewquat, quat_local_x); /* Perform the orbital rotation */ - axis_angle_normalized_to_quat(quat_global_z, zvec_global, sensitivity * vod->reverse * (x - vod->oldx)); + axis_angle_to_quat_single(quat_global_z, 'Z', sensitivity * vod->reverse * (x - vod->oldx)); mul_qt_qtqt(vod->viewquat, quat_local_x, quat_global_z); viewrotate_apply_dyn_ofs(vod, vod->viewquat); @@ -1482,10 +1482,7 @@ static void view3d_ndof_orbit(const struct wmNDOFMotionData *ndof, ScrArea *sa, rv3d->rot_axis[1] = 0; rv3d->rot_axis[2] = 1; - quat[0] = cosf(angle); - quat[1] = 0.0f; - quat[2] = 0.0f; - quat[3] = sinf(angle); + axis_angle_to_quat_single(quat, 'Z', angle * 2); mul_qt_qtqt(rv3d->viewquat, rv3d->viewquat, quat); } @@ -3992,14 +3989,12 @@ static int vieworbit_exec(bContext *C, wmOperator *op) } if (ELEM(orbitdir, V3D_VIEW_STEPLEFT, V3D_VIEW_STEPRIGHT)) { - const float zvec[3] = {0.0f, 0.0f, 1.0f}; - if (orbitdir == V3D_VIEW_STEPRIGHT) { angle = -angle; } /* z-axis */ - axis_angle_normalized_to_quat(quat_mul, zvec, angle); + axis_angle_to_quat_single(quat_mul, 'Z', angle); } else { |