diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-05-11 23:08:20 +0200 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-05-11 23:08:20 +0200 |
commit | 2bd03871c74dc7cfb17d579d6e337fe1162cb9e8 (patch) | |
tree | 91f3020e5c0ffa6f09856df06c7927817e4e4fef /source/LinearInterpolation.h | |
parent | Noise: Fixed optimized Cubic noise calculation (diff) | |
download | cuberite-2bd03871c74dc7cfb17d579d6e337fe1162cb9e8.tar cuberite-2bd03871c74dc7cfb17d579d6e337fe1162cb9e8.tar.gz cuberite-2bd03871c74dc7cfb17d579d6e337fe1162cb9e8.tar.bz2 cuberite-2bd03871c74dc7cfb17d579d6e337fe1162cb9e8.tar.lz cuberite-2bd03871c74dc7cfb17d579d6e337fe1162cb9e8.tar.xz cuberite-2bd03871c74dc7cfb17d579d6e337fe1162cb9e8.tar.zst cuberite-2bd03871c74dc7cfb17d579d6e337fe1162cb9e8.zip |
Diffstat (limited to 'source/LinearInterpolation.h')
-rw-r--r-- | source/LinearInterpolation.h | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/source/LinearInterpolation.h b/source/LinearInterpolation.h new file mode 100644 index 000000000..ea9e93455 --- /dev/null +++ b/source/LinearInterpolation.h @@ -0,0 +1,60 @@ +
+// LinearInterpolation.h
+
+// Declares methods for linear interpolation over 1D, 2D and 3D arrays
+
+
+
+
+
+#pragma once
+
+
+
+
+
+// 2D and 3D Interpolation is optimized by precalculating the ratios into static-sized arrays
+// These arrays enforce a max size of the dest array, but the limits are settable here:
+const int MAX_INTERPOL_SIZEX = 256; ///< Maximum X-size of the interpolated array
+const int MAX_INTERPOL_SIZEY = 512; ///< Maximum Y-size of the interpolated array
+const int MAX_INTERPOL_SIZEZ = 256; ///< Maximum Z-size of the interpolated array
+
+
+
+
+
+/// Puts linearly interpolated values from one array into another array. 1D version
+void LinearInterpolate1DArray(
+ float * a_Src, ///< Src array
+ int a_SrcSizeX, ///< Count of the src array
+ float * a_Dst, ///< Src array
+ int a_DstSizeX ///< Count of the dst array
+);
+
+
+
+
+
+/// Puts linearly interpolated values from one array into another array. 2D version
+void LinearInterpolate2DArray(
+ float * a_Src, ///< Src array, [x + a_SrcSizeX * y]
+ int a_SrcSizeX, int a_SrcSizeY, ///< Count of the src array, in each direction
+ float * a_Dst, ///< Dst array, [x + a_DstSizeX * y]
+ int a_DstSizeX, int a_DstSizeY ///< Count of the dst array, in each direction
+);
+
+
+
+
+
+/// Puts linearly interpolated values from one array into another array. 3D version
+void LinearInterpolate3DArray(
+ float * a_Src, ///< Src array, [x + a_SrcSizeX * y + a_SrcSizeX * a_SrcSizeY * z]
+ int a_SrcSizeX, int a_SrcSizeY, int a_SrcSizeZ, ///< Count of the src array, in each direction
+ float * a_Dst, ///< Dst array, [x + a_DstSizeX * y + a_DstSizeX * a_DstSizeY * z]
+ int a_DstSizeX, int a_DstSizeY, int a_DstSizeZ ///< Count of the dst array, in each direction
+);
+
+
+
+
|