some additional methods added
This commit is contained in:
parent
ea12350d14
commit
33c0d92ee1
@ -152,6 +152,36 @@ QskIntervalF QskIntervalF::extended( qreal value ) const noexcept
|
||||
return QskIntervalF( lower, upper );
|
||||
}
|
||||
|
||||
void QskIntervalF::spanFromLowerBound( qreal value ) noexcept
|
||||
{
|
||||
if ( !isValid() )
|
||||
{
|
||||
m_lowerBound = value;
|
||||
m_upperBound = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_lowerBound = value;
|
||||
if ( m_lowerBound > m_upperBound )
|
||||
m_upperBound = m_lowerBound;
|
||||
}
|
||||
}
|
||||
|
||||
void QskIntervalF::spanFromUpperBound( qreal value ) noexcept
|
||||
{
|
||||
if ( !isValid() )
|
||||
{
|
||||
m_lowerBound = value;
|
||||
m_upperBound = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_upperBound = value;
|
||||
if ( m_lowerBound > m_upperBound )
|
||||
m_lowerBound = m_upperBound;
|
||||
}
|
||||
}
|
||||
|
||||
bool QskIntervalF::fuzzyContains( qreal value ) const
|
||||
{
|
||||
if ( !isValid() )
|
||||
|
@ -35,15 +35,22 @@ class QSK_EXPORT QskIntervalF
|
||||
constexpr qreal upperBound() const noexcept;
|
||||
void setUpperBound( qreal ) noexcept;
|
||||
|
||||
void spanFromLowerBound( qreal ) noexcept;
|
||||
void spanFromUpperBound( qreal ) noexcept;
|
||||
|
||||
constexpr qreal width() const noexcept;
|
||||
void setWidth( qreal ) noexcept;
|
||||
|
||||
constexpr bool contains( qreal value ) const noexcept;
|
||||
constexpr bool contains( const QskIntervalF& ) const noexcept;
|
||||
|
||||
constexpr bool isBoundary( qreal value ) const noexcept;
|
||||
|
||||
bool fuzzyContains( qreal value ) const;
|
||||
bool fuzzyContains( const QskIntervalF& ) const;
|
||||
|
||||
bool fuzzyIsBoundary( qreal value ) const;
|
||||
|
||||
static constexpr QskIntervalF normalized( qreal value1, qreal value2 ) noexcept;
|
||||
|
||||
void translate( qreal offset ) noexcept;
|
||||
@ -159,6 +166,11 @@ inline constexpr bool QskIntervalF::contains( const QskIntervalF& interval ) con
|
||||
&& contains( interval.m_upperBound );
|
||||
}
|
||||
|
||||
inline constexpr bool QskIntervalF::isBoundary( qreal value ) const noexcept
|
||||
{
|
||||
return ( value == m_lowerBound ) || ( value == m_upperBound );
|
||||
}
|
||||
|
||||
inline void QskIntervalF::translate( qreal offset ) noexcept
|
||||
{
|
||||
m_lowerBound += offset;
|
||||
|
Loading…
x
Reference in New Issue
Block a user