|
int | getArrIdxPosition (const float farridx, const int arrsz, float &relpos, const float eps=1e-4) |
|
template<class T > |
T | linear1D (float x0, T v0, float x1, T v1, float x) |
|
template<class iT > |
iT | linear1Di (float x0, iT v0, float x1, iT v1, float x) |
| Interpolate 1D regularly sampled, using a 3rd order polynome. More...
|
|
template<class T > |
T | linearReg1D (T v0, T v1, float x) |
|
template<class T > |
T | linearReg1DWithUdf (T v0, T v1, float x) |
|
template<class T > |
T | linearReg2D (T v00, T v01, T v10, T v11, float x, float y) |
|
template<class T > |
T | linearReg2DWithUdf (T v00, T v01, T v10, T v11, float x, float y) |
|
template<class T > |
T | linearReg3D (T v000, T v100, T v010, T v110, T v001, T v101, T v011, T v111, float x, float y, float z) |
|
template<class T > |
T | linearReg3DWithUdf (T v000, T v100, T v010, T v110, T v001, T v101, T v011, T v111, float x, float y, float z) |
|
template<class T > |
T | linearRegND (int N, const T *v, const T *pos) |
|
template<class T > |
T | parabolic1D (float x0, T v0, float x1, T v1, float x2, T v2, float x) |
|
template<class T > |
T | poly1D (float x0, T v0, float x1, T v1, float x2, T v2, float x3, T v3, float x) |
|
template<class T > |
T | polyReg1D (T vm1, T v0, T v1, T v2, float x) |
|
template<class T > |
T | polyReg1DWithUdf (T vm1, T v0, T v1, T v2, float x) |
|
template<class T > |
T | polyReg2D (T vm10, T vm11, T v0m1, T v00, T v01, T v02, T v1m1, T v10, T v11, T v12, T v20, T v21, float x, float y, float xs=1) |
|
template<class T > |
T | polyReg2DWithUdf (T vm10, T vm11, T v0m1, T v00, T v01, T v02, T v1m1, T v10, T v11, T v12, T v20, T v21, float x, float y) |
|
template<class T > |
T | polyReg3D (const T *const *const *v, float x, float y, float z) |
| PolyReg3D which smoothly handles undefined values. More...
|
|
template<class T > |
T | predictAtZero1D (T vm2, T vm1, T v1, T v2) |
|
template<class T > |
T | predictAtZero1D (T vm3, T vm2, T vm1, T v1, T v2, T v3) |
|
Finds the lower index of the bin for interpolation. Makes sure that a
range eps outside the array is snapped into position.
template<class T >
T Interpolate::linearRegND |
( |
int |
N, |
|
|
const T * |
v, |
|
|
const T * |
pos |
|
) |
| |
|
inline |
Linear ND interpolation.
Input: Array sz=2^N values as following 4D example Arr[0] = val[0][0][0][0] Arr[1] = val[1][0][0][0] Arr[2] = val[0][1][0][0] Arr[3] = val[1][1][0][0] Arr[4] = val[0][0][1][0] Arr[5] = val[1][0][1][0] Arr[6] = val[0][1][1][0] Arr[7] = val[1][1][1][0] Arr[8] = val[0][0][0][1] Arr[9] = val[1][0][0][1] Arr[10] = val[0][1][0][1] Arr[11] = val[1][1][0][1] Arr[12] = val[0][0][1][1] Arr[13] = val[1][0][1][1] Arr[14] = val[0][1][1][1] Arr[15] = val[1][1][1][1]
Fill the vals with something like:
od_int64 sz = IntPower( 2, N ); for ( od_int64 ipt=0; ipt<sz; ipt++ ) { TypeSet<int> idxs( N, 0 ); od_int64 bits = ipt; for ( int idim=0; idim<nrdims; idim++ ) { if ( bits & 1 ) idxs[idim]++; bits >>= 1; } pts += getVals( idxs ); }
You therefore provide all the points in the (hyper)cube around the point of evaluation. The [0][0]...[0] point can be determined using 'Math::Floor', as in:
for ( int idim=0; idim<nrdims; idim++ ) { const float fidx = samplings[idim].getIndex( vals[idim] ); const int idx0 = (int)Math::Floor(fidx); pos[idim] = fidx - idx0; idx0s += idx0; }