vrecko
virtual reality framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Cylinder.h
Go to the documentation of this file.
1 #ifndef VF_CYLINDER
2 #define VF_CYLINDER
3 
4 #include <vrecko/Ability.h>
5 #include <vreckoDP/base/PHANToM.h>
6 #include <osg/Vec4>
7 #include <osg/Geode>
8 #include <osg/MatrixTransform>
9 #include <osg/Group>
10 
11 
12 using namespace vrecko;
13 using namespace vreckoDP_base;
14 namespace VirtualFixture{
15 
16 class Cylinder: public PHANToMFilter {
17  public:
18  Cylinder();
19  ~Cylinder() {};
20 
22  void apply(PHANToM *pPHANToM, osg::Vec3 &force);
23  void processEvent(const std::string &input_name, void *value);
24 
25  void preInitialize(void);
26  void postInitialize(void);
27  void update(void);
28 
29  void display(void); //show or hide VF_cylinder object
30 
31  bool loadXMLParameters(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *pParametersNode);
32  XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *getXMLParameters(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *);
33 
34  protected:
35  PHANToM *PHANToMDevice;
36  bool all_on;
37  bool active; //VF switcher
38  bool visible; //if geometry of VF vill be shown on screen
39  osg::MatrixTransform *tnode; //transform node pointer
40  osg::Group *gnode; //group pointer
41  osg::Geode *node; //geometry node pointer (for bouning cylinder)
42  osg::Geode *node2; //geometry node2 pointer (for center cylinder)
43  float transparency; //transparency of VF geometry (interval (0,1), 1 = invisible)
44  float transparency2; //transparency of VF geometry (interval (0,1), 1 = invisible) inner cylinder
45  osg::Vec4 color; //VF color (of whole geometry)
46  osg::Vec4 color2; //VF color2 (of center)
47  osg::Vec3 position; //position of starting point
48  osg::Vec3 vector; //vector on cylinder axis (from bottom to top)
49  float radius; //cylinder radius (maximum range of attractive field)
50  float nullradius; //radius close to centre, where attractive field is NOT applied
51  float stiffness; //stiffness of attractive field = how strong it would be for every meter of space
52  float pushingforce; //pushing force along the vector
53  bool pushing; //if true push PHANToM along the vector
54 };
55 };
56 
57 #endif
58