71#ifndef _SO_INTERPOLATE_
72#define _SO_INTERPOLATE_
132 static int max(
int a,
int b) {
return (a > b) ? a : b; }
133 static int clamp(
int i,
int n) {
return (i < n) ? i : n-1; }
150#define SO_INTERPOLATE_HEADER(className) \
152 SO_ENGINE_HEADER(className); \
156 virtual void evaluate(); \
159 static void initClass(); \
172#define SO_INTERPOLATE_SOURCE(className, type, \
173 valType, defaultVal0, defaultVal1, interpVal) \
175SO_ENGINE_SOURCE(className); \
177className::className() \
179 SO_ENGINE_CONSTRUCTOR(className); \
180 SO_ENGINE_ADD_INPUT(alpha, (0.0)); \
181 SO_ENGINE_ADD_INPUT(input0, defaultVal0); \
182 SO_ENGINE_ADD_INPUT(input1, defaultVal1); \
183 SO_ENGINE_ADD_OUTPUT(output, type); \
187className::~className() \
192className::evaluate() \
194 int n0 = input0.getNum(); \
195 int n1 = input1.getNum(); \
196 float a = alpha.getValue(); \
197 for (int i=max(n0,n1)-1; i>=0; i--) { \
198 valType v0 = input0[clamp(i,n0)]; \
199 valType v1 = input1[clamp(i,n1)]; \
200 SO_ENGINE_OUTPUT(output, type, set1Value(i, interpVal)); \
213#define SO_INTERPOLATE_INITCLASS(className, classPrintName) \
216className::initClass() \
218 SO__ENGINE_INIT_CLASS(className, classPrintName, SoInterpolate); \
#define INVENTOR_API
Disable some annoying warnings on MSVC 6.
#define SO_INTERPOLATE_HEADER(className)
These macros can be used to easily define interpolater engine headers and source.
#define SO_ENGINE_ABSTRACT_HEADER(className)
Macros to be called within the class definition header:
Class for all engine outputs.
Base class for all engines.
Interpolaters for the builtin field types.
SoMFFloat input1
The engine linearly interpolates from input0 to input1 .
SoMFFloat input0
The engine linearly interpolates from input0 to input1 .
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 .
Base class for all interpolator engines.
SoEngineOutput output
Interpolated value.
static int clamp(int i, int n)
static int max(int a, int b)
static void initClasses()
init all builtin derived classes
SoSFFloat alpha
Interpolation control value.
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.