cgv
Loading...
Searching...
No Matches
cgv::math::interpolator< ValueT, ParamT > Class Template Referenceabstract

Template of an abstract interface for interpolators that can be evaluated at a position t and return an interpolated value at that position. More...

#include <interpolate.h>

Inheritance diagram for cgv::math::interpolator< ValueT, ParamT >:
cgv::math::piecewise_interpolator_storage< ValueT, ValueT, ParamT > cgv::math::piecewise_interpolator_storage< std::pair< ParamT, ValueT >, ValueT, ParamT > cgv::math::uniform_piecewise_interpolator< ValueT, ParamT > cgv::math::piecewise_interpolator< ValueT, ParamT >

Public Member Functions

virtual std::unique_ptr< interpolator > clone () const =0
virtual ValueT at (ParamT t) const =0
 Return the interpolated value at position t.
virtual std::vector< ValueT > quantize (size_t n) const
 Return a sequence of n uniformly-spaced samples from the interpolator within the parameter range [0,1].

Detailed Description

template<typename ValueT, typename ParamT = float>
class cgv::math::interpolator< ValueT, ParamT >

Template of an abstract interface for interpolators that can be evaluated at a position t and return an interpolated value at that position.

Definition at line 545 of file interpolate.h.

Member Function Documentation

◆ at()

template<typename ValueT, typename ParamT = float>
virtual ValueT cgv::math::interpolator< ValueT, ParamT >::at ( ParamT t) const
pure virtual

Return the interpolated value at position t.

Parameters
tThe position at which to evaluate the interpolator. Typically in the range [0,1].
Returns
The interpolated value.

Referenced by cgv::math::interpolator< cgv::rgb, float >::quantize().

◆ quantize()

template<typename ValueT, typename ParamT = float>
virtual std::vector< ValueT > cgv::math::interpolator< ValueT, ParamT >::quantize ( size_t n) const
inlinevirtual

Return a sequence of n uniformly-spaced samples from the interpolator within the parameter range [0,1].

The first sample is always located at t = 0 and the last sample is always located at t = 1. A derived class might override this function in order to provide a more efficient implementation.

Parameters
nThe number of samples to be evaluated.
Returns
The sequence of values.

Reimplemented in cgv::math::linear_interpolator< ValueT, ParamT >, and cgv::math::uniform_linear_interpolator< ValueT, ParamT >.

Definition at line 563 of file interpolate.h.

Referenced by cgv::media::discrete_color_scheme::get_colors().


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