27 auto* new_raster_data(
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;
55 delete[] new_raster_data;
70 auto cell_x =
static_cast<int>(
72 auto cell_y =
static_cast<int>(
77 cell_x = (cell_x < 0) ? 0
81 cell_y = (cell_y < 0) ? 0
98 double const xIdx(std::floor(xPos));
99 double const yIdx(std::floor(yPos));
102 double const xShift = std::abs((xPos - xIdx) - 0.5);
103 double const yShift = std::abs((yPos - yIdx) - 0.5);
104 Eigen::Vector4d weight = {(1 - xShift) * (1 - yShift),
105 xShift * (1 - yShift), xShift * yShift,
106 (1 - xShift) * yShift};
109 int const xShiftIdx = (xPos - xIdx >= 0.5) ? 1 : -1;
110 int const yShiftIdx = (yPos - yIdx >= 0.5) ? 1 : -1;
111 std::array<int, 4>
const x_nb = {{0, xShiftIdx, xShiftIdx, 0}};
112 std::array<int, 4>
const y_nb = {{0, 0, yShiftIdx, yShiftIdx}};
115 Eigen::Vector4d pix_val{};
116 unsigned no_data_count(0);
117 for (
unsigned j = 0; j < 4; ++j)
121 if ((xIdx + x_nb[j]) < 0 || (yIdx + y_nb[j]) < 0 ||
129 pix_val[j] =
_raster_data[
static_cast<std::size_t
>(yIdx + y_nb[j]) *
131 static_cast<std::size_t
>(xIdx + x_nb[j])];
136 std::numeric_limits<double>::epsilon())
144 if (no_data_count > 0)
146 if (no_data_count == 4)
151 weight /= weight.sum();
155 return weight.dot(pix_val);
Definition of the GeoLib::Raster class.
GeoLib::RasterHeader _header
void refineRaster(std::size_t scaling)
double getValueAtPoint(const MathLib::Point3d &pnt) const
bool isPntOnRaster(MathLib::Point3d const &pnt) const
Checks if the given point is located within the (x,y)-extension of the raster.
double interpolateValueAtPoint(const MathLib::Point3d &pnt) const
Interpolates the elevation of the given point based on the 8-neighbourhood of the raster cell it is l...