25 template <
class RT,
class T>
30 : periodic( periodic_ ) {}
32 virtual RT operator[](
od_int64)
const = 0;
34 virtual float getDx()
const = 0;
35 virtual float getX0()
const = 0;
37 virtual int size()
const = 0;
43 {
return (x-getX0()) / getDx(); }
46 {
return mNINT32(getIndex( x )); }
50 if ( !doInterpolate() )
52 const int smpl =
mNINT32( getIndex(x) );
53 if ( smpl<0 || smpl>=size() )
63 getIndex(x), period(),
77 {
return getValue(*x); }
84 virtual bool hasUdfs()
const {
return false; }
93 template <
class RT,
class T>
98 float x0=0,
float dx=1 )
103 , period_ (
mUdf(float) )
105 , interpolate_( true )
113 int size()
const {
return sz_; }
bool interpolate_
Definition: samplfunc.h:135
void setPeriod(float np)
Definition: samplfunc.h:116
bool periodic
Definition: samplfunc.h:80
virtual bool extrapolate() const
Definition: samplfunc.h:83
float getIndex(float x) const
Definition: samplfunc.h:42
bool interpolateReg(const T &idxabl, int sz, float pos, RT &ret, bool extrapolate=false, float snapdist=mDefEps)
Definition: idxable.h:273
void setInterpolate(bool yn)
Definition: samplfunc.h:122
#define od_int64
Definition: plftypes.h:36
Mathematical function.
Definition: mathfunc.h:61
float period_
Definition: samplfunc.h:133
void setHasUdfs(bool yn)
Definition: samplfunc.h:119
virtual bool doInterpolate() const
Definition: samplfunc.h:85
int size() const
Definition: samplfunc.h:113
RT getValue(RT x) const
Definition: samplfunc.h:48
#define mNINT32(x)
Definition: commondefs.h:45
int sz_
Definition: samplfunc.h:127
int firstidx_
Definition: samplfunc.h:128
SampledFunction(bool periodic_=false)
Definition: samplfunc.h:29
float getX0() const
Definition: samplfunc.h:111
float period() const
Definition: samplfunc.h:115
#define mUdf(type)
Use this macro to get the undefined for simple types.
Definition: undefval.h:272
SampledFunctionImpl(const T &idxabl, int sz, float x0=0, float dx=1)
Definition: samplfunc.h:97
RT operator[](od_int64 idx) const
Definition: samplfunc.h:108
void interpolateYPeriodicReg(const T &idxabl, int sz, float pos, RT &ret, RT period, bool extrapolate=false)
Definition: periodicvalue.h:127
bool interpolateRegWithUdf(const T &idxabl, int sz, float pos, RT &ret, bool extrapolate=false, float snapdist=mDefEps)
Definition: idxable.h:314
float dx_
Definition: samplfunc.h:130
virtual float period() const
Definition: samplfunc.h:39
float getDx() const
Definition: samplfunc.h:110
RT getValue(const RT *x) const
Definition: samplfunc.h:76
virtual bool hasUdfs() const
Definition: samplfunc.h:84
bool hasudfs_
Definition: samplfunc.h:134
float x0_
Definition: samplfunc.h:131
Implementation for array-type of SampledFunction.
Definition: samplfunc.h:94
#define mClass(module)
Definition: commondefs.h:164
bool hasUdfs() const
Definition: samplfunc.h:118
void setPeriodic(bool np)
Definition: samplfunc.h:40
int getNearestIndex(float x) const
Definition: samplfunc.h:45
Make any sampled series comply with MathFunction.
Definition: samplfunc.h:26
const T & idxabl_
Definition: samplfunc.h:126
bool doInterpolate() const
Definition: samplfunc.h:121