summaryrefslogtreecommitdiffstats
path: root/src/LinearInterpolation.cpp
diff options
context:
space:
mode:
authorSamuel Barney <samjbarney@gmail.com>2015-07-29 17:04:03 +0200
committerSamuel Barney <samjbarney@gmail.com>2015-07-29 17:49:30 +0200
commit804805d35a87c2acc9425d1762ad26b1ba2ec9ac (patch)
tree13b603c8bbf8177da92ce87f5413fb646d204f3f /src/LinearInterpolation.cpp
parentMerge pull request #2376 from mjhanninen/fix-freebsd-build (diff)
downloadcuberite-804805d35a87c2acc9425d1762ad26b1ba2ec9ac.tar
cuberite-804805d35a87c2acc9425d1762ad26b1ba2ec9ac.tar.gz
cuberite-804805d35a87c2acc9425d1762ad26b1ba2ec9ac.tar.bz2
cuberite-804805d35a87c2acc9425d1762ad26b1ba2ec9ac.tar.lz
cuberite-804805d35a87c2acc9425d1762ad26b1ba2ec9ac.tar.xz
cuberite-804805d35a87c2acc9425d1762ad26b1ba2ec9ac.tar.zst
cuberite-804805d35a87c2acc9425d1762ad26b1ba2ec9ac.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: