35 for (std::size_t new_row(row * scaling);
36 new_row < (row + 1) * scaling;
40 for (std::size_t new_col(col * scaling);
41 new_col < (col + 1) * scaling;
91 double const xIdx(std::floor(xPos));
92 double const yIdx(std::floor(yPos));
95 double const xShift = std::abs((xPos - xIdx) - 0.5);
96 double const yShift = std::abs((yPos - yIdx) - 0.5);
97 Eigen::Vector4d weight = {(1 - xShift) * (1 - yShift),
98 xShift * (1 - yShift), xShift * yShift,
99 (1 - xShift) * yShift};
102 int const xShiftIdx = (xPos - xIdx >= 0.5) ? 1 : -1;
103 int const yShiftIdx = (yPos - yIdx >= 0.5) ? 1 : -1;
104 std::array<int, 4>
const x_nb = {{0, xShiftIdx, xShiftIdx, 0}};
105 std::array<int, 4>
const y_nb = {{0, 0, yShiftIdx, yShiftIdx}};
108 Eigen::Vector4d pix_val{};
109 unsigned no_data_count(0);
110 for (
unsigned j = 0; j < 4; ++j)
114 if ((xIdx + x_nb[j]) < 0 || (yIdx + y_nb[j]) < 0 ||
122 pix_val[j] =
_raster_data[
static_cast<std::size_t
>(yIdx + y_nb[j]) *
124 static_cast<std::size_t
>(xIdx + x_nb[j])];
129 std::numeric_limits<double>::epsilon())
137 if (no_data_count > 0)
139 if (no_data_count == 4)
144 weight /= weight.sum();
148 return weight.dot(pix_val);