Welcome to the official website of the TinySpline project—a comprehensive programming library for arbitrary splines with support for various languages. TinySpline is being developed at Github and is released under the terms of the MIT license.
TinySpline is library for NURBS, B-Splines, and Bézier curves allowing you to handle splines with ease. The library has been implemented in ANSI C (C89) and provides a wrapper for C++ (C++11) along with bindings for C#, D, Java, Lua, PHP, Python, and Ruby. TinySpline strives to be very small by design with a minimum set of dependencies. Nonetheless, the interface has been developed to be convenient for non-experts without lacking enhanced features.
I started this project as part of my bachelor's thesis where I struggled to find an easy-to-use (Java) library that allows me to subdivide B-Splines into sequences of Bézier curves in order to render them using the QT Jambi framework. Moreover, I found that most widget toolkits are able to render quadratic and cubic Bézier curves, only. One of the few exceptions I am aware of is the GLU NURBS interface that is capable of rendering arbitrary NURBS curves and surfaces. However, drawing splines in general using modern widget toolkits seems to be quite challenging due to the lack of proper support. Though I didn't find the time to complete the implementation during my thesis (splines were only a byproduct), I decided to continue my work and publish results afterwards. Since then, I continuously enhance the code base and add new features.
Why Another Spline Library?
Indeed, there are already several spline libraries available in the web and some of them have become quite sophisticated. Unfortunately, however, the majority of these libraries are available only for C/C++ or Python, support only quadratic and cubic splines, or have been designed with fixed dimension—usually 2D. TinySpline, on the other hand, has been developed with compatibility and genericness in mind. Compatibility is expressed in the fact that TinySpline's core is implemented in ANSI C (a C standard supported by most compiler suits and runtime environments) as well as the fact that TinySpline is available for various different programming languages, amongst others: D, Java, Lua, PHP, Python, and Ruby (further languages will be added in future). Genericness is expressed in the fact that TinySpline supports splines of any degree and dimension as well as supporting single and double precision (using the data types float and double, respectively). A more comprehensive list of features is given below:
|Use a single struct (C API) or class (high-level languages) for NURBS, B-Splines, Bézier curves, lines, and points.||Configure TinySpline with single and double precision at compile time.||Create splines of any degree and dimension.|
|Evaluate splines using De Boor's algorithm.||Insert knots and split splines without modifying their shape.||A convenient wrapper for C++ (C++11) and bindings for C#, D, Java, Lua, PHP, Python, and Ruby.|
|Interpolate cubic splines using the Thomas algorithm.||Subdivide NURBS and B-Splines into Bézier curves.||Derive splines of any degree.|
Still, this is not a complete list of features for the simple reason that TinySpline is under active development and new features are added constantly. Furthermore, I didn't find enough icons matching all of TinySpline's features :).
If TinySpline does not meet your requirements, feel free to create an issue on Github or have a look at one of the libraries referenced below:
- http://libnurbs.sourceforge.net - A C++ non-uniform rational B-Splines library.
- https://github.com/bgrimstad/splinter - SPLINTER (SPLine INTERpolation) is a library for multivariate function approximation with splines. The library is implemented in C++ and provides bindings for Python and Matlab.
- https://www.gnu.org/software/gsl/manual/html_node/Basis-Splines.html - A software library for numerical computations in applied mathematics and science.
- https://github.com/ejmahler/SplineLibrary - A C++ library created to provide open-source reference implementations of many spline functions, e.g., Natural Splines and Catmull-Rom Splines.