30 #ifndef __COORDINATEINTERPOLATOR_H__
31 #define __COORDINATEINTERPOLATOR_H__
70 int key_size =
static_cast<MFFloat*
>(routes_in[1])->size();
73 vector< Vec3f > key_values =
static_cast<MFVec3f*
>(routes_in[2])->
getValue();
76 value_size = (int) key_values.size() / key_size;
77 value.resize( value_size );
79 if ( key_index >= 0 &&
80 (key_index + 2)* value_size - 1 < (int)key_values.size() ) {
82 for (
int x = 0;
x < value_size; ++
x )
83 value[
x] = key_values[ key_index*value_size +
x ];
85 for (
int x = 0;
x < value_size; ++
x )
86 value[
x] = key_values[ (key_index+1)*value_size +
x];
88 for (
int x = 0;
x < value_size; ++
x ) {
89 Vec3f a = key_values[ key_index*value_size +
x ];
90 Vec3f b = key_values[ (key_index+1)*value_size +
x ];
91 value[
x ] = (1-weight)*a + (weight)*b;
98 friend struct MFValue;
103 Inst< SFFloat > _set_fraction = 0,
104 Inst< MFFloat > _key = 0,
105 Inst< MFVec3f > _keyValue = 0,
106 Inst< MFValue > _value_changed = 0 );
Contains the MFVec3f field class.
Header file for X3DInterpolatorNode, X3D scene-graph node.
This node linearly interpolates among a list of MFVec3f values to produce an MFVec3f value_changed ev...
Definition: CoordinateInterpolator.h:56
static H3DNodeDatabase database
The H3DNodeDatabase for the node.
Definition: CoordinateInterpolator.h:121
H3DUniquePtr< MFValue > value_changed
The linearly interpolated result value.
Definition: CoordinateInterpolator.h:118
H3DUniquePtr< MFVec3f > keyValue
The values to interpolate between.
Definition: CoordinateInterpolator.h:112
The MFFloat field contains a vector of single-precision floating point numbers.
Definition: MFFloat.h:42
The MFVec3f field contains a vector of Vec3f.
Definition: MFVec3f.h:41
The SFFloat field contains one single-precision floating point number.
Definition: SFFloat.h:41
A template modifier class for adding type checking on the routes to any Field class.
Definition: TypedField.h:84
The abstract node X3DInterpolatorNode forms the basis for all types of interpolators specified in thi...
Definition: X3DInterpolatorNode.h:123
Type getValue(const char *s, const char *&rest)
Function that reads characters from a char * and converts them to a given type.
Definition: X3DFieldConversion.h:134
H3D API namespace.
Definition: Anchor.h:38
The SFValue field updates the interpolated value from the fields routed to it.
Definition: CoordinateInterpolator.h:65
virtual void update()
Make the field up to date given that an event has occured.
Definition: CoordinateInterpolator.h:66
The H3DNodeDatabase contains a mapping between a name of a Node and the constructor for the Node with...
Definition: H3DNodeDatabase.h:194