Skip to content

Commit

Permalink
feat(wheelzoom): make it proportionnal to the distance
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaumebeuzeboc committed Nov 21, 2018
1 parent 81a2a04 commit db9f20d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <QDebug>
#include <QMouseEvent>
#include <QTimer>
#include <cmath>
#include <math.h>
#include <GL/glu.h>
#include <iostream>
#include <chrono>
Expand Down Expand Up @@ -111,9 +111,10 @@ class GLWidget : public QGLWidget{
double wheel_position = event->delta();

if(std::abs(wheel_position) > 700){return;}
double distance_to_zero = sqrt(pow(trans_(0,3),2) + pow(trans_(1,3),2) + pow(trans_(2,3) - 10,2));
trans_tmp_ << 1.0, 0.0, 0.0, 0.0,
0.0, 1.0, 0.0, 0.0,
0.0, 0.0, 1.0, wheel_position*0.0008,
0.0, 0.0, 1.0, wheel_position*0.0003*distance_to_zero,
0.0, 0.0, 0.0, 1.0;
trans_ = trans_tmp_ * trans_;
}
Expand Down

0 comments on commit db9f20d

Please sign in to comment.