9#include "TernaryPoint.h"
10#include "TernaryConstants.h"
17TernaryPoint::TernaryPoint()
24TernaryPoint::TernaryPoint( qreal a, qreal b )
31void TernaryPoint::set( qreal a, qreal b )
33 if ( a >= 0.0 && a <= 1.0
34 && b >= 0.0 && b <= 1.0
35 && 1.0 - a - b >= -2.0 * std::numeric_limits<qreal>::epsilon() ) {
38 Q_ASSERT( isValid() );
42 Q_ASSERT( ! isValid() );
46bool TernaryPoint::isValid()
const
49 m_a >= 0.0 && m_a <= 1.0
50 && m_b >= 0.0 && m_b <= 1.0
51 && 1.0 - m_a + m_b >= - std::numeric_limits<qreal>::epsilon();
58 text <<
"[TernaryPoint: ";
59 if ( point.isValid() ) {
60 text.setFieldWidth( 2 );
62 text << ( int ) ( point.a() * 100.0 ) <<
"%|"
63 << ( int ) ( point.b() * 100.0 ) <<
"%|"
64 << ( int ) ( point.c() * 100.0 ) <<
"%]";
66 text <<
"a=" << point.a() <<
" - b=" << point.b() <<
" - INVALID]";
74 if ( point.isValid() ) {
81 QPointF bPosition( 1.0 - point.b(), 0.0 );
82 QPointF aPosition( point.a() * AxisVector_C_A );
83 QPointF result( bPosition + aPosition );
86 qWarning() <<
"TernaryPoint::translate(TernaryPoint): cannot translate invalid ternary points:"
TernaryPoint defines a point within a ternary coordinate plane.
KCALENDARCORE_EXPORT QDataStream & operator<<(QDataStream &out, const KCalendarCore::Alarm::Ptr &)
bool isValid(QStringView ifopt)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:02:35 by
doxygen 1.12.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.