50#ifndef _SO_INTERPOLATE_
51#define _SO_INTERPOLATE_
116 static void initClass();
117 static void exitClass();
118 static void initClasses();
119 static void exitClasses();
124 static int findMax(
int a,
int b) {
return (a > b) ? a : b; }
125 static int clamp(
int i,
int n) {
return (i < n) ? i : n-1; }
142#define SO_INTERPOLATE_HEADER(className) \
144 SO_ENGINE_HEADER(className); \
151 virtual void evaluate(); \
154 static void initClass(); \
155 static void exitClass(); \
169#define SO_INTERPOLATE_SOURCE(className, type, \
170 valType, defaultVal0, defaultVal1, interpVal) \
172SO_ENGINE_SOURCE(className) \
174className::className() \
176 SO_ENGINE_CONSTRUCTOR(className); \
177 SO_ENGINE_ADD_INPUT(alpha, (0.0)); \
178 SO_ENGINE_ADD_INPUT(input0, defaultVal0); \
179 SO_ENGINE_ADD_INPUT(input1, defaultVal1); \
180 SO_ENGINE_ADD_OUTPUT(output, type); \
184className::~className() \
189className::evaluate() \
191 int n0 = input0.getNum(); \
192 int n1 = input1.getNum(); \
193 float a = alpha.getValue(); \
194 for (int i=findMax(n0,n1)-1; i>=0; i--) { \
195 valType v0 = input0[clamp(i,n0)]; \
196 valType v1 = input1[clamp(i,n1)]; \
197 SO_ENGINE_OUTPUT(output, type, set1Value(i, interpVal)); \
210#define SO_INTERPOLATE_INITCLASS(className, classPrintName) \
213className::initClass() \
215 SO__ENGINE_INIT_CLASS(className, classPrintName, SoInterpolate); \
218#define SO_INTERPOLATE_EXITCLASS(className) \
221className::exitClass() \
223 SO_ENGINE_EXIT_CLASS(className); \
#define SO_INTERPOLATE_HEADER(className)
#define SO_ENGINE_ABSTRACT_HEADER(className)
Base class for all engines.
Class for all engine outputs.
Interpolates floating-point values.
SoMFFloat input1
The engine linearly interpolates from input0 to input1.
SoMFFloat input0
The engine linearly interpolates from input0 to input1.
Base class for all interpolator engines.
SoEngineOutput output
( SoMFFloat ) Interpolated value.
SoSFFloat alpha
Interpolation control value.
Interpolates rotation values.
SoMFRotation input1
The engine linearly interpolates from input0 to input1.
SoMFRotation input0
The engine linearly interpolates from input0 to input1.
Interpolates 2D floating-point vectors.
SoMFVec2f input1
The engine linearly interpolates from input0 to input1.
SoMFVec2f input0
The engine linearly interpolates from input0 to input1.
Interpolates 3D floating-point vectors.
SoMFVec3f input0
The engine linearly interpolates from input0 to input1.
SoMFVec3f input1
The engine linearly interpolates from input0 to input1.
Interpolates 4D floating-point vectors.
SoMFVec4f input0
The engine linearly interpolates from input0 to input1.
SoMFVec4f input1
The engine linearly interpolates from input0 to input1.
Multiple-value field containing any number of floating point values.
Multiple-value field containing any number of SbRotations.
Multiple-value field containing any number of two-dimensional vectors.
Multiple-value field containing any number of three-dimensional vectors.
Multiple-value field containing any number of four-dimensional vectors.
Field containing a floating-point value.