diff options
author | Campbell Barton <ideasman42@gmail.com> | 2016-12-28 09:44:36 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2016-12-28 10:10:34 +0300 |
commit | 6559ab2d511b1c0c1845342133505139166da4b3 (patch) | |
tree | 3e3f762563af1fe42e7e5f73afbd1f3ec37bcafe /source/blender/editors/space_view3d/view3d_edit.c | |
parent | d5edaac42d3b49e1a9abef1f7bcc54fb6f067ef8 (diff) |
3D View roll & orbit were scaling view-quat length
Over time roll and orbit would scale the quaternion
which is documented as unit length.
In practice any errors would be subtle,
but better normalize as other operators do.
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_edit.c')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_edit.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 620bbf03f32..2b53eb71d99 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -4064,6 +4064,9 @@ static int vieworbit_exec(bContext *C, wmOperator *op) mul_qt_qtqt(quat_new, rv3d->viewquat, quat_mul); + /* avoid precision loss over time */ + normalize_qt(quat_new); + if (view_opposite != RV3D_VIEW_USER) { rv3d->view = view_opposite; /* avoid float in-precision, just get a new orientation */ @@ -4130,6 +4133,10 @@ static void view_roll_angle(ARegion *ar, float quat[4], const float orig_quat[4] axis_angle_normalized_to_quat(quat_mul, dvec, angle); mul_qt_qtqt(quat, orig_quat, quat_mul); + + /* avoid precision loss over time */ + normalize_qt(quat); + rv3d->view = RV3D_VIEW_USER; } |