summaryrefslogtreecommitdiffstats
path: root/src/LinearInterpolation.cpp
diff options
context:
space:
mode:
authorJulian Laubstein <julianlaubstein@yahoo.de>2015-07-29 18:45:36 +0200
committerJulian Laubstein <julianlaubstein@yahoo.de>2015-07-29 18:45:36 +0200
commit735d590abf7f804a4504b70c84a289ba86c5f8e3 (patch)
tree13b603c8bbf8177da92ce87f5413fb646d204f3f /src/LinearInterpolation.cpp
parentMerge pull request #2376 from mjhanninen/fix-freebsd-build (diff)
parentSilenced and fixed many warning messages across multiple files. (diff)
downloadcuberite-735d590abf7f804a4504b70c84a289ba86c5f8e3.tar
cuberite-735d590abf7f804a4504b70c84a289ba86c5f8e3.tar.gz
cuberite-735d590abf7f804a4504b70c84a289ba86c5f8e3.tar.bz2
cuberite-735d590abf7f804a4504b70c84a289ba86c5f8e3.tar.lz
cuberite-735d590abf7f804a4504b70c84a289ba86c5f8e3.tar.xz
cuberite-735d590abf7f804a4504b70c84a289ba86c5f8e3.tar.zst
cuberite-735d590abf7f804a4504b70c84a289ba86c5f8e3.zip
Diffstat (limited to '')
-rw-r--r--src/LinearInterpolation.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/LinearInterpolation.cpp b/src/LinearInterpolation.cpp
index 9455f3e4f..c7c690bd2 100644
--- a/src/LinearInterpolation.cpp
+++ b/src/LinearInterpolation.cpp
@@ -65,14 +65,14 @@ void LinearInterpolate1DArray(
a_Dst[0] = a_Src[0];
int DstSizeXm1 = a_DstSizeX - 1;
int SrcSizeXm1 = a_SrcSizeX - 1;
- float fDstSizeXm1 = (float)DstSizeXm1;
- float fSrcSizeXm1 = (float)SrcSizeXm1;
+ float fDstSizeXm1 = static_cast<float>(DstSizeXm1);
+ float fSrcSizeXm1 = static_cast<float>(SrcSizeXm1);
for (int x = 1; x < DstSizeXm1; x++)
{
int SrcIdx = x * SrcSizeXm1 / DstSizeXm1;
float ValLo = a_Src[SrcIdx];
float ValHi = a_Src[SrcIdx + 1];
- float Ratio = (float)x * fSrcSizeXm1 / fDstSizeXm1 - SrcIdx;
+ float Ratio = static_cast<float>(x) * fSrcSizeXm1 / fDstSizeXm1 - SrcIdx;
a_Dst[x] = ValLo + (ValHi - ValLo) * Ratio;
}
a_Dst[a_DstSizeX - 1] = a_Src[a_SrcSizeX - 1];
@@ -103,12 +103,12 @@ void LinearInterpolate2DArray(
for (int x = 1; x < a_DstSizeX; x++)
{
SrcIdxX[x] = x * (a_SrcSizeX - 1) / (a_DstSizeX - 1);
- RatioX[x] = ((float)(x * (a_SrcSizeX - 1)) / (a_DstSizeX - 1)) - SrcIdxX[x];
+ RatioX[x] = (static_cast<float>(x * (a_SrcSizeX - 1)) / (a_DstSizeX - 1)) - SrcIdxX[x];
}
for (int y = 1; y < a_DstSizeY; y++)
{
SrcIdxY[y] = y * (a_SrcSizeY - 1) / (a_DstSizeY - 1);
- RatioY[y] = ((float)(y * (a_SrcSizeY - 1)) / (a_DstSizeY - 1)) - SrcIdxY[y];
+ RatioY[y] = (static_cast<float>(y * (a_SrcSizeY - 1)) / (a_DstSizeY - 1)) - SrcIdxY[y];
}
// Special values at the ends. Notice especially the last indices being (size - 2) with ratio set to 1, to avoid index overflow:
@@ -176,17 +176,17 @@ void LinearInterpolate3DArray(
for (int x = 1; x < a_DstSizeX; x++)
{
SrcIdxX[x] = x * (a_SrcSizeX - 1) / (a_DstSizeX - 1);
- RatioX[x] = ((float)(x * (a_SrcSizeX - 1)) / (a_DstSizeX - 1)) - SrcIdxX[x];
+ RatioX[x] = (static_cast<float>(x * (a_SrcSizeX - 1)) / (a_DstSizeX - 1)) - SrcIdxX[x];
}
for (int y = 1; y < a_DstSizeY; y++)
{
SrcIdxY[y] = y * (a_SrcSizeY - 1) / (a_DstSizeY - 1);
- RatioY[y] = ((float)(y * (a_SrcSizeY - 1)) / (a_DstSizeY - 1)) - SrcIdxY[y];
+ RatioY[y] = (static_cast<float>(y * (a_SrcSizeY - 1)) / (a_DstSizeY - 1)) - SrcIdxY[y];
}
for (int z = 1; z < a_DstSizeZ; z++)
{
SrcIdxZ[z] = z * (a_SrcSizeZ - 1) / (a_DstSizeZ - 1);
- RatioZ[z] = ((float)(z * (a_SrcSizeZ - 1)) / (a_DstSizeZ - 1)) - SrcIdxZ[z];
+ RatioZ[z] = (static_cast<float>(z * (a_SrcSizeZ - 1)) / (a_DstSizeZ - 1)) - SrcIdxZ[z];
}
// Special values at the ends. Notice especially the last indices being (size - 2) with ratio set to 1, to avoid index overflow: