You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+28-3
Original file line number
Diff line number
Diff line change
@@ -6,11 +6,36 @@ The `ninterp` crate provides [multivariate interpolation](https://en.wikipedia.o
6
6
7
7
There are hard-coded interpolators for lower dimensionalities (up to N = 3) for better runtime performance.
8
8
9
-
All interpolation is handled through instances of the [Interpolator](https://docs.rs/ninterp/latest/ninterp/enum.Interpolator.html) enum, with the selected tuple variant containing relevant data. Interpolation is executed by calling [Interpolator::interpolate](https://docs.rs/ninterp/latest/ninterp/enum.Interpolator.html#method.interpolate).
10
-
11
9
## Feature Flags
12
10
-`serde`: support for serde
13
11
14
12
## Getting Started
13
+
A prelude module has been defined: `use ninterp::prelude::*`.
14
+
This exposes the types necessary for usage: `Interpolator`, `Strategy`, `Extrapolate`, and the trait `InterpMethods`.
15
+
16
+
All interpolation is handled through instances of the [`Interpolator`](https://docs.rs/ninterp/latest/ninterp/enum.Interpolator.html) enum.
17
+
18
+
Interpolation is executed by calling [`Interpolator::interpolate`](https://docs.rs/ninterp/latest/ninterp/enum.Interpolator.html#method.interpolate).
19
+
The length of the supplied point slice must be equal to the interpolator dimensionality.
20
+
The interpolator dimensionality can be retrieved by calling [`Interpolator::ndim`](https://docs.rs/ninterp/latest/ninterp/enum.Interpolator.html#method.ndim).
21
+
22
+
### Note
23
+
For interpolators of dimensionality N ≥ 1:
24
+
- Instantiation is done via the Interpolator enum's `new_*` methods (`new_1d`, `new_2d`, `new_3d`, `new_nd`).
25
+
These methods run a validation step that catches any potential errors early, preventing runtime panics.
26
+
- To set or get field values, use the corresponding named methods (`x`, `set_x`, etc.).
27
+
- An interpolation [`Strategy`](https://docs.rs/ninterp/latest/ninterp/enum.Strategy.html) (e.g. linear, left-nearest, etc.) must be specified.
28
+
Not all interpolation strategies are implemented for every dimensionality.
29
+
`Strategy::Linear` is implemented for all dimensionalities.
30
+
- An [`Extrapolate`](https://docs.rs/ninterp/latest/ninterp/enum.Extrapolate.html) setting must be specified.
31
+
This controls what happens when a point is beyond the range of supplied coordinates.
32
+
If you are unsure which variant to choose, `Extrapolate::Error` is likely what you want.
33
+
34
+
For 0-D (constant-value) interpolators, instantiate directly, e.g. `Interpolator::Interp0D(0.5)`
15
35
16
-
See the [Interpolator](https://docs.rs/ninterp/latest/ninterp/enum.Interpolator.html) enum documentation for examples and notes on usage.
0 commit comments