OpendTect  7.0
Classes | Functions
Interpolate Namespace Reference

Classes

class  Applier2D
 specification for a 2D interpolator More...
 
class  LinearReg2D
 Linear 2D interpolation. More...
 
class  LinearReg2DWithUdf
 Linear 2D interpolation with standard undef handling. More...
 
class  LinearReg3D
 Linear 3D interpolation. More...
 
class  LinearReg3DWithUdf
 Linear 3D interpolation with standard undef handling. More...
 
class  PolyReg1D
 
class  PolyReg1DWithUdf
 PolyReg1D which smoothly handles undefined values. More...
 
class  PolyReg2D
 Interpolate 2D regularly sampled, using a 2nd order surface. More...
 
class  PolyReg2DWithUdf
 PolyReg2D which smoothly handles undefined values. More...
 
class  PolyReg3D
 Interpolate 3D regularly sampled, using a 3rd order surface. More...
 

Functions

int getArrIdxPosition (const float farridx, const int arrsz, float &relpos, const float eps=1e-4)
 
template<class 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 >
linearReg1D (T v0, T v1, float x)
 
template<class T >
linearReg1DWithUdf (T v0, T v1, float x)
 
template<class T >
linearReg2D (T v00, T v01, T v10, T v11, float x, float y)
 
template<class T >
linearReg2DWithUdf (T v00, T v01, T v10, T v11, float x, float y)
 
template<class 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 >
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 >
linearRegND (int N, const T *v, const T *pos)
 
template<class T >
parabolic1D (float x0, T v0, float x1, T v1, float x2, T v2, float x)
 
template<class T >
poly1D (float x0, T v0, float x1, T v1, float x2, T v2, float x3, T v3, float x)
 
template<class T >
polyReg1D (T vm1, T v0, T v1, T v2, float x)
 
template<class T >
polyReg1DWithUdf (T vm1, T v0, T v1, T v2, float x)
 
template<class 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 >
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 >
polyReg3D (const T *const *const *v, float x, float y, float z)
 PolyReg3D which smoothly handles undefined values. More...
 
template<class T >
predictAtZero1D (T vm2, T vm1, T v1, T v2)
 
template<class T >
predictAtZero1D (T vm3, T vm2, T vm1, T v1, T v2, T v3)
 

Detailed Description

Finds the lower index of the bin for interpolation. Makes sure that a

range eps outside the array is snapped into position.

Function Documentation

◆ getArrIdxPosition()

int Interpolate::getArrIdxPosition ( const float  farridx,
const int  arrsz,
float &  relpos,
const float  eps = 1e-4 
)
inline

◆ linear1D()

template<class T >
T Interpolate::linear1D ( float  x0,
v0,
float  x1,
v1,
float  x 
)
inline

Interpolate linearly when two points are known. Make sure these points are not at the same posistion (crash!).

◆ linear1Di()

template<class iT >
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

◆ linearReg1D()

template<class T >
T Interpolate::linearReg1D ( v0,
v1,
float  x 
)
inline

Linear interpolation as usual.

◆ linearReg1DWithUdf()

template<class T >
T Interpolate::linearReg1DWithUdf ( v0,
v1,
float  x 
)
inline

Linear interpolation as usual with standard undef handling.

◆ linearReg2D()

template<class T >
T Interpolate::linearReg2D ( v00,
v01,
v10,
v11,
float  x,
float  y 
)
inline

◆ linearReg2DWithUdf()

template<class T >
T Interpolate::linearReg2DWithUdf ( v00,
v01,
v10,
v11,
float  x,
float  y 
)
inline

◆ linearReg3D()

template<class T >
T Interpolate::linearReg3D ( v000,
v100,
v010,
v110,
v001,
v101,
v011,
v111,
float  x,
float  y,
float  z 
)
inline

◆ linearReg3DWithUdf()

template<class T >
T Interpolate::linearReg3DWithUdf ( v000,
v100,
v010,
v110,
v001,
v101,
v011,
v111,
float  x,
float  y,
float  z 
)
inline

◆ linearRegND()

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; }

◆ parabolic1D()

template<class T >
T Interpolate::parabolic1D ( float  x0,
v0,
float  x1,
v1,
float  x2,
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.

◆ poly1D()

template<class T >
T Interpolate::poly1D ( float  x0,
v0,
float  x1,
v1,
float  x2,
v2,
float  x3,
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.

◆ polyReg1D()

template<class T >
T Interpolate::polyReg1D ( vm1,
v0,
v1,
v2,
float  x 
)
inline

◆ polyReg1DWithUdf()

template<class T >
T Interpolate::polyReg1DWithUdf ( vm1,
v0,
v1,
v2,
float  x 
)
inline

◆ polyReg2D()

template<class T >
T Interpolate::polyReg2D ( vm10,
vm11,
v0m1,
v00,
v01,
v02,
v1m1,
v10,
v11,
v12,
v20,
v21,
float  x,
float  y,
float  xs = 1 
)
inline

◆ polyReg2DWithUdf()

template<class T >
T Interpolate::polyReg2DWithUdf ( vm10,
vm11,
v0m1,
v00,
v01,
v02,
v1m1,
v10,
v11,
v12,
v20,
v21,
float  x,
float  y 
)
inline

◆ polyReg3D()

template<class T >
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.

◆ predictAtZero1D() [1/2]

template<class T >
T Interpolate::predictAtZero1D ( vm2,
vm1,
v1,
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.

◆ predictAtZero1D() [2/2]

template<class T >
T Interpolate::predictAtZero1D ( vm3,
vm2,
vm1,
v1,
v2,
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.


Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B.V. 1995-2024