Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/grasbock/makima_spline
A implementation of the modified akima interpolation in rust
https://github.com/grasbock/makima_spline
interpolation interpolation-methods mathematics rust rust-lang rust-library spline
Last synced: 21 days ago
JSON representation
A implementation of the modified akima interpolation in rust
- Host: GitHub
- URL: https://github.com/grasbock/makima_spline
- Owner: GRASBOCK
- Created: 2020-10-17T19:42:41.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2020-10-28T00:17:09.000Z (about 4 years ago)
- Last Synced: 2024-04-25T07:43:05.637Z (6 months ago)
- Topics: interpolation, interpolation-methods, mathematics, rust, rust-lang, rust-library, spline
- Language: Rust
- Homepage:
- Size: 124 KB
- Stars: 12
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# makima_spline
A implementation of the modified akima interpolation
**+** linear extrapolation
**+** 1., 2., and 3. order derivatives
**+** bicubic interpolation as a feature## HowTo
```rust
use makima_spline::Spline;
```
your data is in some format
```rust
let x = vec![1., 2., 3., 4., 5., 6., 7., 8.];
let y = vec![-1., -1., -1., 0.0, 1., 1., 1., 1.];
```
convert to the type used by the spline `Vec<(f64, f64)>`
```rust
let points = makima_spline::vec_to_points(&x, &y);
```
build the spline from the data-points
```rust
let spline = Spline::from_vec(points);
```
To sample do this:
```rust
let y = spline.sample(x);
```# 2d interpolation
Based on the [bicubic](https://crates.io/crates/bicubic) crate it is possible to interpolate in two dimensions.Create points
``` rust
let x = vec![-1.0, 0.0, 2.0];
let y = vec![-0.0, 1.0];
let f = vec![5.0, 4.0, 5.0, 1.0, 1.0, 1.0];
```
construct `Bicubic` Struct
```
let bci = makima_spline::n_dimensional::bicubic_from_grid(&x, &y, &f);
```The submodule is called `n_dimensional` in case higher dimensions will be supported in the future, but currently there is only 2d interpolation