INET Framework for OMNeT++/OMNEST
inet::math::CloserInterpolator< X, Y > Class Template Reference

#include <Interpolators.h>

Inheritance diagram for inet::math::CloserInterpolator< X, Y >:
inet::math::InterpolatorBase< X, Y > inet::math::IInterpolator< X, Y >

Public Member Functions

virtual Y getValue (const X x1, const Y y1, const X x2, const Y y2, const X x) const override
 Returns the interpolated value for the given x. More...
 
virtual Y getMean (const X x1, const Y y1, const X x2, const Y y2) const override
 Returns the mean interpolated value in the closed interval of [x1, x2]. More...
 
- Public Member Functions inherited from inet::math::InterpolatorBase< X, Y >
virtual Y getMin (const X x1, const Y y1, const X x2, const Y y2) const override
 Returns the minimum interpolated value in the closed interval of [x1, x2]. More...
 
virtual Y getMax (const X x1, const Y y1, const X x2, const Y y2) const override
 Returns the maximum interpolated value in the closed interval of [x1, x2]. More...
 
- Public Member Functions inherited from inet::math::IInterpolator< X, Y >
virtual ~IInterpolator ()
 

Static Public Attributes

static CloserInterpolator< X, Y > singleton
 

Member Function Documentation

◆ getMean()

template<typename X , typename Y >
virtual Y inet::math::CloserInterpolator< X, Y >::getMean ( const X  x1,
const Y  y1,
const X  x2,
const Y  y2 
) const
inlineoverridevirtual

Returns the mean interpolated value in the closed interval of [x1, x2].

Implements inet::math::IInterpolator< X, Y >.

156  {
157  ASSERT(x1 <= x2);
158  return (y1 + y2) / 2;
159  }

◆ getValue()

template<typename X , typename Y >
virtual Y inet::math::CloserInterpolator< X, Y >::getValue ( const X  x1,
const Y  y1,
const X  x2,
const Y  y2,
const X  x 
) const
inlineoverridevirtual

Returns the interpolated value for the given x.

The value of x must fall into the closed interval [x1, x2].

Implements inet::math::IInterpolator< X, Y >.

151  {
152  ASSERT(x1 <= x && x <= x2);
153  return x - x1 < x2 - x ? y1 : y2;
154  }

Member Data Documentation

◆ singleton

template<typename X , typename Y >
CloserInterpolator< X, Y > inet::math::CloserInterpolator< X, Y >::singleton
static

The documentation for this class was generated from the following file: