24 #ifndef __PolyVox_Interpolation_H__
25 #define __PolyVox_Interpolation_H__
31 template <
typename Type>
33 const Type& v0,
const Type& v1,
36 assert((x >= 0.0f) && (x <= 1.0f));
39 Type v0_1 = v0 + x * (v1 - v0);
44 template <
typename Type>
46 const Type& v00,
const Type& v10,
const Type& v01,
const Type& v11,
47 const float x,
const float y)
49 assert((x >= 0.0f) && (y >= 0.0f) &&
50 (x <= 1.0f) && (y <= 1.0f));
53 Type v00_10 =
lerp(v00, v10, x);
54 Type v01_11 =
lerp(v01, v11, x);
57 Type v00_10__v01_11 =
lerp(v00_10, v01_11, y);
59 return v00_10__v01_11;
62 template <
typename Type>
64 const Type& v000,
const Type& v100,
const Type& v010,
const Type& v110,
65 const Type& v001,
const Type& v101,
const Type& v011,
const Type& v111,
66 const float x,
const float y,
const float z)
68 assert((x >= 0.0f) && (y >= 0.0f) && (z >= 0.0f) &&
69 (x <= 1.0f) && (y <= 1.0f) && (z <= 1.0f));
72 Type v000_v100__v010_v110 =
bilerp(v000, v100, v010, v110, x, y);
73 Type v001_v101__v011_v111 =
bilerp(v001, v101, v011, v111, x, y);
76 Type v000_v100__v010_v110____v001_v101__v011_v111 =
lerp(v000_v100__v010_v110, v001_v101__v011_v111, z);
78 return v000_v100__v010_v110____v001_v101__v011_v111;
82 #endif //__PolyVox_Interpolation_H__