Mercurial > hg > orthanc-stone
diff Framework/Toolbox/GeometryToolbox.h @ 172:316324f42848 wasm
fix
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 06 Mar 2018 16:53:48 +0100 |
parents | 01e32beee56c |
children | 15d92d93738b |
line wrap: on
line diff
--- a/Framework/Toolbox/GeometryToolbox.h Tue Mar 06 15:43:57 2018 +0100 +++ b/Framework/Toolbox/GeometryToolbox.h Tue Mar 06 16:53:48 2018 +0100 @@ -148,10 +148,9 @@ { assert(x >= 0 && y >= 0); - // Compute the fractional part of (x,y) (this is the "floor()" - // operation on positive integers) - float xx = x - static_cast<float>(static_cast<int>(x)); - float yy = y - static_cast<float>(static_cast<int>(y)); + // Compute the fractional part of (x,y) + float xx = x - std::floor(x); + float yy = y - std::floor(y); return ComputeBilinearInterpolationInternal(xx, yy, f00, f01, f10, f11); } @@ -171,9 +170,9 @@ { assert(x >= 0 && y >= 0 && z >= 0); - float xx = x - static_cast<float>(static_cast<int>(x)); - float yy = y - static_cast<float>(static_cast<int>(y)); - float zz = z - static_cast<float>(static_cast<int>(z)); + float xx = x - std::floor(x); + float yy = y - std::floor(y); + float zz = z - std::floor(z); // "In practice, a trilinear interpolation is identical to two // bilinear interpolation combined with a linear interpolation"