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 15class Camera; 16 17class Trackball 18{ 19 public: 20 21 enum Mode {Around, Local}; 22 23 Trackball() : mpCamera(0) {} 24 25 void start(Mode m = Around) { mMode = m; mLastPointOk = false; } 26 27 void setCamera(Camera* pCam) { mpCamera = pCam; } 28 29 void track(const Eigen::Vector2i& newPoint2D); 30 31 protected: 32 33 bool mapToSphere( const Eigen::Vector2i& p2, Eigen::Vector3f& v3); 34 35 Camera* mpCamera; 36 Eigen::Vector3f mLastPoint3D; 37 Mode mMode; 38 bool mLastPointOk; 39 40}; 41 42#endif // EIGEN_TRACKBALL_H 43