Omnidome
Fulldome Mapping Software Toolkit
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Tracker.h
Go to the documentation of this file.
1 /* Copyright (c) 2014-2015 "Omnidome" by cr8tr
2  * Dome Mapping Projection Software (http://omnido.me).
3  * Omnidome was created by Michael Winkelmann aka Wilston Oreo (@WilstonOreo)
4  *
5  * This file is part of Omnidome.
6  *
7  * Omnidome is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU Affero General Public License as
9  * published by the Free Software Foundation, either version 3 of the
10  * License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU Affero General Public License for more details.
16  * You should have received a copy of the GNU Affero General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef OMNI_VISUAL_TRACKER_H_
21 #define OMNI_VISUAL_TRACKER_H_
22 
23 #include <omni/geometry/PolarVec.h>
24 
25 namespace omni {
26  namespace visual {
27  struct Tracker
28  {
29  public:
30  Tracker();
31  Tracker(const QVector3D& _center,
32  const PolarVec& _direction);
33 
34  void track(float _longitude,
35  float _latitude,
36  float _radius);
37 
38  /// get tracker position
39  QVector3D eye() const;
40 
41  /// Set eye position
42  void setEye(const QVector3D& _pos);
43 
44  /// Set center position
45  void setCenter(QVector3D const&);
46 
47  /// Return center position
48  QVector3D & center();
49 
50  /// Return center position (const version)
51  QVector3D const& center() const;
52 
53  /// Set direction from polar vector
54  void setDirection(PolarVec const&);
55 
56  /// Set direction with a certain distance
57  void setDistance(float _t);
58 
59  /// Return direction as polar vector
60  PolarVec & direction();
61 
62  /// Return direction as polar vector (const version)
63  PolarVec const& direction() const;
64 
65  /// Keep distance in limits
66  void limitDistance(float _minDist,
67  float _maxDist);
68 
69  /// Deserialize from stream
70  virtual void fromStream(QDataStream&);
71 
72  /// Serialize to stream
73  virtual void toStream(QDataStream&) const;
74 
75  /// Test for equality. ScreenSetup is ignored
76  friend bool operator==(Tracker const&,
77  Tracker const&);
78 
79  private:
80  /// target position
81  QVector3D center_;
82 
83  /// tracker's postion relatively to target
84  PolarVec direction_;
85  };
86  }
87 }
88 
89 #endif /* OMNI_VISUAL_TRACKER_H_ */
QVector3D eye() const
get tracker position
Definition: Tracker.cpp:44
friend bool operator==(Tracker const &, Tracker const &)
Test for equality. ScreenSetup is ignored.
Definition: Tracker.cpp:119
void setEye(const QVector3D &_pos)
Set eye position.
Definition: Tracker.cpp:49
PolarVec direction_
tracker's postion relatively to target
Definition: Tracker.h:84
void setDirection(PolarVec const &)
Set direction from polar vector.
Definition: Tracker.cpp:69
Tracker()
Definition: Tracker.cpp:27
QVector3D center_
target position
Definition: Tracker.h:81
PolarVec & direction()
Return direction as polar vector.
Definition: Tracker.cpp:79
void track(float _longitude, float _latitude, float _radius)
Definition: Tracker.cpp:39
Definition: Tracker.h:27
virtual void toStream(QDataStream &) const
Serialize to stream.
Definition: Tracker.cpp:110
virtual void fromStream(QDataStream &)
Deserialize from stream.
Definition: Tracker.cpp:101
void limitDistance(float _minDist, float _maxDist)
Keep distance in limits.
Definition: Tracker.cpp:89
void setCenter(QVector3D const &)
Set center position.
Definition: Tracker.cpp:54
QVector3D & center()
Return center position.
Definition: Tracker.cpp:59
void setDistance(float _t)
Set direction with a certain distance.
Definition: Tracker.cpp:74