diff --git a/GeoLib/Raster.cpp b/GeoLib/Raster.cpp index 04d06c1b9d68c4553cae724bd96560333f80528a..6e711f3493f7f5a96b92c5b142dfffadd81e1622 100644 --- a/GeoLib/Raster.cpp +++ b/GeoLib/Raster.cpp @@ -55,41 +55,6 @@ Raster::~Raster() delete [] _raster_data; } -Raster* Raster::getRasterFromSurface(Surface const& sfc, double cell_size, double no_data_val) -{ - MathLib::Point3d const& ll(sfc.getAABB().getMinPoint()); - MathLib::Point3d const& ur(sfc.getAABB().getMaxPoint()); - - const std::size_t n_cols = static_cast<std::size_t>(std::abs(ur[0]-ll[0]) / cell_size)+1; - const std::size_t n_rows = static_cast<std::size_t>(std::abs(ur[1]-ll[1]) / cell_size)+1; - const std::size_t n_triangles(sfc.getNumberOfTriangles()); - auto* z_vals(new double[n_cols * n_rows]); - std::size_t k(0); - - for (std::size_t r(0); r < n_cols; r++) { - for (std::size_t c(0); c < n_rows; c++) { - GeoLib::Point const test_pnt = { ll[0] + r*cell_size, ll[1] + c*cell_size, 0}; - for (k=0; k<n_triangles; k++) { - if (sfc[k]->containsPoint2D(test_pnt)) { - GeoLib::Triangle const * const tri (sfc[k]); - // compute coefficients c0, c1, c2 for the plane f(x,y) = c0 x + c1 y + c2 - double coeff[3] = {0.0, 0.0, 0.0}; - GeoLib::getPlaneCoefficients(*tri, coeff); - z_vals[r*n_rows+c] = coeff[0] * test_pnt[0] + coeff[1] * test_pnt[1] + coeff[2]; - break; - } - } - if (k==n_triangles) { - z_vals[r*n_rows+c] = no_data_val; - } - } - } - - RasterHeader header = { std::size_t(n_cols), std::size_t(n_rows), 1, - MathLib::Point3d(ll), cell_size, static_cast<double>(-9999) }; - return new Raster(header, z_vals, z_vals+n_cols*n_rows); -} - double Raster::getValueAtPoint(const MathLib::Point3d &pnt) const { if (pnt[0]>=_header.origin[0] && pnt[0]<(_header.origin[0]+(_header.cell_size*_header.n_cols)) && diff --git a/GeoLib/Raster.h b/GeoLib/Raster.h index 5bda05f0937ffc06e3b25d061e998fd1e6121886..591652102b35557fe49a59fce17b19e6576672a8 100644 --- a/GeoLib/Raster.h +++ b/GeoLib/Raster.h @@ -97,9 +97,6 @@ public: ~Raster(); - /// Creates a Raster based on a GeoLib::Surface - static Raster* getRasterFromSurface(Surface const& sfc, double cell_size, double no_data_val = -9999); - private: void setCellSize(double cell_size); void setNoDataVal (double no_data_val);