trackball.h
Go to the documentation of this file.
1 // This file is part of Eigen, a lightweight C++ template library
2 // for linear algebra.
3 //
4 // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
5 //
6 // This Source Code Form is subject to the terms of the Mozilla
7 // Public License v. 2.0. If a copy of the MPL was not distributed
8 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 
10 #ifndef EIGEN_TRACKBALL_H
11 #define EIGEN_TRACKBALL_H
12 
13 #include <Eigen/Geometry>
14 
15 class Camera;
16 
17 class Trackball {
18  public:
19  enum Mode { Around, Local };
20 
21  Trackball() : mpCamera(0) {}
22 
23  void start(Mode m = Around) {
24  mMode = m;
25  mLastPointOk = false;
26  }
27 
28  void setCamera(Camera* pCam) { mpCamera = pCam; }
29 
30  void track(const Eigen::Vector2i& newPoint2D);
31 
32  protected:
33  bool mapToSphere(const Eigen::Vector2i& p2, Eigen::Vector3f& v3);
34 
36  Eigen::Vector3f mLastPoint3D;
39 };
40 
41 #endif // EIGEN_TRACKBALL_H
Definition: camera.h:31
Definition: trackball.h:17
bool mapToSphere(const Eigen::Vector2i &p2, Eigen::Vector3f &v3)
Definition: trackball.cpp:36
Trackball()
Definition: trackball.h:21
Mode mMode
Definition: trackball.h:37
void track(const Eigen::Vector2i &newPoint2D)
Definition: trackball.cpp:15
Camera * mpCamera
Definition: trackball.h:35
bool mLastPointOk
Definition: trackball.h:38
void setCamera(Camera *pCam)
Definition: trackball.h:28
Mode
Definition: trackball.h:19
@ Around
Definition: trackball.h:19
@ Local
Definition: trackball.h:19
void start(Mode m=Around)
Definition: trackball.h:23
Eigen::Vector3f mLastPoint3D
Definition: trackball.h:36
int * m
Definition: level2_cplx_impl.h:294