Klang C++
Language Reference (draft)
Loading...
Searching...
No Matches
klang::Generic::Graph< SIZE >::Axis

Graph axis. More...

#include <klang.h>

Public Member Functions

bool valid () const
 
double range () const
 
bool contains (double value) const
 
void clear ()
 
void from (const Series &series, double Point::*axis)
 

Public Attributes

double min = 0
 
double max = 0
 

Detailed Description

template<int SIZE>
struct klang::Generic::Graph< SIZE >::Axis

Definition at line 1725 of file klang.h.

Member Function Documentation

◆ clear()

template<int SIZE>
void klang::Generic::Graph< SIZE >::Axis::clear ( )
inline

◆ contains()

template<int SIZE>
bool klang::Generic::Graph< SIZE >::Axis::contains ( double value) const
inline

Definition at line 1729 of file klang.h.

1729{ return value >= min && value <= max; }

◆ from()

template<int SIZE>
void klang::Generic::Graph< SIZE >::Axis::from ( const Series & series,
double Point::* axis )
inline

Definition at line 1732 of file klang.h.

1732 {
1733 if (!series.count) return;
1734 int points = 0;
1735 for (unsigned int p = 0; p < series.count; p++) {
1736 const Point& pt = series[p];
1737 if (pt.valid() && !::isinf(pt.*axis)) {
1738 if (!points || pt.*axis < min) min = pt.*axis;
1739 if (!points || pt.*axis > max) max = pt.*axis;
1740 points++;
1741 }
1742 }
1743 if (std::abs(max) < 0.0000000001) max = 0;
1744 if (std::abs(min) < 0.0000000001) min = 0;
1745 if (std::abs(max) > 1000000000.0) max = 0;
1746 if (std::abs(min) > 1000000000.0) min = 0;
1747 if (min > max) max = min = 0;
1748 }

References klang::Generic::Graph< SIZE >::Axis::max, and klang::Generic::Graph< SIZE >::Axis::min.

◆ range()

template<int SIZE>
double klang::Generic::Graph< SIZE >::Axis::range ( ) const
inline

Definition at line 1728 of file klang.h.

1728{ return max - min; }

◆ valid()

template<int SIZE>
bool klang::Generic::Graph< SIZE >::Axis::valid ( ) const
inline

Definition at line 1727 of file klang.h.

1727{ return max != min; }

References klang::Generic::Graph< SIZE >::Axis::max, and klang::Generic::Graph< SIZE >::Axis::min.

Member Data Documentation

◆ max

◆ min