ndm  0.1.1
 All Classes Functions Variables Enumerations Pages
NDM::Axis Class Reference

Axis object in n-dimensional space. More...

#include <Axis.hh>

Public Types

enum  EMode { kAligned = 0, kFixed = 1 }
 Mode for axis.
 

Public Member Functions

 Axis (double min=0.0, double max=1.0, EMode mode=kAligned, double delta=1)
 
virtual ~Axis ()
 
void print () const
 Prints axis info. More...
 
void find (double v, double &min, double &max, std::string &path, int levelrequest=-1, int levelmax=100)
 Find bin and print info for given value. More...
 
void expand (char direction= '>', int power=1)
 Expand range. More...
 
void shrink (char direction= '>', int power=1)
 Shrink range. More...
 
void min (double m)
 Sets user defined minimum.
 
void max (double m)
 Sets user defined maximum.
 
void is_bin (bool b)
 Sets user defined maximum.
 
void minmax (double min, double max)
 Sets user defined minimum and maximum. More...
 
void level (unsigned int l)
 Sets level.
 
double min () const
 Returns user defined minimum.
 
double max () const
 Returns user defined maximum.
 
bool is_bin () const
 Returns user defined maximum.
 
double maxb () const
 Returns internal maximum.
 
double maxb_user () const
 Returns internal maximum2.
 
void info (std::string i)
 Sets info string.
 
std::string info () const
 Returns info string.
 
double to_user (double v) const
 Convert interal to user format.
 
double to_internal (double v) const
 Convert user to internal format.
 
unsigned int level () const
 Returns level.
 
void split (std::vector< double > &mins, int level)
 

Private Member Functions

int decimels_right (double num, double mult=10, double min=0.01, double max=0.99)
 
int decimels_left (double num, double mult=10, double min=0.01)
 
void find (double &v, int &levelrequest, int &levelmax, int &currentlevel, double &min, double &max, std::string &path)
 
void modify_range (char direction= '>', int power=1)
 
void recalculate_range ()
 

Private Attributes

double mMin {0.0}
 User defined minimum.
 
double mMax {1.0}
 User defined maximum.
 
bool mIsBin {false}
 Min max is in bin/user format.
 
EMode mMode {kAligned}
 Axis mode.
 
double mMaxB {1}
 Internal maximum.
 
double mShift {0}
 Shift to the internal min/max parameters.
 
double mMultiply {1}
 Multiply to the internal min/max parameters.
 
unsigned int mLevel {0}
 Level of division.
 
double mMinDelta {1}
 Minimal delta of axis range.
 
std::string mInfo {}
 Some additional info for axis.
 

Detailed Description

Axis object in n-dimensional space.

Author
Martin Vala vala..nosp@m.mart.nosp@m.in@gm.nosp@m.ail..nosp@m.com

Definition at line 12 of file Axis.hh.

Constructor & Destructor Documentation

NDM::Axis::Axis ( double  min = 0.0,
double  max = 1.0,
EMode  mode = kAligned,
double  delta = 1 
)

Constructor

Definition at line 10 of file Axis.cc.

References max(), min(), mMax, mMin, and recalculate_range().

NDM::Axis::~Axis ( )
virtual

Destructor

Definition at line 26 of file Axis.cc.

Member Function Documentation

int NDM::Axis::decimels_left ( double  num,
double  mult = 10,
double  min = 0.01 
)
private

Calculate number of decimels on left side of dot

Definition at line 245 of file Axis.cc.

Referenced by recalculate_range().

int NDM::Axis::decimels_right ( double  num,
double  mult = 10,
double  min = 0.01,
double  max = 0.99 
)
private

Calculate number of decimels on rigth side of dot

Definition at line 225 of file Axis.cc.

Referenced by recalculate_range().

void NDM::Axis::expand ( char  direction = '>',
int  power = 1 
)

Expand range.

Expand range by 2^power to left '<' or right '>' direction

Definition at line 156 of file Axis.cc.

References modify_range().

void NDM::Axis::find ( double  v,
double &  min,
double &  max,
std::string &  path,
int  levelrequest = -1,
int  levelmax = 100 
)

Find bin and print info for given value.

Find bin and print info for given value with maximum depth 'levelmax'

Definition at line 83 of file Axis.cc.

References maxb(), mMax, mMin, to_internal(), and to_user().

Referenced by find().

void NDM::Axis::find ( double &  v,
int &  levelrequest,
int &  levelmax,
int &  currentlevel,
double &  min,
double &  max,
std::string &  path 
)
private

Find bin and print info for given value with maximum depth 'levelmax'

Definition at line 116 of file Axis.cc.

References find(), max(), min(), mMinDelta, and to_user().

void NDM::Axis::minmax ( double  min,
double  max 
)

Sets user defined minimum and maximum.

Setting min and max

Definition at line 74 of file Axis.cc.

References max(), min(), mMax, and mMin.

void NDM::Axis::modify_range ( char  direction = '>',
int  power = 1 
)
private

Modify (expand/shrink) range by 2^power ('+' for up or '-'for down) to left '<' or right '>' direction

Definition at line 172 of file Axis.cc.

References mMax, mMaxB, mMin, print(), and recalculate_range().

Referenced by expand(), and shrink().

void NDM::Axis::print ( ) const

Prints axis info.

Print axis information

Definition at line 215 of file Axis.cc.

References maxb_user(), mLevel, mMax, mMaxB, mMin, mMode, mMultiply, and mShift.

Referenced by modify_range().

void NDM::Axis::recalculate_range ( )
private

Recalculate range correctly

Definition at line 33 of file Axis.cc.

References decimels_left(), decimels_right(), maxb_user(), mMax, mMaxB, mMin, mMode, mMultiply, and mShift.

Referenced by Axis(), and modify_range().

void NDM::Axis::shrink ( char  direction = '>',
int  power = 1 
)

Shrink range.

Shrink range by 2^power to left '<' or right '>' direction

Definition at line 164 of file Axis.cc.

References modify_range().

void NDM::Axis::split ( std::vector< double > &  mins,
int  level 
)

Returns list of minimums for specific level

Definition at line 266 of file Axis.cc.

References mMax, mMaxB, to_internal(), and to_user().

Referenced by NDM::Space::points().


The documentation for this class was generated from the following files: