New function VFuzzyOnAxis.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2019-07-21 15:22:09 +03:00
parent 1ab19c05a3
commit 95b9c3ed19
2 changed files with 8 additions and 3 deletions

View File

@ -105,4 +105,10 @@ static inline bool VFuzzyComparePoints(const QPointF &p1, const QPointF &p2)
return QLineF(p1, p2).length() <= accuracyPointOnLine;
}
Q_REQUIRED_RESULT static inline bool VFuzzyOnAxis(qreal v1, qreal v2);
static inline bool VFuzzyOnAxis(qreal v1, qreal v2)
{
return qAbs(v1 - v2) <= accuracyPointOnLine;
}
#endif // VGEOMETRYDEF_H

View File

@ -87,7 +87,7 @@ void VBestSquare::NewResult(const VBestSquareResData &data)
{
if (d->saveLength)
{
if (qAbs(data.depthPosition - d->data.depthPosition) <= accuracyPointOnLine
if (VFuzzyOnAxis(data.depthPosition, d->data.depthPosition)
&& IsImprovedSidePosition(data.sidePosition))
{
SaveResult();
@ -99,8 +99,7 @@ void VBestSquare::NewResult(const VBestSquareResData &data)
}
else
{
if (IsImprovedSidePosition(data.sidePosition)
|| qAbs(data.sidePosition - d->data.sidePosition) <= accuracyPointOnLine)
if (IsImprovedSidePosition(data.sidePosition) || VFuzzyOnAxis(data.sidePosition, d->data.sidePosition))
{
SaveResult();
}