#include <genesis/utils/tools/tickmarks.hpp>
Helper class to find "nice" tickmark intervals for creating scales and axes.
Definition at line 48 of file tickmarks.hpp.
Public Member Functions  
Tickmarks ()=default  
Tickmarks (Tickmarks const &)=default  
Tickmarks (Tickmarks &&)=default  
~Tickmarks ()=default  
std::vector< LabeledTick >  linear_labels (double min, double max, size_t target_steps) 
Return a set of labels with relative positions between min and max , where the labels correspond to the linear_ticks() numbers. More...  
std::vector< double >  linear_ticks (double min, double max, size_t target_steps) 
Calculate a set of ticks that linearily span from min to max in approximately target_steps many steps, where each tick sits on a "nice" number. More...  
std::vector< LabeledTick >  logarithmic_labels (double min, double max, double base=10.0) 
Return a set of labels with relative positions between min and max , where the labels correspond to logarithmic ticks. More...  
Tickmarks &  operator= (Tickmarks const &)=default 
Tickmarks &  operator= (Tickmarks &&)=default 
Static Public Member Functions  
static double  step_size (double interval_size, size_t target_steps) 
Calculate a step size that fills the interval_size in approximately target_steps many steps. More...  
Public Attributes  
bool  include_max = true 
Should the provided max value be included in the resulting list of ticks or not. More...  
bool  include_min = true 
Should the provided min value be included in the resulting list of ticks or not. More...  
bool  overshoot_at_max = false 
Should the highest value in the resulting list of ticks be above the provided max value (true ) or not (false ). More...  
double  relative_epsilon = std::numeric_limits<double>::epsilon() 
Relative epsilon used to exclude two tickmarks that are too close to each other. More...  
bool  undershoot_at_min = false 
Should the lowest value in the resulting list of ticks be below the provided min value (true ) or not (false ). More...  
Classes  
struct  LabeledTick 

default 

default 
std::vector< Tickmarks::LabeledTick > linear_labels  (  double  min, 
double  max,  
size_t  target_steps  
) 
Return a set of labels with relative positions between min
and max
, where the labels correspond to the linear_ticks() numbers.
This function is a convenience wrapper for linear_ticks(), that turns the tick positions into relative values, while keeping the actual tick value as a label. Relative position 0.0 corresponds to min
, relative position 1.0 to max
.
Definition at line 140 of file tickmarks.cpp.
std::vector< double > linear_ticks  (  double  min, 
double  max,  
size_t  target_steps  
) 
Calculate a set of ticks that linearily span from min
to max
in approximately target_steps
many steps, where each tick sits on a "nice" number.
See step_size() for what is meant by nice numbers.
Definition at line 83 of file tickmarks.cpp.
std::vector< Tickmarks::LabeledTick > logarithmic_labels  (  double  min, 
double  max,  
double  base = 10.0 

) 
Return a set of labels with relative positions between min
and max
, where the labels correspond to logarithmic ticks.
This function is the equivalent of linear_labels(), but instead uses logarithmic scaling. Also, it inserts as many ticks as are needed to go up to max
in powers of base
, and thus has no target steps.
Example: Given min == 1.0
, max == 350
, with overshoot_at_max == false
and include_max == true
, the resulting vector contains entries with labels 1, 10, 100, 350
.
Remark: There is no logarithmic equivalent for linear_ticks(), as those would simply be powers of base
up to max
.
Definition at line 155 of file tickmarks.cpp.

static 
Calculate a step size that fills the interval_size
in approximately target_steps
many steps.
The resulting step size is calculated to be a "nice" size, i.e. fits [ 1  2  5 ] * 10^n
. Thus, exemplary nice step sizes are 0.01, 20 and 500.
Definition at line 47 of file tickmarks.cpp.
bool include_max = true 
Should the provided max value be included in the resulting list of ticks or not.
Definition at line 141 of file tickmarks.hpp.
bool include_min = true 
Should the provided min value be included in the resulting list of ticks or not.
Definition at line 136 of file tickmarks.hpp.
bool overshoot_at_max = false 
Should the highest value in the resulting list of ticks be above the provided max value (true
) or not (false
).
Definition at line 153 of file tickmarks.hpp.
double relative_epsilon = std::numeric_limits<double>::epsilon() 
Relative epsilon used to exclude two tickmarks that are too close to each other.
Definition at line 158 of file tickmarks.hpp.
bool undershoot_at_min = false 
Should the lowest value in the resulting list of ticks be below the provided min value (true
) or not (false
).
Definition at line 147 of file tickmarks.hpp.