Skip to content
Snippets Groups Projects
Commit af0557af authored by Karsten Rink's avatar Karsten Rink
Browse files

added data-dependent epsilon calculation

parent 2dc3cd5d
No related branches found
No related tags found
No related merge requests found
...@@ -32,10 +32,9 @@ ...@@ -32,10 +32,9 @@
const double LayeredVolume::_invalid_value = -9999; const double LayeredVolume::_invalid_value = -9999;
const double LayeredVolume::_elevation_epsilon = 0.0001;
LayeredVolume::LayeredVolume() LayeredVolume::LayeredVolume()
: _mesh(nullptr) : _elevation_epsilon(0.0001), _mesh(nullptr)
{ {
} }
...@@ -60,6 +59,8 @@ bool LayeredVolume::createGeoVolumes(const MeshLib::Mesh &mesh, const std::vecto ...@@ -60,6 +59,8 @@ bool LayeredVolume::createGeoVolumes(const MeshLib::Mesh &mesh, const std::vecto
if (mesh.getDimension() != 2) if (mesh.getDimension() != 2)
return false; return false;
_elevation_epsilon = calcEpsilon(*rasters.back(), *rasters[0]);
// remove line elements, only tri + quad remain // remove line elements, only tri + quad remain
MeshLib::ElementExtraction ex(mesh); MeshLib::ElementExtraction ex(mesh);
ex.searchByElementType(MeshElemType::LINE); ex.searchByElementType(MeshElemType::LINE);
...@@ -204,6 +205,13 @@ bool LayeredVolume::exportToGeometry(GeoLib::GEOObjects &geo_objects) const ...@@ -204,6 +205,13 @@ bool LayeredVolume::exportToGeometry(GeoLib::GEOObjects &geo_objects) const
return true; return true;
} }
double LayeredVolume::calcEpsilon(const GeoLib::Raster &high, const GeoLib::Raster &low)
{
const double max (*std::max_element(high.begin(), high.end()));
const double min (*std::min_element(high.begin(), high.end()));
return ((max-min)*1e-07);
}
bool LayeredVolume::allRastersExist(const std::vector<std::string> &raster_paths) const bool LayeredVolume::allRastersExist(const std::vector<std::string> &raster_paths) const
{ {
for (auto raster = raster_paths.begin(); raster != raster_paths.end(); ++raster) for (auto raster = raster_paths.begin(); raster != raster_paths.end(); ++raster)
......
...@@ -77,6 +77,9 @@ private: ...@@ -77,6 +77,9 @@ private:
/// Removes duplicate 2D elements (possible due to outcroppings) /// Removes duplicate 2D elements (possible due to outcroppings)
void removeCongruentElements(std::size_t nLayers, std::size_t nElementsPerLayer); void removeCongruentElements(std::size_t nLayers, std::size_t nElementsPerLayer);
/// Calculates a data-dependent epsilon value
double calcEpsilon(const GeoLib::Raster &high, const GeoLib::Raster &low);
/// Checks if all raster files actually exist /// Checks if all raster files actually exist
bool allRastersExist(const std::vector<std::string> &raster_paths) const; bool allRastersExist(const std::vector<std::string> &raster_paths) const;
...@@ -84,7 +87,7 @@ private: ...@@ -84,7 +87,7 @@ private:
void cleanUpOnError(); void cleanUpOnError();
static const double _invalid_value; static const double _invalid_value;
static const double _elevation_epsilon; double _elevation_epsilon;
std::vector<MeshLib::Node*> _nodes; std::vector<MeshLib::Node*> _nodes;
std::vector<MeshLib::Element*> _elements; std::vector<MeshLib::Element*> _elements;
std::vector<MeshLib::Node> _attribute_points; std::vector<MeshLib::Node> _attribute_points;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment