Classes | |
| class | PolyReg1D |
| class | PolyReg1DWithUdf |
| struct | Applier2D |
| specification for a 2D interpolator More... | |
| class | LinearReg2D |
| Linear 2D interpolation. More... | |
| class | LinearReg2DWithUdf |
| Linear 2D interpolation with standard undef handling. More... | |
| class | PolyReg2D |
| class | PolyReg2DWithUdf |
| class | LinearReg3D |
| class | LinearReg3DWithUdf |
| class | PolyReg3D |
Functions | |
| 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 | 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. | |
| template<class T > | |
| T | polyReg1D (T vm1, T v0, T v1, T v2, float x) |
| PolyReg1D which smoothly handles undefined values. | |
| template<class T > | |
| T | polyReg1DWithUdf (T vm1, T v0, T v1, T v2, float x) |
| 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 | 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) |
| 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) |
| Interpolate 2D regularly sampled, using a 2nd order surface. | |
| 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) |
| PolyReg2D which smoothly handles undefined values. | |
| 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 | 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) |
| Interpolate 3D regularly sampled, using a 3rd order surface. | |
| template<class T > | |
| T | polyReg3D (const T *const *const *v, float x, float y, float z) |
| PolyReg3D which smoothly handles undefined values. | |
| template<class T > | |
| T | linearRegND (int N, const T *v, const T *pos) |
| T Interpolate::linear1D | ( | float | x0, | |
| T | v0, | |||
| float | x1, | |||
| T | v1, | |||
| float | x | |||
| ) | [inline] |
> Interpolate linearly when two points are known. Make sure these points are not at the same posistion (crash!).
| iT Interpolate::linear1Di | ( | float | x0, | |
| iT | v0, | |||
| float | x1, | |||
| iT | v1, | |||
| float | x | |||
| ) | [inline] |
Interpolate 1D regularly sampled, using a 3rd order polynome.
> Same as above, use when iT is from int family
| T Interpolate::linearReg1D | ( | T | v0, | |
| T | v1, | |||
| float | x | |||
| ) | [inline] |
> Linear interpolation as usual.
| T Interpolate::linearReg1DWithUdf | ( | T | v0, | |
| T | v1, | |||
| float | x | |||
| ) | [inline] |
> Linear interpolation as usual with standard undef handling.
| T Interpolate::linearReg2D | ( | T | v00, | |
| T | v01, | |||
| T | v10, | |||
| T | v11, | |||
| float | x, | |||
| float | y | |||
| ) | [inline] |
| T Interpolate::linearReg2DWithUdf | ( | T | v00, | |
| T | v01, | |||
| T | v10, | |||
| T | v11, | |||
| float | x, | |||
| float | y | |||
| ) | [inline] |
Interpolate 2D regularly sampled, using a 2nd order surface.
Contrary to teh linear approach it does matter whether deltaX is different from deltaY. That is why you can supply an xstretch. If xstretch > 1 then the deltaX < deltaY, moreover: xstretch = deltaY / deltaX;
| T Interpolate::linearReg3D | ( | T | v000, | |
| T | v100, | |||
| T | v010, | |||
| T | v110, | |||
| T | v001, | |||
| T | v101, | |||
| T | v011, | |||
| T | v111, | |||
| float | x, | |||
| float | y, | |||
| float | z | |||
| ) | [inline] |
| T Interpolate::linearReg3DWithUdf | ( | T | v000, | |
| T | v100, | |||
| T | v010, | |||
| T | v110, | |||
| T | v001, | |||
| T | v101, | |||
| T | v011, | |||
| T | v111, | |||
| float | x, | |||
| float | y, | |||
| float | z | |||
| ) | [inline] |
Interpolate 3D regularly sampled, using a 3rd order surface.
Current implementation takes the average of the outer squares. In the parameter passing, the z is the fastest dimension.
.. .. Z Y-dir
.. .... .... .. ^ /
.. .... .... .. | --> X-dir
.. ..^- From here to -^ x=-1 0 1 2
| 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 'floor', as in:
for ( int idim=0; idim<nrdims; idim++ ) { const float fidx = samplings[idim].getIndex( vals[idim] ); const int idx0 = (int)floor(fidx); pos[idim] = fidx - idx0; idx0s += idx0; }
| T Interpolate::parabolic1D | ( | float | x0, | |
| T | v0, | |||
| float | x1, | |||
| T | v1, | |||
| float | x2, | |||
| T | v2, | |||
| float | x | |||
| ) | [inline] |
> Interpolate when 3 points are known. Make sure none of the positions are the same. Will just crash 'silently'. No undefined values allowed.
| T Interpolate::poly1D | ( | float | x0, | |
| T | v0, | |||
| float | x1, | |||
| T | v1, | |||
| float | x2, | |||
| T | v2, | |||
| float | x3, | |||
| T | v3, | |||
| float | x | |||
| ) | [inline] |
> Interpolate when 4 points are known. Make sure none of the positions are the same. Will just crash 'silently'. No undefined values allowed.
| T Interpolate::polyReg1D | ( | T | vm1, | |
| T | v0, | |||
| T | v1, | |||
| T | v2, | |||
| float | x | |||
| ) | [inline] |
PolyReg1D which smoothly handles undefined values.
Note that this class _requires_ x to be between 0 and 1 for correct undef handling. Correct means: if the nearest sample is undefined, return undefined. Otherwise always return a value.
| T Interpolate::polyReg1DWithUdf | ( | T | vm1, | |
| T | v0, | |||
| T | v1, | |||
| T | v2, | |||
| float | x | |||
| ) | [inline] |
| T Interpolate::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 | |||
| ) | [inline] |
PolyReg2D which smoothly handles undefined values.
Note that this class _requires_ x and y to be between 0 and 1 for correct undef handling. Correct means: if the nearest sample is undefined, return undefined. Otherwise always return a value.
| T Interpolate::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 | |||
| ) | [inline] |
| T Interpolate::polyReg3D | ( | const T *const *const * | v, | |
| float | x, | |||
| float | y, | |||
| float | z | |||
| ) | [inline] |
PolyReg3D which smoothly handles undefined values.
Note that this class _requires_ x, y and z to be between 0 and 1 for correct undef handling. Correct means: if the nearest sample is undefined, return undefined. Otherwise always return a value.
| T Interpolate::predictAtZero1D | ( | T | vm3, | |
| T | vm2, | |||
| T | vm1, | |||
| T | v1, | |||
| T | v2, | |||
| T | v3 | |||
| ) | [inline] |
> Predict at sample position 0 when three previous and three next are known. Returned is the value of the 5th order polynome that goes through the points.
| T Interpolate::predictAtZero1D | ( | T | vm2, | |
| T | vm1, | |||
| T | v1, | |||
| T | v2 | |||
| ) | [inline] |
> Predict at sample position 0 when two previous and two next are known. Returned is the value of the 3rd order polynome that goes through the points.
1.7.1