pub fn contains<T, U>(&self, x: T, y: U) -> bool
    where
        T: Into<f64> + Copy,
        U: Into<f64> + Copy,
    {
        let (x, y) = (x.into(), y.into());
        let minimum = self.points[0];
        if x < minimum.0 || y < minimum.1 {
            return false;
        }

        let mut interval_index = (N - 1) - 1; // TODO make this `derivatives.len() - 1`
        for (i, p) in self.points[0..self.derivatives.len() - 1]
            .iter()
            .enumerate()
        {
            // TODO remove the -1
            let p_ = self.points[i + 1];
            if p.0 <= x && x <= p_.0 {
                interval_index = i;
                break;
            }
        }

        let fx = self.points[interval_index].1
            + self.derivatives[interval_index] * (x - self.points[interval_index].0);
        y <= fx
    }
/// Checks wether a point is in the envelope
Checks wether a point is in the envelope
Checks wether a point is in the envelope
pub fn contains<T, U>(&self, x: T, y: U) -> bool
    where
        T: Into<f64> + Copy,
        U: Into<f64> + Copy,
    {
        let (x, y) = (x.into(), y.into());
        let minimum = self.points[0];
        if x < minimum.0 || y < minimum.1 {
            return false;
        }
        let mut interval_index = (N - 1) - 1; // TODO make this `derivatives.len() - 1`
        for (i, p) in self.points[0..self.derivatives.len() - 1]
            .iter()
            .enumerate()
        {
            // TODO remove the -1
            let p_ = self.points[i + 1];
            if p.0 <= x && x <= p_.0 {
                interval_index = i;
                break;
            }
        }
        let fx = self.points[interval_index].1
            + self.derivatives[interval_index] * (x - self.points[interval_index].0);
        y <= fx
    }
pub fn contains < T , U > ( & self , x : T , y : U ) -> bool where T : Into < f64 > + Copy , U : Into < f64 > + Copy , { let ( x , y ) = ( x . into ( ) , y . into ( ) ) ; let minimum = self . points [ 0 ] ; if x < minimum . 0 || y < minimum . 1 { return false ; } let mut interval_index = ( N - 1 ) - 1 ; // TODO make this `derivatives.len() - 1` for ( i , p ) in self . points [ 0 .. self . derivatives . len ( ) - 1 ] . iter ( ) . enumerate ( ) { // TODO remove the -1 let p_ = self . points [ i + 1 ] ; if p . 0 <= x && x <= p_ . 0 { interval_index = i ; break ; } } let fx = self . points [ interval_index ] . 1 + self . derivatives [ interval_index ] * ( x - self . points [ interval_index ] . 0 ) ; y <= fx }
Checks wether a point is in the envelope
Checks wether a point is in the envelope
&self
x
T
y
U
&self
x
T
y
U