00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00027
00029 #ifndef __HAPTICFORCEEFFECT_H__
00030 #define __HAPTICFORCEEFFECT_H__
00031
00032 #include "HapticObject.h"
00033 #include "RefCountedClass.h"
00034
00035 namespace H3D {
00036
00048 class H3DAPI_API HapticForceEffect: public HapticObject,
00049 public RefCountedClass {
00050 public:
00052 struct H3DAPI_API EffectInput {
00054 EffectInput( const Vec3f &pos = Vec3f( 0,0,0 ),
00055 const Vec3f &vel = Vec3f( 0,0,0 ),
00056 const Rotation &orn = Rotation(),
00057 const TimeStamp &dt = 0 ) :
00058 position( pos ),
00059 velocity( vel ),
00060 orientation( orn ),
00061 deltaT( dt ) {}
00062
00064 Vec3f position;
00066 Vec3f velocity;
00068 Rotation orientation;
00070 TimeStamp deltaT;
00071 };
00072
00074 struct H3DAPI_API EffectOutput {
00076 EffectOutput( const Vec3f _force = Vec3f( 0,0,0 ),
00077 const Vec3f _torque = Vec3f( 0,0,0 ) ) :
00078 force( _force ),
00079 torque( _torque ) {}
00080
00082 Vec3f force;
00084 Vec3f torque;
00085
00088 EffectOutput operator +( const EffectOutput &o ) {
00089 return EffectOutput( force + o.force,
00090 torque + o.torque );
00091 }
00092
00095 EffectOutput operator *( float f ) {
00096 return EffectOutput( force * f,
00097 torque *f );
00098 }
00099
00102 EffectOutput operator *( double f ) {
00103 return EffectOutput( force * f,
00104 torque *f );
00105 }
00106 };
00107
00109 HapticForceEffect( const H3D::ArithmeticTypes::Matrix4f & _transform,
00110 bool _interpolate ):
00111 HapticObject( _transform ),
00112 interpolate( _interpolate ){}
00113
00116 EffectOutput virtual calculateForces( const EffectInput &input ) {
00117 return EffectOutput();
00118 }
00119
00121 virtual ~HapticForceEffect() {}
00122
00124 bool isInterpolated() {
00125 return interpolate;
00126 }
00127
00128 protected:
00129 bool interpolate;
00130 };
00131 }
00132
00133 #endif