20 Q_PROPERTY( qreal lowerBound READ lowerBound WRITE setLowerBound )
21 Q_PROPERTY( qreal upperBound READ upperBound WRITE setUpperBound )
22 Q_PROPERTY( qreal length READ length )
26 constexpr QskIntervalF( qreal lowerBound, qreal upperBound )
noexcept;
28 void setInterval( qreal lowerBound, qreal upperBound )
noexcept;
30 constexpr bool operator==(
const QskIntervalF& )
const noexcept;
31 constexpr bool operator!=(
const QskIntervalF& )
const noexcept;
33 constexpr qreal lowerBound()
const noexcept;
34 void setLowerBound( qreal )
noexcept;
36 constexpr qreal upperBound()
const noexcept;
37 void setUpperBound( qreal )
noexcept;
39 void spanFromLowerBound( qreal )
noexcept;
40 void spanFromUpperBound( qreal )
noexcept;
42 constexpr qreal length()
const noexcept;
43 void setLength( qreal )
noexcept;
45 constexpr bool contains( qreal value )
const noexcept;
46 constexpr bool contains(
const QskIntervalF& )
const noexcept;
48 constexpr bool isBoundary( qreal value )
const noexcept;
50 bool fuzzyContains( qreal value )
const;
53 bool fuzzyIsBoundary( qreal value )
const;
55 static constexpr QskIntervalF normalized( qreal value1, qreal value2 )
noexcept;
57 void translate( qreal offset )
noexcept;
58 constexpr QskIntervalF translated( qreal offset )
const noexcept;
66 void extend( qreal value )
noexcept;
80 constexpr bool isValid()
const noexcept;
81 constexpr bool isNull()
const noexcept;
82 constexpr bool isEmpty()
const noexcept;
84 void invalidate()
noexcept;
94 qreal m_lowerBound = 0.0;
95 qreal m_upperBound = -1.0;
102QT_WARNING_DISABLE_CLANG(
"-Wfloat-equal")
103QT_WARNING_DISABLE_GCC("-Wfloat-equal")
104QT_WARNING_DISABLE_INTEL(1572)
107 : m_lowerBound( lowerBound )
108 , m_upperBound( upperBound )
112inline void QskIntervalF::setInterval( qreal lowerBound, qreal upperBound )
noexcept
114 m_lowerBound = lowerBound;
115 m_upperBound = upperBound;
118inline void QskIntervalF::setLowerBound( qreal value )
noexcept
120 m_lowerBound = value;
123inline void QskIntervalF::setUpperBound( qreal value )
noexcept
125 m_upperBound = value;
128inline constexpr qreal QskIntervalF::lowerBound() const noexcept
133inline constexpr qreal QskIntervalF::upperBound() const noexcept
138inline constexpr qreal QskIntervalF::length() const noexcept
140 return ( m_upperBound > m_lowerBound ) ? ( m_upperBound - m_lowerBound ) : 0.0;
143inline void QskIntervalF::setLength( qreal length )
noexcept
145 m_upperBound = m_lowerBound + length;
148inline constexpr bool QskIntervalF::isValid() const noexcept
150 return m_lowerBound <= m_upperBound;
153inline constexpr bool QskIntervalF::isNull() const noexcept
155 return m_lowerBound == m_upperBound;
158inline constexpr bool QskIntervalF::isEmpty() const noexcept
160 return m_upperBound <= m_lowerBound;
163inline void QskIntervalF::invalidate() noexcept
169inline constexpr bool QskIntervalF::contains( qreal value )
const noexcept
171 return ( value >= m_lowerBound ) && ( value <= m_upperBound );
174inline constexpr bool QskIntervalF::contains(
const QskIntervalF& interval )
const noexcept
176 return interval.isValid() && contains( interval.m_lowerBound )
177 && contains( interval.m_upperBound );
180inline constexpr bool QskIntervalF::isBoundary( qreal value )
const noexcept
182 return ( value == m_lowerBound ) || ( value == m_upperBound );
185inline void QskIntervalF::translate( qreal offset )
noexcept
187 m_lowerBound += offset;
188 m_upperBound += offset;
191inline constexpr QskIntervalF QskIntervalF::translated( qreal offset )
const noexcept
193 return QskIntervalF( m_lowerBound + offset, m_upperBound + offset );
196inline constexpr QskIntervalF QskIntervalF::normalized( qreal value1, qreal value2 )
noexcept
203 return intersected( other );
208 return united( other );
219 *
this = intersected( other );
223inline constexpr bool QskIntervalF::operator==(
const QskIntervalF& other )
const noexcept
225 return qFuzzyCompare( m_lowerBound, other.m_lowerBound ) &&
226 qFuzzyCompare( m_upperBound, other.m_upperBound );
229inline constexpr bool QskIntervalF::operator!=(
const QskIntervalF& other )
const noexcept
231 return ( !( *
this == other ) );
234inline QskIntervalF QskIntervalF::operator|( qreal value )
const noexcept
236 return extended( value );
239inline QskIntervalF& QskIntervalF::operator|=( qreal value )
noexcept
241 *
this = *
this | value;
247#ifndef QT_NO_DEBUG_STREAM
250QSK_EXPORT QDebug operator<<( QDebug,
const QskIntervalF& );