Qwt User's Guide 6.3.0
Loading...
Searching...
No Matches
qwt_transform.cpp
1/******************************************************************************
2 * Qwt Widget Library
3 * Copyright (C) 1997 Josef Wilgen
4 * Copyright (C) 2002 Uwe Rathmann
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the Qwt License, Version 1.0
8 *****************************************************************************/
9
10#include "qwt_transform.h"
11#include "qwt_math.h"
12
14const double QwtLogTransform::LogMin = 1.0e-150;
15
17const double QwtLogTransform::LogMax = 1.0e150;
18
23
28
33double QwtTransform::bounded( double value ) const
34{
35 return value;
36}
37
43
48
53double QwtNullTransform::transform( double value ) const
54{
55 return value;
56}
57
62double QwtNullTransform::invTransform( double value ) const
63{
64 return value;
65}
66
69{
70 return new QwtNullTransform();
71}
72
78
83
88double QwtLogTransform::transform( double value ) const
89{
90 return std::log( value );
91}
92
97double QwtLogTransform::invTransform( double value ) const
98{
99 return std::exp( value );
100}
101
106double QwtLogTransform::bounded( double value ) const
107{
108 return qBound( LogMin, value, LogMax );
109}
110
113{
114 return new QwtLogTransform();
115}
116
122 QwtTransform(),
123 m_exponent( exponent )
124{
125}
126
131
136double QwtPowerTransform::transform( double value ) const
137{
138 if ( value < 0.0 )
139 return -std::pow( -value, 1.0 / m_exponent );
140 else
141 return std::pow( value, 1.0 / m_exponent );
142
143}
144
149double QwtPowerTransform::invTransform( double value ) const
150{
151 if ( value < 0.0 )
152 return -std::pow( -value, m_exponent );
153 else
154 return std::pow( value, m_exponent );
155}
156
159{
160 return new QwtPowerTransform( m_exponent );
161}
static const double LogMax
Largest allowed value for logarithmic scales: 1.0e150.
static const double LogMin
Smallest allowed value for logarithmic scales: 1.0e-150.
virtual ~QwtLogTransform()
Destructor.
virtual double invTransform(double value) const override
virtual QwtTransform * copy() const override
virtual double transform(double value) const override
QwtLogTransform()
Constructor.
virtual double bounded(double value) const override
QwtNullTransform()
Constructor.
virtual double invTransform(double value) const override
virtual ~QwtNullTransform()
Destructor.
virtual double transform(double value) const override
virtual QwtTransform * copy() const override
virtual double invTransform(double value) const override
virtual ~QwtPowerTransform()
Destructor.
virtual QwtTransform * copy() const override
virtual double transform(double value) const override
QwtPowerTransform(double exponent)
A transformation between coordinate systems.
QwtTransform()
Constructor.
virtual ~QwtTransform()
Destructor.
virtual double bounded(double value) const