H3D API  2.4.1
CoordinateDeformer.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 __COORDINATEDEFORMER_H__
30 #define __COORDINATEDEFORMER_H__
31 
33 #include <H3D/H3DFunctionNode.h>
34 #include <H3D/SFFloat.h>
35 #include <H3D/MFBool.h>
36 #include <H3D/SFString.h>
37 
38 namespace H3D {
39 
57  class H3DAPI_API CoordinateDeformer : public H3DCoordinateDeformerNode {
58  public:
59 
61 
63  CoordinateDeformer( Inst< SFFunctionNode > _distanceToDepth = 0,
64  Inst< SFFloat > _plasticity = 0,
65  Inst< SFString > _deviceAlgorithm = 0 ):
66  distanceToDepth( _distanceToDepth ),
67  plasticity( _plasticity ),
68  deviceAlgorithm( _deviceAlgorithm ),
69  touched_last_time( false ) {
70 
71  type_name = "CoordinateDeformer";
72  database.initFields( this );
73 
74  plasticity->setValue( 0 );
75  deviceAlgorithm->addValidValue( "MAX" );
76  deviceAlgorithm->addValidValue( "AVG" );
77  deviceAlgorithm->setValue( "MAX" );
78  }
79 
82  virtual void deformPoints( const vector< bool > &is_touched,
83  const vector< Vec3f > &touch_point,
84  const vector< Vec3f > &touch_normal,
85  const vector< Vec3f > &touch_force,
86  const vector< Vec3f > &penetration_points,
87  const vector< Vec3f > &orig_points,
88  const vector< Vec3f > &resting_points,
89  const vector< Vec3f > &deformed__points,
90  vector< Vec3f > &new_resting_points,
91  vector< Vec3f > &new_deformed_points );
92 
100  H3DUniquePtr< SFFunctionNode > distanceToDepth;
101 
109  H3DUniquePtr< SFFloat > plasticity;
110 
120  H3DUniquePtr< SFString > deviceAlgorithm;
121 
124 
125  protected:
126  bool touched_last_time;
127  };
128 }
129 
130 #endif
Header file for H3DCoordinateDeformerNode.
Header file for H3DFunctionNode.
Contains the MFBool field class.
Contains the SFFloat field class.
Contains the SFString field class.
The CoordinateDeformer uses a H3DFunctionNode to determine the deformation.
Definition: CoordinateDeformer.h:57
H3DUniquePtr< SFString > deviceAlgorithm
The deviceAlgorithm field contains a string that controls how the deformation is calculated for a coo...
Definition: CoordinateDeformer.h:120
CoordinateDeformer(Inst< SFFunctionNode > _distanceToDepth=0, Inst< SFFloat > _plasticity=0, Inst< SFString > _deviceAlgorithm=0)
Constructor.
Definition: CoordinateDeformer.h:63
H3DUniquePtr< SFFunctionNode > distanceToDepth
The distanceToDepth field specifies a function from the distance from the point of contact to the dep...
Definition: CoordinateDeformer.h:100
H3DUniquePtr< SFFloat > plasticity
The plasticity field defines the plasticity.
Definition: CoordinateDeformer.h:109
static H3DNodeDatabase database
The H3DNodeDatabase for this node.
Definition: CoordinateDeformer.h:123
The H3DCoordinateDeformerNode is the abstract base class for all nodes specifying deformation of coor...
Definition: H3DCoordinateDeformerNode.h:45
Template to make sure that the Node that is set in a SFNode is of a specified Node type.
Definition: SFNode.h:97
H3D API namespace.
Definition: Anchor.h:38
The H3DNodeDatabase contains a mapping between a name of a Node and the constructor for the Node with...
Definition: H3DNodeDatabase.h:194