H3D API  2.4.1
MagneticSurface.h
Go to the documentation of this file.
1 // Copyright 2004-2019, SenseGraphics AB
3 //
4 // This file is part of H3D API.
5 //
6 // H3D API is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
10 //
11 // H3D API is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with H3D API; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 //
20 // A commercial license is also available. Please contact us at
21 // www.sensegraphics.com for more information.
22 //
23 //
27 //
29 #ifndef __MAGNETICSURFACE_H__
30 #define __MAGNETICSURFACE_H__
31 
32 #include <H3D/H3DSurfaceNode.h>
33 #include <H3D/SFFloat.h>
34 #include <H3D/FieldTemplates.h>
35 #include <H3D/SFBool.h>
36 
37 namespace H3D {
38 
56  class H3DAPI_API MagneticSurface: public H3DSurfaceNode {
57  public:
58 
64  class H3DAPI_API UpdateStiffness:
65  public AutoUpdate< OnValueChangeSField< SFFloat > > {
66  protected:
67  virtual void onValueChange( const H3DFloat &v );
68  };
69 
75  class H3DAPI_API UpdateDamping:
76  public AutoUpdate< OnValueChangeSField< SFFloat > > {
77  protected:
78  virtual void onValueChange( const H3DFloat &v );
79  };
80 
86  class H3DAPI_API UpdateStaticFriction:
87  public AutoUpdate< OnValueChangeSField< SFFloat > > {
88  protected:
89  virtual void onValueChange( const H3DFloat &v );
90  };
91 
97  class H3DAPI_API UpdateDynamicFriction:
98  public AutoUpdate< OnValueChangeSField< SFFloat > > {
99  protected:
100  virtual void onValueChange( const H3DFloat &v );
101  };
102 
108  class H3DAPI_API UpdateSnapDistance:
109  public AutoUpdate< OnValueChangeSField< SFFloat > > {
110  protected:
111  virtual void onValueChange( const H3DFloat &v );
112  };
113 
115  MagneticSurface( Inst< UpdateStiffness > _stiffness = 0,
116  Inst< UpdateDamping > _damping = 0,
117  Inst< UpdateStaticFriction > _staticFriction = 0,
118  Inst< UpdateDynamicFriction > _dynamicFriction = 0,
119  Inst< UpdateSnapDistance > _snapDistance = 0 );
120 
121  void initialize();
122 
129  H3DUniquePtr< UpdateStiffness > stiffness;
130 
137  H3DUniquePtr< UpdateDamping > damping;
138 
145  H3DUniquePtr< UpdateStaticFriction > staticFriction;
146 
153  H3DUniquePtr< UpdateDynamicFriction > dynamicFriction;
154 
162  H3DUniquePtr< UpdateSnapDistance > snapDistance;
163 
166  };
167 }
168 
169 #endif
Contains different templates to modify field behaviour.
Header file for H3DSurfaceNode.
Contains the SFBool field class.
Contains the SFFloat field class.
Base class for all surfaces.
Definition: H3DSurfaceNode.h:44
Specialized field which sets the damping variable in HAPI::OpenHapticsRenderer::OpenHapticsSurface wh...
Definition: MagneticSurface.h:76
Specialized field which sets the dynamic_friction variable in HAPI::OpenHapticsRenderer::OpenHapticsS...
Definition: MagneticSurface.h:98
Specialized field which sets the snap_distance variable in HAPI::OpenHapticsRenderer::OpenHapticsSurf...
Definition: MagneticSurface.h:109
Specialized field which sets the static_friction variable in HAPI::OpenHapticsRenderer::OpenHapticsSu...
Definition: MagneticSurface.h:87
Specialized field which sets the stiffness variable in HAPI::OpenHapticsRenderer::OpenHapticsSurface ...
Definition: MagneticSurface.h:65
The MagneticSurface is a surface where the proxy is attracted to the surface, and forces are generate...
Definition: MagneticSurface.h:56
H3DUniquePtr< UpdateSnapDistance > snapDistance
The distance from the surface within which forces are generated to pull the proxy towards the surface...
Definition: MagneticSurface.h:162
static H3DNodeDatabase database
The H3DNodeDatabase for this node.
Definition: MagneticSurface.h:165
H3DUniquePtr< UpdateDamping > damping
The velocity based damping of the surface.
Definition: MagneticSurface.h:137
H3DUniquePtr< UpdateStaticFriction > staticFriction
The friction that is experienced upon initial movement when resting on the surface.
Definition: MagneticSurface.h:145
H3DUniquePtr< UpdateStiffness > stiffness
The stiffness of the surface.
Definition: MagneticSurface.h:129
H3DUniquePtr< UpdateDynamicFriction > dynamicFriction
The friction that is experienced when moving along the surface the surface.
Definition: MagneticSurface.h:153
float H3DFloat
H3D API namespace.
Definition: Anchor.h:38
The AutoUpdate field is a template to force the BaseField to update itself as soon as an event is rec...
Definition: FieldTemplates.h:130
The H3DNodeDatabase contains a mapping between a name of a Node and the constructor for the Node with...
Definition: H3DNodeDatabase.h:194