TernaryPoint Class Reference

#include <TernaryPoint.h>

Collaboration diagram for TernaryPoint:

Collaboration graph
[legend]

List of all members.


Detailed Description

TernaryPoint defines a point within a ternary coordinate plane.

Definition at line 40 of file TernaryPoint.h.


Public Member Functions

double a () const
double b () const
double c () const
bool isValid () const
void set (double a, double b)
 TernaryPoint (double a, double b)
 TernaryPoint ()

Constructor & Destructor Documentation

TernaryPoint::TernaryPoint (  ) 

Definition at line 38 of file TernaryPoint.cpp.

References isValid().

00039     : m_a( -1.0 )
00040     , m_b( -1.0 )
00041 {
00042     Q_ASSERT( !isValid() );
00043 }

TernaryPoint::TernaryPoint ( double  a,
double  b 
)

Definition at line 45 of file TernaryPoint.cpp.

00046     : m_a( -1.0 )
00047     , m_b( -1.0 )
00048 {
00049     set( a, b );
00050 }


Member Function Documentation

double TernaryPoint::a (  )  const

Definition at line 46 of file TernaryPoint.h.

Referenced by operator<<(), and translate().

00046 { return m_a; }

double TernaryPoint::b (  )  const

Definition at line 47 of file TernaryPoint.h.

Referenced by operator<<(), and translate().

00047 { return m_b; }

double TernaryPoint::c (  )  const

Definition at line 48 of file TernaryPoint.h.

Referenced by operator<<().

00048 { return 1.0 - m_a - m_b; }

bool TernaryPoint::isValid (  )  const

Definition at line 67 of file TernaryPoint.cpp.

Referenced by operator<<(), set(), TernaryPoint(), and translate().

00068 {
00069     return
00070         m_a >= 0.0 && m_a <= 1.0
00071         && m_b >= 0.0 && m_b <= 1.0
00072         && 1.0 - m_a + m_b >= - std::numeric_limits<double>::epsilon();
00073 }

void TernaryPoint::set ( double  a,
double  b 
)

Definition at line 52 of file TernaryPoint.cpp.

References isValid().

00053 {
00054     if ( a >= 0.0 && a <= 1.0
00055          && b >= 0.0 && b <= 1.0
00056          && 1.0 - a - b >= -2.0 * std::numeric_limits<double>::epsilon() ) {
00057         m_a = a;
00058         m_b = b;
00059         Q_ASSERT( isValid() ); // more a test for isValid
00060     } else {
00061         m_a = -1.0;
00062         m_b = -1.0;
00063         Q_ASSERT( ! isValid() );
00064     }
00065 }


The documentation for this class was generated from the following files:
Generated on Thu Mar 4 23:25:05 2010 for KD Chart 2 by  doxygen 1.5.4