24 #ifndef __PolyVox_Interpolation_H__
25 #define __PolyVox_Interpolation_H__
29 template <
typename Type>
31 const Type& v0,
const Type& v1,
34 POLYVOX_ASSERT((x >= 0.0f) && (x <= 1.0f),
"Interpolation input out of 0.0 to 1.0 range.");
37 Type v0_1 = (v1 - v0) * x + v0;
42 template <
typename Type>
44 const Type& v00,
const Type& v10,
const Type& v01,
const Type& v11,
45 const float x,
const float y)
48 (x <= 1.0f) && (y <= 1.0f),
"Interpolation input out of 0.0 to 1.0 range.");
51 Type v00_10 =
lerp(v00, v10, x);
52 Type v01_11 =
lerp(v01, v11, x);
55 Type v00_10__v01_11 =
lerp(v00_10, v01_11, y);
57 return v00_10__v01_11;
60 template <
typename Type>
62 const Type& v000,
const Type& v100,
const Type& v010,
const Type& v110,
63 const Type& v001,
const Type& v101,
const Type& v011,
const Type& v111,
64 const float x,
const float y,
const float z)
67 (x <= 1.0f) && (y <= 1.0f) && (z <= 1.0f),
"Interpolation input out of 0.0 to 1.0 range.");
70 Type v000_v100__v010_v110 =
bilerp(v000, v100, v010, v110, x, y);
71 Type v001_v101__v011_v111 =
bilerp(v001, v101, v011, v111, x, y);
74 Type v000_v100__v010_v110____v001_v101__v011_v111 =
lerp(v000_v100__v010_v110, v001_v101__v011_v111, z);
76 return v000_v100__v010_v110____v001_v101__v011_v111;
80 #endif //__PolyVox_Interpolation_H__