HapticForceEffect.h

Go to the documentation of this file.
00001 
00002 //    Copyright 2004, SenseGraphics AB
00003 //
00004 //    This file is part of H3D API.
00005 //
00006 //    H3D API is free software; you can redistribute it and/or modify
00007 //    it under the terms of the GNU General Public License as published by
00008 //    the Free Software Foundation; either version 2 of the License, or
00009 //    (at your option) any later version.
00010 //
00011 //    H3D API is distributed in the hope that it will be useful,
00012 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 //    GNU General Public License for more details.
00015 //
00016 //    You should have received a copy of the GNU General Public License
00017 //    along with H3D API; if not, write to the Free Software
00018 //    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 //
00020 //    A commercial license is also available. Please contact us at 
00021 //    www.sensegraphics.com for more information.
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

Generated on Thu Aug 24 12:38:33 2006 for H3D API by  doxygen 1.4.5