fuzzyContains added
This commit is contained in:
parent
8a8bfc4124
commit
97b1c7167d
@ -4,6 +4,7 @@
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#include "QskIntervalF.h"
|
#include "QskIntervalF.h"
|
||||||
|
#include "QskFunctions.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
void QskIntervalF::unite( const QskIntervalF& other ) noexcept
|
void QskIntervalF::unite( const QskIntervalF& other ) noexcept
|
||||||
@ -118,6 +119,20 @@ QskIntervalF QskIntervalF::extended( qreal value ) const noexcept
|
|||||||
return QskIntervalF( lower, upper );
|
return QskIntervalF( lower, upper );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool QskIntervalF::fuzzyContains( qreal value ) const
|
||||||
|
{
|
||||||
|
if ( !isValid() )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if ( ( value < m_lowerBound ) && !qskFuzzyCompare( value, m_lowerBound ) )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if ( ( value > m_upperBound ) && !qskFuzzyCompare( value, m_upperBound ) )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef QT_NO_DEBUG_STREAM
|
#ifndef QT_NO_DEBUG_STREAM
|
||||||
|
|
||||||
#include <qdebug.h>
|
#include <qdebug.h>
|
||||||
|
@ -37,6 +37,7 @@ class QSK_EXPORT QskIntervalF
|
|||||||
void setWidth( qreal ) noexcept;
|
void setWidth( qreal ) noexcept;
|
||||||
|
|
||||||
constexpr bool contains( qreal value ) const noexcept;
|
constexpr bool contains( qreal value ) const noexcept;
|
||||||
|
bool fuzzyContains( qreal value ) const;
|
||||||
|
|
||||||
static constexpr QskIntervalF normalized( qreal value1, qreal value2 ) noexcept;
|
static constexpr QskIntervalF normalized( qreal value1, qreal value2 ) noexcept;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user