Klang C++ 0.7.15
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 3419 of file klang.h.

Member Function Documentation

◆ clear()

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

Definition at line 3424 of file klang.h.

3424{ min = max = 0; }

Referenced by klang::Generic::Graph< SIZE >::getAxes().

◆ contains()

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

Definition at line 3423 of file klang.h.

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

References klang::Generic::Graph< SIZE >::Axis::max.

Referenced by klang::Generic::Graph< SIZE >::Axes::contains().

◆ from()

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

Definition at line 3426 of file klang.h.

3426 {
3427 if (!series.count) return;
3428 int points = 0;
3429 for (unsigned int p = 0; p < series.count; p++) {
3430 const Point& pt = series[p];
3431 if (pt.valid() && !::isinf(pt.*axis)) {
3432 if (!points || pt.*axis < min) min = pt.*axis;
3433 if (!points || pt.*axis > max) max = pt.*axis;
3434 points++;
3435 }
3436 }
3437 if (std::abs(max) < 0.0000000001) max = 0;
3438 if (std::abs(min) < 0.0000000001) min = 0;
3439 if (std::abs(max) > 1000000000.0) max = 0;
3440 if (std::abs(min) > 1000000000.0) min = 0;
3441 if (min > max) max = min = 0;
3442 }

References klang::Array< TYPE, CAPACITY >::count, and klang::Generic::Graph< SIZE >::Point::valid().

Referenced by klang::Generic::Graph< SIZE >::getAxes().

◆ range()

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

◆ valid()

Member Data Documentation

◆ max

◆ min