The attached class implements support for BSplines and Catmull-Rom Splines, both in 2D and 3D.

There are methods to perform random-access lookups  of 4-point splines (ie return a point anywhere on a more complex spline), and there are methods to help iteratively interpolate along the spline's length.
Splines of any number of points are supported implicitly by the former, and explicitly by the latter.


Attachments:
Posted on 2010-07-01 12:41:04 by Homer
These algorithms seem suited for SSE.
"x87's like a worn out recording... of your favorite song"
Posted on 2010-07-09 09:49:44 by r22
Yeah they do, don't they? ;)
If you have the time on your hands, feel free :)
Infact most pixel work will look likely for SSE(2) / MMX optimizing, because theres usually 4x8 bit data channels being played with.
And why the hell not? If it looks likely, its because it IS likely a good candidate.
Posted on 2010-07-11 01:23:23 by Homer
Attached is an update of the Spline class.
New methods have been added to facilitate time-based interpolation - we can specify how long it takes to interpolate between each pair of control-points, and the time at which the interpolation should begin... then we can dumbly hammer calls to one of the Advance methods until it returns an error.
The ability to declare an interpolation to begin at some FUTURE time can be useful for some applications, as is the ability to advance by some pseudo-time rather than real time, or you could get creative and use one Spline to control the interpolation rate of another Spline - hehe.

As usual, I've supported BSplines and Catmull-Rom splines, in 2D and in 3D.

Noting that the Spline class supports LOOPING behavior (ie a circular buffer of control points describing a closed curve path), this new addition makes the class ideal for scripting the behavior of a single entity... I'm currently torn between whether I should be "attaching actors" or whether I really ought to be "interpolating full keyframes" - I'd sure like to see this code implemented in some interesting way :)

Attachments:
Posted on 2010-07-19 04:08:11 by Homer