spline interpolation addon

I’ve uploaded an addon ofxMSASpline to http://addons.openframeworks.cc/project-…-xmsaspline

It wraps a vector class, and basically you feed it a bunch of data, and then can request values at any percentage - i.e. mySpline.sampleAt(0.45) will give the value 45% along the length of the spline OR 45% along the data field. Currently have catmull-rom (cubic) and linear interpolation.

It is a template class so the data can be any type, i’ve created a few predefined classes for ofxMSASpline1D (float), ofxMSASpline2D (ofxVec2f) and ofxMSASpline3D (ofxVec3f). See it in action here http://www.vimeo.com/1869567

SWEET! BTW I tried to watch the video and it said it was private.

oh yea sorry bout that… its public now…

nice, clean and well commented. This is going to come in handy.

hi memo

this is sweet stuff - i’m going to use the 2d version to create a smooth blob to put into the bullet physics world, as i can have the same amount of points i can have my shape as a running average and avoid jerky forms, that come out of video flickering - and i’d like to render it, not as a linestrip, but as a filled surface.

and then comes the fun of tesselating , and i’m not good at that - i’ve tried using the glu tesselator :frowning:

anyone who could help me do a drawFilled() for the 2d slpine?

Hey Ole, do you mean as a flat 2D blob? or a 2d surface in 3d space? Cos if you just want a flat 2d blob, you could probably iterate through the spline at whatever resolution you like, and use ofVertex to draw your shape, that takes care of generating the geometry for you…

Hey memo,
For change internal data (main control points) of the spline. My point is animate simple 2d spline. And then I though to update the main data vector. At fisrt I couldn’t get access to the main data, later I’ve hacked the data to public :? , but I can not swap the data vector because the data type is

insufficient contextual information to determine type

Any way if I feel Im doing to much hacking code and problably there should be a clean way…

May be :roll: I should create again the spline with new control points for each new frame.