ofxMSAInterpolator

A set of C++ template classes for doing various types of interpolations on data in any number of dimensions.

You can feed the system an arbitrary number of n-dimensional data (can be simple types like float, int or complex types like vectors, matrices, or even custom structs, classes like biped poses etc), then resample at any resolution, or ask for the interpolated value (linear or cubic) at any point.

 

Example usage


// declare an Interpolator of ofVec3f (3d vector)
msa::Interpolator<ofVec3f> interpolator
//msa::Interpolator3D interpolator; // msa::Interpolator3D is the same as msa::Interpolator<ofVec3f>

// add some data (API is similar to std::vector)
for(int i=0; i<numPoints; i++) {
   ofVec3f v = getVertex(i); // assume getVertex() is a function that provides vertex positions
   interpolator.push_back(v);
}

// resample in 1% increments, loop through and draw
float spacing = 0.01;
glBegin(GL_LINE_STRIP);
for(float f=0; f<=1; f+= spacing) {
   ofxVec3f v = interpolator.sampleAt(f);
   glVertex3f(v.x, v.y, v.z);
}
glEnd();

 

Download

github.com/memo/ofxMSAInterpolator

 

License

Released under theĀ MIT License