Mercurial > hg > aimc
comparison trunk/src/Modules/Output/Graphics/Scale/ScaleLog.h @ 398:3ee03a6b95a0
- All \t to two spaces (style guide compliance)
author | tomwalters |
---|---|
date | Fri, 15 Oct 2010 05:46:53 +0000 |
parents | 7a573750b186 |
children | dd13c9834ceb |
comparison
equal
deleted
inserted
replaced
397:7a573750b186 | 398:3ee03a6b95a0 |
---|---|
22 * | 22 * |
23 * It is very advisable to use Scale::Create() to an instance of this scale. | 23 * It is very advisable to use Scale::Create() to an instance of this scale. |
24 */ | 24 */ |
25 class ScaleLog : public Scale { | 25 class ScaleLog : public Scale { |
26 public: | 26 public: |
27 ScaleLog(unsigned int min, unsigned int max, float density) | 27 ScaleLog(unsigned int min, unsigned int max, float density) |
28 : Scale(min, max, density) { m_iType = SCALE_LOG; m_sName="log"; }; | 28 : Scale(min, max, density) { m_iType = SCALE_LOG; m_sName="log"; }; |
29 | 29 |
30 /*! The log scale has a problem, because log(0)=inf, so all values below | 30 /*! The log scale has a problem, because log(0)=inf, so all values below |
31 * 1e-5 are truncated to 1e-5. */ | 31 * 1e-5 are truncated to 1e-5. */ |
32 float FromLinear(float fFreq) { | 32 float FromLinear(float fFreq) { |
33 if (fFreq<1e-5f) fFreq=1e-5f; | 33 if (fFreq<1e-5f) fFreq=1e-5f; |
34 return log(fFreq); | 34 return log(fFreq); |
35 }; | 35 }; |
36 | 36 |
37 float ToLinear(float fFreq) { | 37 float ToLinear(float fFreq) { |
38 return exp(fFreq); | 38 return exp(fFreq); |
39 }; | 39 }; |
40 }; | 40 }; |
41 | 41 |
42 #endif /* __MODULE_SCALE_LOG_H__ */ | 42 #endif /* __MODULE_SCALE_LOG_H__ */ |