Skip to content
Snippets Groups Projects
Commit d41ab9d2 authored by Dmitri Naumov's avatar Dmitri Naumov Committed by Tom Fischer
Browse files

[MGT] Replace iterative search with explicit solution.

parent 7502c9a6
No related branches found
No related tags found
No related merge requests found
...@@ -48,15 +48,11 @@ HeuristicSearchLength::HeuristicSearchLength(MeshLib::Mesh const& mesh) ...@@ -48,15 +48,11 @@ HeuristicSearchLength::HeuristicSearchLength(MeshLib::Mesh const& mesh)
// happen due to numerics). // happen due to numerics).
_search_length = mean/2; _search_length = mean/2;
if (variance > 0.0) { if (variance > 0) {
const double std_deviation (sqrt(variance)); if (variance < mean*mean/4)
// heuristic to prevent negative search lengths _search_length -= std::sqrt(variance);
// in the case of a big standard deviation else
double c(2.0); _search_length = std::numeric_limits<double>::epsilon();
while (mean < c * std_deviation) {
c *= 0.9;
}
_search_length = (mean - c * std_deviation)/2;
} }
DBUG("[MeshNodeSearcher::MeshNodeSearcher] Calculated search length for mesh \"%s\" is %f.", DBUG("[MeshNodeSearcher::MeshNodeSearcher] Calculated search length for mesh \"%s\" is %f.",
......
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