vrecko
virtual reality framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DampingForceFilter.h
Go to the documentation of this file.
1 #ifndef DAMPING_FORCE_FILTER_H
2 #define DAMPING_FORCE_FILTER_H
3 
5 
6 #ifdef COMPILE_PHANTOM_DEVICE
7 
8 namespace vreckoDP_PHANToM {
9 
10 class DampingForceFilter : public PHANToMFilter {
11 public:
12  DampingForceFilter();
13 
14  virtual bool loadXMLParameters(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *parameters);
15 
16  virtual void apply(PHANToMSTATE &pState, osg::Vec3 &force, osg::Vec3 &torque);
17 
18  void setAverageCount(int iNewAverageCount);
19 
20 protected:
21  float fMaxChangePerStep;
22  // Maximum 3D distance between two points defined by successive force vectors.
23  // If the distance is larger, the new force will be shifted to be closer to the older one.
24  int iAverageCount;
25  // How many previous samples should be averaged? (1 = same as no averaging)
26 
27  struct PrevData {
28  public:
29  osg::Vec3 pos;
30  osg::Vec3 force;
31  };
32 
33  DynamicArray<PrevData> prevData;
34 // osg::Vec3 lastForceResult;
35 
36  float fDampingLin, fDampingVel, fDampingAcc;
37 };
38 
39 }
40 
41 #endif
42 
43 #endif