Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/grasbock/bicubic
A base for bicubic interpolation
https://github.com/grasbock/bicubic
Last synced: about 2 months ago
JSON representation
A base for bicubic interpolation
- Host: GitHub
- URL: https://github.com/grasbock/bicubic
- Owner: GRASBOCK
- Created: 2020-10-27T22:24:20.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2020-10-27T23:47:35.000Z (about 4 years ago)
- Last Synced: 2024-10-31T11:44:46.486Z (about 2 months ago)
- Language: Rust
- Size: 316 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# bicubic
A base for bicubic interpolationThis projects provides the basis for bicubic interpolation. It is meant to allow any kind of interpolation.
If you need something ready to use check out the [makima_spline::n_dimensional](https://crates.io/crates/makima_spline)## HowTo
```rust
use bicubic;
```
create data
```rust
// x coordinates
let x = vec![-2.5, 0.0, 1.5];
// y coordinates
let y = vec![-4.5, 3.2];
// the value at (x,y) or z if that's how you see it
let f = vec![12.4, 1.45, 1.33, 13.4, 13.2, 6.];// for simplicity, the next values are zero (the values depend on the type of interpolation used)
// first derivative along x direction for each point
let fx = vec![0.0; f.len()];
// first derivative along y direction for each point
let fy = vec![0.0; f.len()];
// cross derivative (untested)
let fxy = vec![0.0; f.len()];
```
The following image shows the layout of the data.
fx, fy, & fxy is placed the same way as f*Note: x & y needs to be sorted in ascending order. Make sure your f values will swap indices when sorting as well*
build the bicubic struct from the data
```rust
let bci = bicubic::from_vec(&x, &y, &f, &fx, &fy, &fxy);
```
To sample do this:
```rust
let z = bci.sample(x, y);
```