Function hermite

Source
pub fn hermite<T: Float>(p0: T, p1: T, p2: T, p3: T, t: T) -> T
Expand description

Cubic hermite interpolation function using generics

This function performs cubic Hermite interpolation between two points, with gradients defined at each point. This can create a smoother interpolation compared to linear interpolation.

§Type Parameters

  • T: Float - The type of the input values. This should be a floating point type.

§Parameters

  • p0: T - The first point, used to calculate the gradient at p1.
  • p1: T - The start point for interpolation.
  • p2: T - The end point for interpolation.
  • p3: T - The second point, used to calculate the gradient at p2.
  • t: T - The interpolation factor. Should be in the range [0, 1].

§Returns

  • T - The interpolated value.

§Panics

Panics if T cannot produce a value of 2.0 or 3.0.