vrecko
virtual reality framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Auxiliary.h
Go to the documentation of this file.
1 #ifndef VF_AUXILIARY_H
2 #define VF_AUXILIARY_H
3 
4 #include <vrecko/Ability.h>
5 #include <vreckoDP/base/PHANToM.h>
6 #include <osg/Timer>
7 
8 #include <osg/Vec3>
9 
10 using namespace vrecko;
11 using namespace vreckoDP_base;
12 namespace VirtualFixture{
13 
14 //Where is stored MAXFORCE in VRECKO?
15 #define MAXFORCE 7.0
16 #define SMOOTHING_RADIUS 0.05
17 
18 #define MINF 0.1
19 
20 //#define MULTIPLIER 50.0 //Flasik magic constant
21 //#define ADDITIONX 0.0 //Flasik magic constant
22 //#define ADDITIONY -3.0 //Flasik magic constant
23 //#define ADDITIONZ -1.0 //Flasik magic constant
24 #define MULTIPLIER 1.0
25 #define ADDITIONX 0.0
26 #define ADDITIONY 0.0
27 #define ADDITIONZ 0.0
28 
29 
30 #define WSXMIN -0.24 * MULTIPLIER + ADDITIONX
31 #define WSXMAX 0.24 * MULTIPLIER + ADDITIONX
32 #define WSYMIN -0.10 * MULTIPLIER + ADDITIONY
33 #define WSYMAX 0.39 * MULTIPLIER + ADDITIONY
34 #define WSZMIN -0.12 * MULTIPLIER + ADDITIONZ
35 #define WSZMAX 0.16 * MULTIPLIER + ADDITIONZ
36 
37 #define ZEROXDISTANCE 0 * MULTIPLIER + ADDITIONX
38 #define ZEROYDISTANCE 0.14 * MULTIPLIER + ADDITIONY
39 #define ZEROZDISTANCE -0.13 * MULTIPLIER + ADDITIONZ
40 #define MINBORDERRADIUS 0.13 * MULTIPLIER
41 #define MAXBORDERRADIUS 0.24 * MULTIPLIER
42 
43 extern osg::Timer timer; //declaration of timer
44 
45 extern "C" osg::Vec3 ControlActualPositionReturnCleanPosition(osg::Vec3 Actual); //this function check if phantom position is not close to workspace edge -> return closest point on edge
46 
47 extern "C" bool ControlActualPosition(osg::Vec3 Actual); //this function check if phantom position is not close to workspace edge -> return true if inside, false if beyond border
48 
49 //vibration generator
50 extern "C" osg::Vec3 Vibrate(float frequency, float amplitude, osg::Vec3 direction); //update vector so it will produce vibration movement with proper direction and amplitude with preset frequency
51 
52 //Transform function from computed force (from any algorythm) to (0,maxf) by special function (logarithmic)
53 extern "C" osg::Vec3 ForceTransformFunction(float maxforce, osg::Vec3 force); //transform function (linear) to log(f);result in (0,maxforce)
54 
55 //this function is called by cylinder etc., it will check if t param is in (0,1) and return 1 if in,
56 //close (defined by SMOOTHING_RADIUS) to value 0, or 1 it will produce some smooth increase/decrease (for better connection of two fixtures)
57 extern "C" float SmoothEnding(float t); //t is "time" param on vector
58 }
59 #endif