File indexing completed on 2024-12-15 04:02:37

0001 /*
0002  * SPDX-FileCopyrightText: 2001-2015 Klaralvdalens Datakonsult AB. All rights reserved.
0003  *
0004  * This file is part of the KD Chart library.
0005  *
0006  * SPDX-License-Identifier: GPL-2.0-or-later
0007  */
0008 
0009 #ifndef TERNARYPOINT_H
0010 #define TERNARYPOINT_H
0011 
0012 #include <QtDebug>
0013 #include <QPointF>
0014 
0015 /**
0016   * @brief TernaryPoint defines a point within a ternary coordinate plane
0017   * \internal
0018   */
0019 class TernaryPoint
0020 {
0021 public:
0022     TernaryPoint();
0023     TernaryPoint( qreal a, qreal b );
0024 
0025     qreal a() const { return m_a; }
0026     qreal b() const { return m_b; }
0027     qreal c() const { return 1.0 - m_a - m_b; }
0028 
0029     void set( qreal a, qreal b );
0030 
0031     bool isValid() const;
0032 
0033 private:
0034     qreal m_a;
0035     qreal m_b;
0036 };
0037 
0038 QDebug operator<<( QDebug stream, const TernaryPoint& point );
0039 
0040 QPointF translate( const TernaryPoint& );
0041 
0042 #endif