vrecko
virtual reality framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Sphere.h
Go to the documentation of this file.
1 #include <vrecko/Ability.h>
2 #include <vreckoDP/base/PHANToM.h>
3 #include <osg/Vec4>
4 #include <osg/Geode>
5 #include <osg/MatrixTransform>
6 #include <osg/Group>
7 
8 
9 using namespace vrecko;
10 using namespace vreckoDP_base;
11 namespace VirtualFixture{
12 
13 class Sphere: public PHANToMFilter {
14  public:
15  Sphere();
16  ~Sphere() {};
17 
19  void apply(PHANToM *pPHANToM, osg::Vec3 &force);
20  void processEvent(const std::string &input_name, void *value);
21 
22  void preInitialize(void);
23  void postInitialize(void);
24  void update(void);
25  void display(void); //show/hide object
26 
27  bool loadXMLParameters(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *pParametersNode);
28  XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *getXMLParameters(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *);
29 
30  protected:
31  PHANToM *PHANToMDevice;
32  bool all_on;
33  bool active; //if true, attractive field will be active
34 
35  bool visible; //if geometric representation will be visible
36  osg::MatrixTransform *tnode; //transform node pointer
37  osg::Group *gnode; //group pointer
38  osg::Geode *node; //geometry node pointer (for bouning cylinder)
39  osg::Geode *node2; //geometry node2 pointer (for center cylinder)
40  osg::Vec4 color; //color of border sphere (radius)
41  osg::Vec4 color2; //color of inner sphere (nullradius)
42  float transparency; //border sphere transparency
43  float transparency2;//inner sphere transparency
44 
45  osg::Vec3 position; //position of centre (the point where PHANToM will be attracted to)
46  float radius; //radius of attractive field
47  float nullradius; //radius close to center where attractive force is NOT applied
48  float stiffness; //force divided by meter
49 };
50 
51 };