Engauge Digitizer  2
LinearToLog.cpp
Go to the documentation of this file.
1 /******************************************************************************************************
2  * (C) 2016 markummitchell@github.com. This file is part of Engauge Digitizer, which is released *
3  * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file *
4  * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. *
5  ******************************************************************************************************/
6 
7 #include "LinearToLog.h"
8 #include <qmath.h>
9 
11 {
12 }
13 
14 double LinearToLog::delinearize (double valueLinear,
15  bool isLog) const
16 {
17  double valueLinearOrLog = valueLinear;
18  if (isLog) {
19  valueLinearOrLog = qExp (valueLinear);
20  }
21 
22  return valueLinearOrLog;
23 }
24 
25 double LinearToLog::linearize (double valueLogOrLinear,
26  bool isLog) const
27 {
28  double valueLinear = valueLogOrLinear;
29  if (isLog) {
30  valueLinear = qLn (valueLogOrLinear);
31  }
32 
33  return valueLinear;
34 }
double linearize(double value, bool isLog) const
Convert log coordinates to linear. This is a noop if the input is already linear. ...
Definition: LinearToLog.cpp:25
double delinearize(double value, bool isLog) const
Convert linear coordinates to log. This is a noop if the output is supposed to be linear...
Definition: LinearToLog.cpp:14