Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ddemidov/mba
Scattered data interpolation with multilevel B-Splines
https://github.com/ddemidov/mba
c-plus-plus multilevel-bsplines python scattered-data-interpolation
Last synced: 1 day ago
JSON representation
Scattered data interpolation with multilevel B-Splines
- Host: GitHub
- URL: https://github.com/ddemidov/mba
- Owner: ddemidov
- License: mit
- Created: 2013-08-28T11:49:39.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2024-10-05T19:26:32.000Z (3 months ago)
- Last Synced: 2024-12-16T11:40:24.290Z (8 days ago)
- Topics: c-plus-plus, multilevel-bsplines, python, scattered-data-interpolation
- Language: C++
- Size: 1.38 MB
- Stars: 75
- Watchers: 11
- Forks: 23
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
### Scattered data interpolation with multilevel B-Splines
[![Build Status](https://travis-ci.com/ddemidov/mba.svg?branch=master)](https://travis-ci.com/ddemidov/mba)
This library provides the adaptive MBA algorithm from [1] implemented in C++11.
This is a fast algorithm for scattered N-dimensional data interpolation and
approximation. Python bindings are also provided.Example of 2D interpolation in C++:
```cpp
#includeint main() {
// Coordinates of data points.
std::vector> coo = {
{0.0, 0.0},
{0.0, 1.0},
{1.0, 0.0},
{1.0, 1.0},
{0.4, 0.4},
{0.6, 0.6}
};// Data values.
std::vector val = {
0.2, 0.0, 0.0, -0.2, -1.0, 1.0
};// Bounding box containing the data points.
mba::point<2> lo = {-0.1, -0.1};
mba::point<2> hi = { 1.1, 1.1};// Initial grid size.
mba::index<2> grid = {3, 3};// Algorithm setup.
mba::MBA<2> interp(lo, hi, grid, coo, val);// Get interpolated value at arbitrary location.
double w = interp(mba::point<2>{0.3, 0.7});
}
```Same example in python:
```.py
from mba import *interp = mba2(lo=[-0.1,-0.1], hi=[1.1,1.1], grid=[3,3],
coo=[ [0.0, 0.0], [0.0, 1.0], [1.0, 0.0],
[1.0, 1.0], [0.4, 0.4], [0.6, 0.6] ],
val=[0.2, 0.0, 0.0, -0.2, -1.0, 1.0]
)w = interp([[0.3, 0.7]])
```Also see
[python/example.ipynb](http://nbviewer.ipython.org/github/ddemidov/mba/blob/master/python/example.ipynb),
[python/layered.ipynb](http://nbviewer.ipython.org/github/ddemidov/mba/blob/master/python/layered.ipynb).### References
1. S. Lee, G. Wolberg, and S. Y. Shin. Scattered data interpolation with
multilevel B-Splines. IEEE Transactions on Visualization and
Computer Graphics, 3:228–244, 1997, [doi:10.1109/2945.620490](https://doi.org/10.1109/2945.620490).