qwt_transform.cpp
Go to the documentation of this file.
00001 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
00002  * Qwt Widget Library
00003  * Copyright (C) 1997   Josef Wilgen
00004  * Copyright (C) 2002   Uwe Rathmann
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the Qwt License, Version 1.0
00008  *****************************************************************************/
00009 
00010 #include "qwt_transform.h"
00011 #include "qwt_math.h"
00012 
00013 #if QT_VERSION < 0x040601
00014 #define qExp(x) ::exp(x)
00015 #endif
00016 
00018 const double QwtLogTransform::LogMin = 1.0e-150;
00019 
00021 const double QwtLogTransform::LogMax = 1.0e150;
00022 
00024 QwtTransform::QwtTransform()
00025 {
00026 }
00027 
00029 QwtTransform::~QwtTransform()
00030 {
00031 }
00032 
00037 double QwtTransform::bounded( double value ) const
00038 {
00039     return value;
00040 }
00041 
00043 QwtNullTransform::QwtNullTransform():
00044     QwtTransform()
00045 {
00046 }
00047 
00049 QwtNullTransform::~QwtNullTransform()
00050 {
00051 }
00052 
00057 double QwtNullTransform::transform( double value ) const
00058 {
00059     return value;
00060 }
00061 
00066 double QwtNullTransform::invTransform( double value ) const
00067 {
00068     return value;
00069 }
00070 
00072 QwtTransform *QwtNullTransform::copy() const
00073 {
00074     return new QwtNullTransform();
00075 }
00076 
00078 QwtLogTransform::QwtLogTransform():
00079     QwtTransform()
00080 {
00081 }
00082 
00084 QwtLogTransform::~QwtLogTransform()
00085 {
00086 }
00087 
00092 double QwtLogTransform::transform( double value ) const
00093 {
00094     return ::log( value );
00095 }
00096 
00101 double QwtLogTransform::invTransform( double value ) const
00102 {
00103     return qExp( value );
00104 }
00105 
00110 double QwtLogTransform::bounded( double value ) const
00111 {
00112     return qBound( LogMin, value, LogMax );
00113 }
00114 
00116 QwtTransform *QwtLogTransform::copy() const
00117 {
00118     return new QwtLogTransform();
00119 }
00120 
00125 QwtPowerTransform::QwtPowerTransform( double exponent ):
00126     QwtTransform(),
00127     d_exponent( exponent )
00128 {
00129 }
00130 
00132 QwtPowerTransform::~QwtPowerTransform()
00133 {
00134 }
00135 
00140 double QwtPowerTransform::transform( double value ) const
00141 {
00142     if ( value < 0.0 )
00143         return -qPow( -value, 1.0 / d_exponent );
00144     else
00145         return qPow( value, 1.0 / d_exponent );
00146     
00147 }
00148 
00153 double QwtPowerTransform::invTransform( double value ) const
00154 {
00155     if ( value < 0.0 )
00156         return -qPow( -value, d_exponent );
00157     else
00158         return qPow( value, d_exponent );
00159 }
00160 
00162 QwtTransform *QwtPowerTransform::copy() const
00163 {
00164     return new QwtPowerTransform( d_exponent );
00165 }


plotjuggler
Author(s): Davide Faconti
autogenerated on Wed Jul 3 2019 19:28:05