Skip to content
Snippets Groups Projects
Commit d3383054 authored by Oliver Sander's avatar Oliver Sander Committed by sander@FU-BERLIN.DE
Browse files

restrict testing to point that are closer than 0.5*M_PI apart. That's a hacky...

restrict testing to point that are closer than 0.5*M_PI apart.  That's a hacky way to avoid degenerate cases

[[Imported from SVN: r8038]]
parent c64e39e4
No related branches found
No related tags found
No related merge requests found
......@@ -15,6 +15,17 @@ using Dune::FieldVector;
using namespace Dune;
/** \brief Computes the diameter of a set */
template <class TargetSpace>
double diameter(const std::vector<TargetSpace>& v)
{
double d = 0;
for (size_t i=0; i<v.size(); i++)
for (size_t j=0; j<v.size(); j++)
d = std::max(d, TargetSpace::distance(v[i],v[j]));
return d;
}
const double eps = 1e-4;
template <class TargetSpace>
......@@ -322,6 +333,12 @@ void test()
for (int j=0; j<nTestPoints; j++) {
std::vector<TargetSpace> testPointPair(2);
testPointPair[0] = testPoints[i];
testPointPair[1] = testPoints[j];
if (diameter(testPointPair) > 0.5*M_PI)
continue;
testDerivativesOfSquaredDistance<TargetSpace>(testPoints[i], testPoints[j]);
}
......
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