Git Product home page Git Product logo

mba's Introduction

Scattered data interpolation with multilevel B-Splines

Build Status

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++:

#include <mba.hpp>

int main() {
    // Coordinates of data points.
    std::vector<mba::point<2>> 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<double> 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:

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, 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.

mba's People

Contributors

ddemidov avatar an-ivanov avatar gruensein avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.