34 set( v[0][0][0], v[1][0][0], v[0][1][0], v[1][1][0],
35 v[0][0][1], v[1][0][1], v[0][1][1], v[1][1][1] );
38 LinearReg3D( T v000, T v100, T v010, T v110, T v001, T v101, T v011, T v111 )
40 set( v000, v100, v010, v110, v001, v101, v011, v111 );
43 inline void set( T v000, T v100, T v010, T v110, T v001, T v101, T v011, T v111)
49 a_[4] = v110 + v000 - v100 - v010;
50 a_[5] = v101 + v000 - v100 - v001;
51 a_[6] = v011 + v000 - v010 - v001;
52 a_[7] = v111 + v100 + v010 + v001 - (v000 + v110 + v101 + v011);
55 inline T
apply(
float x,
float y,
float z )
const 57 return a_[0] + a_[1] * x + a_[2] * y + a_[3] * z
58 + a_[4] * x * y + a_[5] * x * z + a_[6] * y * z
69 T v001, T v101, T v011, T v111,
70 float x,
float y,
float z )
72 return LinearReg3D<T>( v000, v100, v010, v110, v001, v101, v011, v111 )
90 set( v[0][0][0], v[1][0][0], v[0][1][0], v[1][1][0],
91 v[0][0][1], v[1][0][1], v[0][1][1], v[1][1][1] );
95 T v001, T v101, T v011, T v111 )
97 set( v000, v100, v010, v110, v001, v101, v011, v111 );
100 inline static T
getReplVal( T v1, T v2, T v3,
bool u1,
bool u2,
bool u3 )
104 return u2 ? v3 : (u3 ? v2 : (v2 + v3) / 2);
106 return u3 ? v1 : (v1 + v3) / 2;
108 return (v1 + v2) / 2;
110 return (v1 + v2 + v3) / 3;
113 inline void set( T v000, T v100, T v010, T v110, T v001, T v101, T v011, T v111)
123 haveudf_ = u000_ || u100_ || u010_ || u110_
124 || u001_ || u101_ || u011_ || u111_;
128 # define mFillIfUdf(nd,nearx,neary,nearz,diagxy,diagxz,diagyz,opp) \ 131 if ( !u##nearx##_ || !u##neary##_ || !u##nearz##_ ) \ 132 v##nd = getReplVal( v##nearx, v##neary, v##nearz, \ 133 u##nearx##_, u##neary##_, u##nearz##_ ); \ 136 if ( u##diagxy##_ && u##diagxz##_ && u##diagyz##_ ) \ 139 v##nd = getReplVal( v##diagxy, v##diagxz, v##diagyz, \ 140 u##diagxy##_, u##diagxz##_, u##diagyz##_ ); \ 156 intp_.set( v000, v100, v010, v110, v001, v101, v011, v111 );
159 inline T
apply(
float x,
float y,
float z )
const 163 ( u000_ && x < 0.5 && y < 0.5 && z < 0.5 )
164 || ( u100_ && x >= 0.5 && y < 0.5 && z < 0.5 )
165 || ( u010_ && x < 0.5 && y >= 0.5 && z < 0.5 )
166 || ( u110_ && x >= 0.5 && y >= 0.5 && z < 0.5 )
167 || ( u001_ && x < 0.5 && y < 0.5 && z >= 0.5 )
168 || ( u101_ && x >= 0.5 && y < 0.5 && z >= 0.5 )
169 || ( u011_ && x < 0.5 && y >= 0.5 && z >= 0.5 )
170 || ( u111_ && x >= 0.5 && y >= 0.5 && z >= 0.5 ) ) )
173 return intp_.apply( x, y, z );
191 T v001, T v101, T v011, T v111,
192 float x,
float y,
float z )
227 set( v[0][1][1], v[0][1][2], v[0][2][1], v[0][2][2],
228 v[1][0][1], v[1][0][2], v[1][1][0], v[1][1][1],
229 v[1][1][2], v[1][1][3], v[1][2][0], v[1][2][1],
230 v[1][2][2], v[1][2][3], v[1][3][1], v[1][3][2],
231 v[2][0][1], v[2][0][2], v[2][1][0], v[2][1][1],
232 v[2][1][2], v[2][1][3], v[2][2][0], v[2][2][1],
233 v[2][2][2], v[2][2][3], v[2][3][1], v[2][3][2],
234 v[3][1][1], v[3][1][2], v[3][2][1], v[3][2][2] );
238 T vm100, T vm101, T vm110, T vm111,
239 T v0m10, T v0m11, T v00m1, T v000,
240 T v001, T v002, T v01m1, T v010,
241 T v011, T v012, T v020, T v021,
242 T v1m10, T v1m11, T v10m1, T v100,
243 T v101, T v102, T v11m1, T v110,
244 T v111, T v112, T v120, T v121,
245 T v200, T v201, T v210, T v211 )
247 set( vm100, vm101, vm110, vm111,
248 v0m10, v0m11, v00m1, v000,
249 v001, v002, v01m1, v010,
250 v011, v012, v020, v021,
251 v1m10, v1m11, v10m1, v100,
252 v101, v102, v11m1, v110,
253 v111, v112, v120, v121,
254 v200, v201, v210, v211 );
258 T vm100, T vm101, T vm110, T vm111,
259 T v0m10, T v0m11, T v00m1, T v000,
260 T v001, T v002, T v01m1, T v010,
261 T v011, T v012, T v020, T v021,
262 T v1m10, T v1m11, T v10m1, T v100,
263 T v101, T v102, T v11m1, T v110,
264 T v111, T v112, T v120, T v121,
265 T v200, T v201, T v210, T v211 )
267 set( v000, v100, v010, v110, v001, v101, v011, v111,
268 (v00m1 + v01m1 + v10m1 + v11m1) / 4,
269 (v0m10 + v0m11 + v1m10 + v1m11) / 4,
270 (vm100 + vm101 + vm110 + vm111) / 4,
271 (v002 + v012 + v102 + v112) / 4,
272 (v020 + v021 + v120 + v121) / 4,
273 (v200 + v201 + v210 + v211) / 4 );
276 inline void set( T v000, T v100, T v010, T v110, T v001, T v101, T v011, T v111,
277 T vxym1, T vxzm1, T vyzm1, T vxy1, T vxz1, T vyz1 )
282 inline T
apply(
float x,
float y,
float z )
const 284 return a_[0] + a_[1] * x + a_[2] * y + a_[3] * z
285 + a_[4] * x * y + a_[5] * x * z + a_[6] * y * z
287 + a_[8] * x * x * y + a_[9] * x * x * z
288 + a_[10] * y * y * x + a_[11] * y * y * z
289 + a_[12] * z * z * x + a_[13] * z * z * y;
298 inline T
polyReg3D(
const T*
const*
const * v,
float x,
float y,
float z )
Definition: interpol1d.h:38
#define mIsUdf(val)
Use mIsUdf to check for undefinedness of simple types.
Definition: undefval.h:287
bool u110_
Definition: interpol3d.h:181
T apply(float x, float y, float z) const
Definition: interpol3d.h:159
LinearReg3D()
Definition: interpol3d.h:30
LinearReg3DWithUdf(T v000, T v100, T v010, T v110, T v001, T v101, T v011, T v111)
Definition: interpol3d.h:94
bool u101_
Definition: interpol3d.h:183
bool u000_
Definition: interpol3d.h:178
Interpolate 3D regularly sampled, using a 3rd order surface.
Definition: interpol3d.h:219
static T getReplVal(T v1, T v2, T v3, bool u1, bool u2, bool u3)
Definition: interpol3d.h:100
PolyReg3D(T vm100, T vm101, T vm110, T vm111, T v0m10, T v0m11, T v00m1, T v000, T v001, T v002, T v01m1, T v010, T v011, T v012, T v020, T v021, T v1m10, T v1m11, T v10m1, T v100, T v101, T v102, T v11m1, T v110, T v111, T v112, T v120, T v121, T v200, T v201, T v210, T v211)
Definition: interpol3d.h:237
LinearReg3DWithUdf()
Definition: interpol3d.h:86
bool u010_
Definition: interpol3d.h:180
LinearReg3D< T > intp_
Definition: interpol3d.h:176
#define mUdf(type)
Use this macro to get the undefined for simple types.
Definition: undefval.h:272
T linearReg3DWithUdf(T v000, T v100, T v010, T v110, T v001, T v101, T v011, T v111, float x, float y, float z)
Definition: interpol3d.h:190
PolyReg3D(const T *const *const *v)
Definition: interpol3d.h:225
T apply(float x, float y, float z) const
Definition: interpol3d.h:55
bool haveudf_
Definition: interpol3d.h:177
#define mFillIfUdf(nd, nearx, neary, nearz, diagxy, diagxz, diagyz, opp)
LinearReg3DWithUdf(const T *const *const *v)
Definition: interpol3d.h:88
bool u111_
Definition: interpol3d.h:185
LinearReg3D(T v000, T v100, T v010, T v110, T v001, T v101, T v011, T v111)
Definition: interpol3d.h:38
Linear 3D interpolation.
Definition: interpol3d.h:26
Linear 3D interpolation with standard undef handling.
Definition: interpol3d.h:82
bool u100_
Definition: interpol3d.h:179
PolyReg3D()
Definition: interpol3d.h:223
T polyReg3D(const T *const *const *v, float x, float y, float z)
PolyReg3D which smoothly handles undefined values.
Definition: interpol3d.h:298
bool u011_
Definition: interpol3d.h:184
T apply(float x, float y, float z) const
Definition: interpol3d.h:282
T linearReg3D(T v000, T v100, T v010, T v110, T v001, T v101, T v011, T v111, float x, float y, float z)
Definition: interpol3d.h:68
#define mClass(module)
Definition: commondefs.h:164
bool u001_
Definition: interpol3d.h:182
LinearReg3D(const T *const *const *v)
Definition: interpol3d.h:32