195 typedef typename Field_T::value_type Data_T;
196 typedef typename ComputationType<Data_T>::type Value_T;
202 const float tgtToSrcMult = 2.0;
203 const float filterCoordMult = 1.0f / (tgtToSrcMult);
211 boost::mutex::scoped_lock lock(
m_mutex);
222 for (
int k = box.min.z; k <= box.max.z; ++k) {
223 for (
int j = box.min.y; j <= box.max.y; ++j) {
224 for (
int i = box.min.x; i <= box.max.x; ++i) {
225 Value_T accumValue =
static_cast<Value_T
>(0.0);
226 float accumWeight = 0.0f;
228 const int curTgt =
V3i(i, j, k)[
m_dim];
229 const float curSrc =
discToCont(curTgt) * tgtToSrcMult;
232 static_cast<int>(
std::floor(curSrc - support * tgtToSrcMult));
234 static_cast<int>(
std::ceil(curSrc + support *
236 startSrc = std::max(startSrc, srcDw.min[
m_dim]);
237 endSrc = std::min(endSrc, srcDw.max[
m_dim]);
239 for (
int s = startSrc; s <= endSrc; ++s) {
241 const int xIdx =
m_dim == 0 ? s : i;
242 const int yIdx =
m_dim == 1 ? s : j;
243 const int zIdx =
m_dim == 2 ? s : k;
247 const float weight =
m_filterOp.eval(std::abs(srcP - curSrc) *
250 const Value_T value =
m_src.fastValue(xIdx, yIdx, zIdx);
252 accumWeight += weight;
253 accumValue += value * weight;
256 if (accumWeight > 0.0f &&
257 accumValue != static_cast<Value_T>(0.0)) {
258 m_tgt.fastLValue(i, j, k) = accumValue / accumWeight;
266 boost::mutex::scoped_lock lock(
m_mutex);
const std::vector< Box3i > & m_blocks
const FilterOp_T & m_filterOp
FIELD3D_VEC3_T< T > floor(const FIELD3D_VEC3_T< T > &v)
Floor function for Vec3.
FIELD3D_VEC3_T< T > ceil(const FIELD3D_VEC3_T< T > &v)
Ceil function for Vec3.
bool checkInputEmpty(const SparseField< Data_T > &src, const SparseField< Data_T > &tgt, const Box3i &tgtBox, const float support, const size_t dim)
double discToCont(int discCoord)
Goes from discrete coordinates to continuous coordinates See Graphics Gems - What is a pixel...