Mercurial > hg > orthanc-stone
comparison 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 |
comparison
equal
deleted
inserted
replaced
171:01e32beee56c | 172:316324f42848 |
---|---|
146 float f10, | 146 float f10, |
147 float f11) | 147 float f11) |
148 { | 148 { |
149 assert(x >= 0 && y >= 0); | 149 assert(x >= 0 && y >= 0); |
150 | 150 |
151 // Compute the fractional part of (x,y) (this is the "floor()" | 151 // Compute the fractional part of (x,y) |
152 // operation on positive integers) | 152 float xx = x - std::floor(x); |
153 float xx = x - static_cast<float>(static_cast<int>(x)); | 153 float yy = y - std::floor(y); |
154 float yy = y - static_cast<float>(static_cast<int>(y)); | |
155 | 154 |
156 return ComputeBilinearInterpolationInternal(xx, yy, f00, f01, f10, f11); | 155 return ComputeBilinearInterpolationInternal(xx, yy, f00, f01, f10, f11); |
157 } | 156 } |
158 | 157 |
159 | 158 |
169 float f110, | 168 float f110, |
170 float f111) | 169 float f111) |
171 { | 170 { |
172 assert(x >= 0 && y >= 0 && z >= 0); | 171 assert(x >= 0 && y >= 0 && z >= 0); |
173 | 172 |
174 float xx = x - static_cast<float>(static_cast<int>(x)); | 173 float xx = x - std::floor(x); |
175 float yy = y - static_cast<float>(static_cast<int>(y)); | 174 float yy = y - std::floor(y); |
176 float zz = z - static_cast<float>(static_cast<int>(z)); | 175 float zz = z - std::floor(z); |
177 | 176 |
178 // "In practice, a trilinear interpolation is identical to two | 177 // "In practice, a trilinear interpolation is identical to two |
179 // bilinear interpolation combined with a linear interpolation" | 178 // bilinear interpolation combined with a linear interpolation" |
180 // https://en.wikipedia.org/wiki/Trilinear_interpolation#Method | 179 // https://en.wikipedia.org/wiki/Trilinear_interpolation#Method |
181 float a = ComputeBilinearInterpolationInternal(xx, yy, f000, f001, f010, f011); | 180 float a = ComputeBilinearInterpolationInternal(xx, yy, f000, f001, f010, f011); |