tinyspline icon indicating copy to clipboard operation
tinyspline copied to clipboard

Make some internal methods accessible publicly

Open jay-sridharan opened this issue 4 months ago • 6 comments

Hello again!

I am using this library for a real-time motion control application. To this effect, I cannot have any syscalls once the system is operational, as it introduces non-determinism. This includes malloc.

Tinyspline is really close to what I need because memory allocation is well-contained, and I have been able to write most of what I need using pre-allocated buffers. However, there are some things that would be useful to have exposed to make this possible.

What are your thoughts on including these definitions in tinyspline.h ?

    struct tsBSplineImpl
    {
        size_t deg;
        size_t dim;
        size_t n_ctrlp;
        size_t n_knots;
    };

    struct tsDeBoorNetImpl
    {
        double u;
        size_t k;
        size_t s;
        size_t h;
        size_t dim;
        size_t n_points;
    };
    
    tsError ts_int_bspline_eval_woa(const tsBSpline *spline, tsReal u, tsDeBoorNet *net, tsStatus *status);

I need ts_int_bspline_eval_woa because ts_bspline_eval calls malloc. The struct definitions are useful to have so that I can call sizeof(tsBSplineImpl) in the calculation for my static memory allocation, and similarly for tsDeBoorNetImpl

jay-sridharan avatar Mar 08 '24 00:03 jay-sridharan