vrecko
virtual reality framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
NavSphere.h
Go to the documentation of this file.
1 #include <vrecko/Ability.h>
2 #include <vreckoDP/base/PHANToM.h>
3 
4 #include "Auxiliary.h"
5 #include "VibrationLabel.h"
6 
7 #include <osg/Vec4>
8 #include <osg/Geode>
9 #include <osg/MatrixTransform>
10 #include <osg/Group>
11 
12 
13 using namespace vrecko;
14 using namespace vreckoDP_base;
15 namespace VirtualFixture{
16 
17 class NavSphere: public PHANToMFilter {
18  public:
19  NavSphere();
20  ~NavSphere() {};
21 
23  void apply(PHANToM *pPHANToM, osg::Vec3 &force);
24  void processEvent(const std::string &input_name, void *value);
25 
26  void preInitialize(void);
27  void postInitialize(void);
28  void update(void);
29 
30  void display(void); //show or hide VF geometry
31 
32  bool loadXMLParameters(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *pParametersNode);
33  XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *getXMLParameters(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *);
34 
35  protected:
36  PHANToM *PHANToMDevice;
37  bool all_on;
38  bool active; //if true, attractive field will be active
39  bool visible; //if geometric representation will be visible
40 
41  float radius; //radius of navigation sphere -> close to 0 for 6DOF NS, for 3DOF NS should be bigger
42  float stiffness; //sphere boundary force
43  bool store_origin_flag; //when NS is activated or reactivated we have to store its center position
44  osg::Vec3 origin; //the point where NavSphere were activated ...
45  int attenuationtype; //for choosing different attenuation types (0 - none, 1 - linear, 2 ...)
46  float attenuationparam; //parameter of attenuation
47 
48  osg::Vec3 actpos; //actual position of PHANToM device
49  osg::Vec3 actdir; //actual direction of PHANToM stylus (vector)
50  bool vibration_flag; //if object hitted by ray -> true .. then vibrate
51  float amplitude; //vibration of actual hitted object
52  float frequency; //vibration of actual hitted object
53  osg::Vec3 direction; //vibration of actual hitted object
54 // osg::Quat actori; //actual orientation of PHANToM stylus (quaternion)
55  osg::MatrixTransform *tnode; //transform node pointer
56  osg::Group *gnode; //group pointer
57  osg::Geode *node; //geometry node pointer (ray)
58  osg::Geometry *geom;
59  osg::Vec4 color; //ray color
60  float transparency; //ray transparency
61 
62 };
63 
64 };