Skip to content

Commit

Permalink
Reduced tolerances for fuzzyCompare function.
Browse files Browse the repository at this point in the history
This is needed due to poor accuracy in alignment calculations
for meta models.
  • Loading branch information
robbr48 committed Aug 12, 2016
1 parent af142ed commit 5fc6629
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion OMEdit/OMEditGUI/Editors/MetaModelEditor.cpp
Expand Up @@ -875,7 +875,9 @@ void MetaModelEditor::alignInterfaces(QString fromInterface, QString toInterface
inline bool MetaModelEditor::fuzzyCompare(double p1, double p2)
{
//! @todo What tolerance should be used? This is just a random number that seemed to work for some reason.
return (qAbs(p1 - p2) <= qMax(1e-5 * qMin(qAbs(p1), qAbs(p2)),1e-10));
bool retval = (qAbs(p1 - p2) <= qMax(1e-4 * qMin(qAbs(p1), qAbs(p2)),1e-5));
qDebug() << "Comparing " << p1 << " with " << p2 << ": " << retval;
return retval;
}

/*!
Expand Down

0 comments on commit 5fc6629

Please sign in to comment.