23 template <
class RT,
class T>
28 : periodic( periodic_ ) {}
30 virtual RT operator[](
od_int64)
const = 0;
32 virtual float getDx()
const = 0;
33 virtual float getX0()
const = 0;
35 virtual int size()
const = 0;
41 {
return (x-getX0()) / getDx(); }
44 {
return mNINT32(getIndex( x )); }
48 if ( !doInterpolate() )
50 const int smpl =
mNINT32( getIndex(x) );
51 if ( smpl<0 || smpl>=size() )
61 getIndex(x), period(),
75 {
return getValue(*x); }
82 virtual bool hasUdfs()
const {
return false; }
91 template <
class RT,
class T>
96 float x0=0,
float dx=1 )
101 , period_ (
mUdf(float) )
103 , interpolate_( true )
111 int size()
const {
return sz_; }
bool interpolate_
Definition: samplfunc.h:133
void setPeriod(float np)
Definition: samplfunc.h:114
bool periodic
Definition: samplfunc.h:78
virtual bool extrapolate() const
Definition: samplfunc.h:81
float getIndex(float x) const
Definition: samplfunc.h:40
bool interpolateReg(const T &idxabl, int sz, float pos, RT &ret, bool extrapolate=false, float snapdist=mDefEps)
Definition: idxable.h:271
void setInterpolate(bool yn)
Definition: samplfunc.h:120
#define od_int64
Definition: plftypes.h:34
Mathematical function.
Definition: mathfunc.h:59
float period_
Definition: samplfunc.h:131
void setHasUdfs(bool yn)
Definition: samplfunc.h:117
virtual bool doInterpolate() const
Definition: samplfunc.h:83
int size() const
Definition: samplfunc.h:111
RT getValue(RT x) const
Definition: samplfunc.h:46
#define mNINT32(x)
Definition: commondefs.h:48
int sz_
Definition: samplfunc.h:125
int firstidx_
Definition: samplfunc.h:126
SampledFunction(bool periodic_=false)
Definition: samplfunc.h:27
float getX0() const
Definition: samplfunc.h:109
float period() const
Definition: samplfunc.h:113
#define mUdf(type)
Use this macro to get the undefined for simple types.
Definition: undefval.h:270
SampledFunctionImpl(const T &idxabl, int sz, float x0=0, float dx=1)
Definition: samplfunc.h:95
RT operator[](od_int64 idx) const
Definition: samplfunc.h:106
void interpolateYPeriodicReg(const T &idxabl, int sz, float pos, RT &ret, RT period, bool extrapolate=false)
Definition: periodicvalue.h:125
bool interpolateRegWithUdf(const T &idxabl, int sz, float pos, RT &ret, bool extrapolate=false, float snapdist=mDefEps)
Definition: idxable.h:312
float dx_
Definition: samplfunc.h:128
virtual float period() const
Definition: samplfunc.h:37
float getDx() const
Definition: samplfunc.h:108
RT getValue(const RT *x) const
Definition: samplfunc.h:74
virtual bool hasUdfs() const
Definition: samplfunc.h:82
bool hasudfs_
Definition: samplfunc.h:132
float x0_
Definition: samplfunc.h:129
Implementation for array-type of SampledFunction.
Definition: samplfunc.h:92
#define mClass(module)
Definition: commondefs.h:161
bool hasUdfs() const
Definition: samplfunc.h:116
void setPeriodic(bool np)
Definition: samplfunc.h:38
int getNearestIndex(float x) const
Definition: samplfunc.h:43
Make any sampled series comply with MathFunction.
Definition: samplfunc.h:24
const T & idxabl_
Definition: samplfunc.h:124
bool doInterpolate() const
Definition: samplfunc.h:119