OpenCOVER
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
trackingbody.h
Go to the documentation of this file.
1 /* This file is part of COVISE.
2 
3  You can use it under the terms of the GNU Lesser General Public License
4  version 2.1 or later, see lgpl-2.1.txt.
5 
6  * License: LGPL 2+ */
7 
8 /*
9  * trackingbody.h
10  *
11  * Created on: Dec 5, 2014
12  * Author: svnvlad
13  */
14 
15 #ifndef __TRACKINGBODY_H_
16 #define __TRACKINGBODY_H_
17 
18 #include <osg/Matrix>
19 #include <util/coExport.h>
20 #include <iostream>
21 #include "inputsource.h"
22 
23 namespace opencover
24 {
25 
26 class InputDevice;
27 
28 class COVEREXPORT TrackingBody: public InputSource
29 {
30  friend class Input;
31 
32 public:
33  const osg::Matrix &getMat() const;
34  const osg::Matrix &getOffsetMat() const;
35  void setOffsetMat(const osg::Matrix &m);
36  bool isVarying() const;
37  bool is6Dof() const;
38 
39 private:
40  TrackingBody(const std::string &name);
41 
42  void update();
43  void updateRelative();
44  void setMat(const osg::Matrix &mat);
45  void setVarying(bool isVar);
46  void set6Dof(bool is6Dof);
47 
48  TrackingBody *m_baseBody = nullptr;
49  size_t m_idx = 0;
50  osg::Matrix m_mat, m_oldMat;
51  osg::Matrix m_deviceOffsetMat;
52  bool m_varying = true, m_6dof = false;
53 
54  struct Assemble
55  {
56  InputDevice *device = nullptr;
57  int valuator = -1;
58  double scale = 1.;
59  double shift = 0.;
60  };
61 
62  bool m_assemble = false;
63  bool m_assembleWithRotationAxis = false; // assemble from 3 valuators desrcibing a rotation axis, angle is proportional to axis length
64  Assemble m_valuator[9];
65 };
66 }
67 #endif /* TRACKINGBODY_H_ */
Definition: inputsource.h:26
The InputDevice class interacts with input hardware.
Definition: inputdevice.h:37
Definition: trackingbody.h:28
The Input class.
Definition: input.h:38