Mercurial > hg > svcore
comparison base/LogRange.h @ 1392:667e369cfeab
LogRange tests
author | Chris Cannam |
---|---|
date | Tue, 28 Feb 2017 11:21:49 +0000 |
parents | 31f01931b781 |
children | ad5f892c0c4d |
comparison
equal
deleted
inserted
replaced
1391:2c0e04062a99 | 1392:667e369cfeab |
---|---|
21 | 21 |
22 class LogRange | 22 class LogRange |
23 { | 23 { |
24 public: | 24 public: |
25 /** | 25 /** |
26 * Map a linear range onto a logarithmic range. min and max are | |
27 * passed as the extents of the linear range and returned as the | |
28 * extents of the logarithmic range. thresh is the minimum value | |
29 * for the log range, to be used if the linear range spans zero. | |
30 */ | |
31 static void mapRange(double &min, double &max, double thresh = -10); | |
32 | |
33 /** | |
34 * Map a value onto a logarithmic range. This just means taking | 26 * Map a value onto a logarithmic range. This just means taking |
35 * the base-10 log of the absolute value, or using the threshold | 27 * the base-10 log of the absolute value, or using the threshold |
36 * value if the absolute value is zero. | 28 * value if the absolute value is zero. |
37 */ | 29 */ |
38 static double map(double value, double thresh = -10); | 30 static double map(double value, double thresh = -10); |
42 * means taking the value'th power of ten. | 34 * means taking the value'th power of ten. |
43 */ | 35 */ |
44 static double unmap(double value); | 36 static double unmap(double value); |
45 | 37 |
46 /** | 38 /** |
39 * Map a linear range onto a logarithmic range. min and max are | |
40 * passed as the extents of the linear range and returned as the | |
41 * extents of the logarithmic range. thresh is the minimum value | |
42 * for the log range, to be used if the linear range spans zero. | |
43 */ | |
44 static void mapRange(double &min, double &max, double thresh = -10); | |
45 | |
46 /** | |
47 * Estimate whether a set of values would be more properly shown | 47 * Estimate whether a set of values would be more properly shown |
48 * using a logarithmic than a linear scale. This is only ever | 48 * using a logarithmic than a linear scale. This is only ever |
49 * going to be a rough guess. | 49 * going to be a rough guess. |
50 */ | 50 */ |
51 static bool useLogScale(std::vector<double> values); | 51 static bool shouldUseLogScale(std::vector<double> values); |
52 | 52 |
53 }; | 53 }; |
54 | 54 |
55 #endif | 55 #endif |