splines

Module interpolate

Source
Expand description

The Interpolate trait and associated symbols.

The Interpolate trait is the central concept of the crate. It enables a spline to be sampled at by interpolating in between control points.

In order for a type to be used in Spline<K, V>, some properties must be met about the K type must implementing several traits:

  • One, giving a neutral element for the multiplication monoid.
  • Additive, making the type additive (i.e. one can add or subtract with it).
  • Linear, unlocking linear combinations, required for interpolating.
  • Trigo, a trait giving π and cosine, required for e.g. cosine interpolation.

Feel free to have a look at current implementors for further help.

Why doesn’t this crate use num-traits instead of defining its own traits?

The reason for this is quite simple: this crate provides a no_std support, which is not currently available easily with num-traits. Also, if something changes in num-traits with those traits, it would make this whole crate unstable.

Traits§

  • Set of types that support additions and subtraction.
  • Keys that can be interpolated in between. Implementing this trait is required to perform sampling on splines.
  • Set of additive types that support outer multiplication and division, making them linear.
  • Types with a neutral element for multiplication.
  • Types with a sane definition of π and cosine.

Functions§