Red Bird Racing VCU v2
 
Loading...
Searching...
No Matches
LinearInterp< Tin, Tout, Tmid, size > Class Template Reference

Class template for performing linear interpolation using a lookup table. More...

#include <Interp.hpp>

Collaboration diagram for LinearInterp< Tin, Tout, Tmid, size >:

Public Member Functions

 LinearInterp ()=delete
 
constexpr LinearInterp (const TablePoint< Tin, Tout >(&table_)[size])
 
constexpr Tout interp (Tin input) const
 Performs linear interpolation for the given input value, using the table.
 
constexpr Tin start () const
 Returns the starting input value of the interpolation table.
 
constexpr Tin range () const
 Returns the input range of the interpolation table (last input - first input)
 

Private Member Functions

const TablePoint (&table)[size]
 

Detailed Description

template<typename Tin, typename Tout, typename Tmid, uint8_t size>
class LinearInterp< Tin, Tout, Tmid, size >

Class template for performing linear interpolation using a lookup table.

Template Parameters
TinType of the input values
ToutType of the output values
TmidIntermediate type for calculations to prevent overflow
sizeNumber of points in the interpolation table

Definition at line 34 of file Interp.hpp.

Constructor & Destructor Documentation

◆ LinearInterp() [1/2]

template<typename Tin , typename Tout , typename Tmid , uint8_t size>
LinearInterp< Tin, Tout, Tmid, size >::LinearInterp ( )
delete

Default constructor deleted to prevent instantiation without a table

◆ LinearInterp() [2/2]

template<typename Tin , typename Tout , typename Tmid , uint8_t size>
constexpr LinearInterp< Tin, Tout, Tmid, size >::LinearInterp ( const TablePoint< Tin, Tout >(&)  table_[size])
inlineexplicitconstexpr

Normal constructor

Definition at line 38 of file Interp.hpp.

Member Function Documentation

◆ interp()

template<typename Tin , typename Tout , typename Tmid , uint8_t size>
constexpr Tout LinearInterp< Tin, Tout, Tmid, size >::interp ( Tin  input) const
inlineconstexpr

Performs linear interpolation for the given input value, using the table.

Parameters
inputThe input value to interpolate
Returns
The interpolated output value

Definition at line 45 of file Interp.hpp.

References TablePoint< Tin, Tout >::in, and TablePoint< Tin, Tout >::out.

Referenced by Pedal::checkPedalFault(), and Pedal::pedalTorqueMapping().

Here is the caller graph for this function:

◆ range()

template<typename Tin , typename Tout , typename Tmid , uint8_t size>
constexpr Tin LinearInterp< Tin, Tout, Tmid, size >::range ( ) const
inlineconstexpr

Returns the input range of the interpolation table (last input - first input)

Returns
The input range of the table

Definition at line 83 of file Interp.hpp.

Referenced by Pedal::checkPedalFault().

Here is the caller graph for this function:

◆ start()

template<typename Tin , typename Tout , typename Tmid , uint8_t size>
constexpr Tin LinearInterp< Tin, Tout, Tmid, size >::start ( ) const
inlineconstexpr

Returns the starting input value of the interpolation table.

Returns
The starting input value

Definition at line 74 of file Interp.hpp.

Referenced by Pedal::pedalTorqueMapping().

Here is the caller graph for this function:

◆ TablePoint()

template<typename Tin , typename Tout , typename Tmid , uint8_t size>
const LinearInterp< Tin, Tout, Tmid, size >::TablePoint ( table)
private

Reference to the interpolation table


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