Illustrative Line Visualization
Implementation of the method by Everts et al. for visualizing dense line data.
camera.h
1 #ifndef CAMERA_H
2 #define CAMERA_H
3 
4 #include "math.h"
5 
6 #include <QMatrix4x4>
7 #include <QVector2D>
8 #include <QVector3D>
9 
13 class Camera : public QObject
14 {
15  Q_OBJECT
16 
17  public:
18 
28  Camera(QObject* parent, float minDist, float maxDist, float initDist = .0f, float initYaw = .0f, float initPitch = .0f);
29 
34  void getViewMatrix(QMatrix4x4& viewMatrix);
35 
40  void getProjectionMatrix(QMatrix4x4& projMatrix);
41 
42  public slots:
43 
48  void setAspectRatio(float aspectRatio);
49 
55  void setNearFarPlane(float near, float far);
56 
61  void rotateX(float angle);
62 
67  void rotateY(float angle);
68 
73  void move(const QVector2D& offset);
74 
79  void zoom(float distance);
80 
81  private:
82 
83  // aspect ratio
84  float m_aspectRatio;
85 
86  // near plane
87  float m_near;
88 
89  // far plane
90  float m_far;
91 
92  // current camera view distance
93  float m_dist;
94 
95  // minimal camera view distance
96  float m_minDist;
97 
98  // maximal camera view distance
99  float m_maxDist;
100 
101  // current camera yaw angle in radians
102  float m_xRot;
103 
104  //current camera pitch angle in radians
105  float m_yRot;
106 
107  // camera x/y offset
108  QVector2D m_offset;
109 };
110 
111 #endif // CAMERA_H
void move(const QVector2D &offset)
Offets the camera.
Definition: camera.cpp:37
void setNearFarPlane(float near, float far)
Sets the z values for the near and far plane respectively.
Definition: camera.cpp:20
Class for orbital cameras.
Definition: camera.h:13
void setAspectRatio(float aspectRatio)
Sets the aspect ratio for the perspective transform.
Definition: camera.cpp:15
void rotateX(float angle)
Yaws the camera.
Definition: camera.cpp:26
void zoom(float distance)
Changes the distance of the camera.
Definition: camera.cpp:42
void getViewMatrix(QMatrix4x4 &viewMatrix)
Constructs the view matrix and returns it in viewMatrix.
Definition: camera.cpp:47
void getProjectionMatrix(QMatrix4x4 &projMatrix)
Constructs the projection matrix and returns it in projMatrix.
Definition: camera.cpp:69
void rotateY(float angle)
Pitches the camera.
Definition: camera.cpp:31
Camera(QObject *parent, float minDist, float maxDist, float initDist=.0f, float initYaw=.0f, float initPitch=.0f)
Constructs a new camera.
Definition: camera.cpp:3