Main Page | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members | Related Pages

qwt_math.h File Reference

A set of mathematical routines. More...

#include <math.h>
#include <qpoint.h>
#include "qwt_global.h"

Go to the source code of this file.

Defines

#define LOG10_2   0.30102999566398119802
#define LOG10_3   0.47712125471966243540
#define LOG10_5   0.69897000433601885749
#define M_2PI   6.28318530717958623200
#define LOG_MIN   1.0e-100
#define LOG_MAX   1.0e100
#define M_E   2.7182818284590452354
#define M_LOG2E   1.4426950408889634074
#define M_LN2   0.69314718055994530942
#define M_LN10   2.30258509299404568402
#define M_PI   3.14159265358979323846
#define M_PI_2   1.57079632679489661923
#define M_PI_4   0.78539816339744830962
#define M_1_PI   0.31830988618379067154
#define M_2_PI   0.63661977236758134308
#define M_2_SQRTPI   1.12837916709551257390
#define M_SQRT2   1.41421356237309504880
#define M_SQRT1_2   0.70710678118654752440
#define qwtMax   QMAX
#define qwtMin   QMIN
#define qwtAbs   QABS
#define qwtInt   qRound

Functions

QWT_EXPORT double qwtCeil125 (double x)
QWT_EXPORT double qwtFloor125 (double x)
QWT_EXPORT double qwtGetMin (double *array, int size)
QWT_EXPORT double qwtGetMax (double *array, int size)
QWT_EXPORT void qwtTwistArray (double *array, int size)
QWT_EXPORT int qwtChkMono (double *array, int size)
QWT_EXPORT void qwtLinSpace (double *array, int size, double xmin, double xmax)
QWT_EXPORT void qwtLogSpace (double *array, int size, double xmin, double xmax)
template<class T> int qwtSign (const T &x)
template<class T> T qwtSqr (const T &x)
template<class T> void qwtCopyArray (T *dest, T *src, int n)
template<class T> void qwtShiftArray (T *arr, int size, int di)
template<class T> void qwtSwap (T &x1, T &x2)
template<class T> void qwtSort (const T &x1, const T &x2, T &xmin, T &xmax)
template<class T> void qwtSort (T &x1, T &x2)
template<class T> T qwtLim (const T &x, const T &x1, const T &x2)
QPoint qwtPolar2Pos (const QPoint &center, double radius, double angle)
QPoint qwtDegree2Pos (const QPoint &center, double radius, double angle)


Detailed Description

A set of mathematical routines.

Definition in file qwt_math.h.


Define Documentation

#define LOG10_2   0.30102999566398119802
 

Definition at line 24 of file qwt_math.h.

Referenced by QwtAutoScale::buildLogScale().

#define LOG10_3   0.47712125471966243540
 

Definition at line 28 of file qwt_math.h.

Referenced by QwtAutoScale::buildLogScale().

#define LOG10_5   0.69897000433601885749
 

Definition at line 32 of file qwt_math.h.

Referenced by QwtAutoScale::buildLogScale().

#define LOG_MAX   1.0e100
 

Definition at line 44 of file qwt_math.h.

Referenced by QwtScaleDiv::buildLogDiv(), QwtAutoScale::setRange(), and QwtAutoScale::setReference().

#define LOG_MIN   1.0e-100
 

Definition at line 40 of file qwt_math.h.

Referenced by QwtScaleDiv::buildLogDiv(), QwtAutoScale::setRange(), and QwtAutoScale::setReference().

#define M_1_PI   0.31830988618379067154
 

Definition at line 80 of file qwt_math.h.

#define M_2_PI   0.63661977236758134308
 

Definition at line 84 of file qwt_math.h.

#define M_2_SQRTPI   1.12837916709551257390
 

Definition at line 88 of file qwt_math.h.

#define M_2PI   6.28318530717958623200
 

Definition at line 36 of file qwt_math.h.

#define M_E   2.7182818284590452354
 

Definition at line 48 of file qwt_math.h.

#define M_LN10   2.30258509299404568402
 

Definition at line 64 of file qwt_math.h.

#define M_LN2   0.69314718055994530942
 

Definition at line 60 of file qwt_math.h.

#define M_LOG2E   1.4426950408889634074
 

Definition at line 52 of file qwt_math.h.

#define M_PI   3.14159265358979323846
 

Definition at line 68 of file qwt_math.h.

Referenced by QwtKnob::drawMarker(), QwtCompassNeedle3::drawNeedle(), QwtSimpleCompassRose::drawRose(), QwtScaleDraw::drawTick(), QwtWheel::drawWheel(), QwtKnob::getScrollMode(), QwtKnob::getValue(), QwtScaleDraw::labelPlacement(), line2Radians(), QwtScaleDraw::minLabelDist(), and qwtDegree2Pos().

#define M_PI_2   1.57079632679489661923
 

Definition at line 72 of file qwt_math.h.

Referenced by QwtCompassNeedle3::drawNeedle(), QwtSimpleCompassRose::drawRose(), and line2Radians().

#define M_PI_4   0.78539816339744830962
 

Definition at line 76 of file qwt_math.h.

#define M_SQRT1_2   0.70710678118654752440
 

Definition at line 96 of file qwt_math.h.

#define M_SQRT2   1.41421356237309504880
 

Definition at line 92 of file qwt_math.h.

#define qwtAbs   QABS
 

Definition at line 111 of file qwt_math.h.

Referenced by QwtScaleDiv::buildLinDiv(), QwtAutoScale::buildLinScale(), QwtScaleDiv::buildLogDiv(), QwtAutoScale::buildLogScale(), QwtScaleDraw::draw(), QwtWheel::drawWheel(), QwtWheel::drawWheelBackground(), QwtScaleDraw::labelPlacement(), QwtScaleDraw::maxLabelHeight(), QwtScaleDraw::maxLabelWidth(), qwtLimRange(), qwtShiftArray(), QwtDblRange::setNewValue(), QwtDblRange::setRange(), and QwtDblRange::step().

#define qwtInt   qRound
 

Definition at line 112 of file qwt_math.h.

Referenced by cutPoint(), QwtScaleDraw::drawTick(), QwtPainter::invScale(), QwtScaleDraw::labelPlacement(), QwtPlot::print(), and QwtPainter::scale().

#define qwtMax   QMAX
 

Definition at line 109 of file qwt_math.h.

Referenced by QwtAutoScale::adjust(), QwtScaleDiv::buildLinDiv(), QwtAutoScale::buildLinScale(), QwtScaleDiv::buildLogDiv(), QwtAutoScale::buildLogScale(), QwtDiMap::contains(), QwtMarker::draw(), QwtScaleDraw::drawBackbone(), QwtKnob::drawMarker(), QwtCurve::drawSpline(), QwtDiMap::limTransform(), QwtScale::minimumSizeHint(), QwtSliderBase::mousePressEvent(), qwtGetMax(), qwtLim(), qwtLimRange(), QwtScaleDiv::rebuild(), QwtScaleDraw::setAngleRange(), QwtScale::setBaselineDist(), QwtKnob::setBorderWidth(), QwtWheel::setInternalBorder(), QwtKnob::setKnobWidth(), QwtAutoScale::setMargins(), QwtAutoScale::setMaxMajor(), QwtAutoScale::setMaxMinor(), QwtDblRange::setNewValue(), QwtAutoScale::setRange(), and QwtCurve::setSplineSize().

#define qwtMin   QMIN
 

Definition at line 110 of file qwt_math.h.

Referenced by QwtAutoScale::adjust(), QwtScaleDiv::buildLinDiv(), QwtScaleDiv::buildLogDiv(), QwtDiMap::contains(), QwtCurve::dataSize(), QwtScaleDraw::drawBackbone(), QwtKnob::layoutKnob(), QwtDiMap::limTransform(), QwtPlot::print(), qwtGetMin(), qwtLim(), qwtLimRange(), QwtScaleDiv::rebuild(), QwtScaleDraw::setAngleRange(), QwtThermo::setBorderWidth(), QwtWheel::setInternalBorder(), QwtAutoScale::setMaxMajor(), QwtAutoScale::setMaxMinor(), QwtDblRange::setNewValue(), QwtAutoScale::setRange(), and QwtAutoScale::setReference().


Function Documentation

QWT_EXPORT double qwtCeil125 double  x  ) 
 

Find the smallest value out of {1,2,5}*10^n with an integer number n which is greater than or equal to x.

Parameters:
x Input value

Definition at line 56 of file qwt_math.cpp.

Referenced by QwtScaleDiv::buildLinDiv(), QwtAutoScale::buildLinScale(), and QwtScaleDiv::buildLogDiv().

QWT_EXPORT int qwtChkMono double *  array,
int  size
 

Checks if an array is a strictly monotonic sequence.

Parameters:
array Pointer to an array
size Size of the array
Returns:
0
sequence is not strictly monotonic
1
sequence is strictly monotonically increasing
-1
sequence is strictly monotonically decreasing

Definition at line 119 of file qwt_math.cpp.

References qwtSign().

Referenced by QwtCurve::drawSpline().

template<class T>
void qwtCopyArray T *  dest,
T *  src,
int  n
 

Copy an array into another.

Parameters:
dest Destination
src Source
n Number of elements

Definition at line 140 of file qwt_math.h.

Referenced by qwtShiftArray().

QPoint qwtDegree2Pos const QPoint &  center,
double  radius,
double  angle
[inline]
 

Definition at line 270 of file qwt_math.h.

References M_PI, and qwtPolar2Pos().

Referenced by QwtCompassLineNeedle::drawNeedle(), QwtCompassNeedle2::drawNeedle(), QwtCompassNeedle1::drawNeedle(), QwtCompassMagnetNeedle::drawNeedle(), and QwtCompassNeedle4::drawPointer().

QWT_EXPORT double qwtFloor125 double  x  ) 
 

Find the largest value out of {1,2,5}*10^n with an integer number n which is smaller than or equal to x.

Parameters:
x Input value

Definition at line 85 of file qwt_math.cpp.

QWT_EXPORT double qwtGetMax double *  array,
int  size
 

Find the largest value in an array.

Parameters:
array Pointer to an array
size Array size

Definition at line 37 of file qwt_math.cpp.

References qwtMax.

Referenced by QwtCurve::drawSpline().

QWT_EXPORT double qwtGetMin double *  array,
int  size
 

Find the smallest value in an array.

Parameters:
array Pointer to an array
size Array size

Definition at line 19 of file qwt_math.cpp.

References qwtMin.

Referenced by QwtCurve::drawSpline().

template<class T>
T qwtLim const T &  x,
const T &  x1,
const T &  x2
 

Limit a value to fit into a specified interval.

Parameters:
x Input value
x1 First interval boundary
x2 Second interval boundary

Definition at line 243 of file qwt_math.h.

References qwtMax, and qwtMin.

Referenced by QwtArrowButton::QwtArrowButton(), QwtScaleDraw::setAngleRange(), QwtDblRange::setRange(), QwtWheel::setTickCnt(), QwtWheel::setTotalAngle(), QwtWheel::setViewAngle(), and QwtCurve::verifyRange().

QWT_EXPORT void qwtLinSpace double *  array,
int  size,
double  xmin,
double  xmax
 

Create an array of equally spaced values.

Parameters:
array Where to put the values
size Size of the array
xmin Value associated with index 0
xmax Value associated with index (size-1)

Definition at line 161 of file qwt_math.cpp.

Referenced by QwtScaleDiv::buildLinDiv().

QWT_EXPORT void qwtLogSpace double *  array,
int  size,
double  xmin,
double  xmax
 

Create an array of logarithmically equally spaced values.

Parameters:
array Where to put the values
size Size of the array
xmin Value associated with index 0
xmax Value associated with index (size-1)

Definition at line 189 of file qwt_math.cpp.

Referenced by QwtScaleDiv::buildLogDiv().

QPoint qwtPolar2Pos const QPoint &  center,
double  radius,
double  angle
[inline]
 

Definition at line 261 of file qwt_math.h.

Referenced by QwtCompassNeedle3::drawNeedle(), QwtSimpleCompassRose::drawRose(), and qwtDegree2Pos().

template<class T>
void qwtShiftArray T *  arr,
int  size,
int  di
 

Shift an array by a specified number of positions.

Parameters:
arr Pointer to an array
size Number of elements
di Number of positions. A positive number shifts right, a negative number shifts left.

Definition at line 155 of file qwt_math.h.

References qwtAbs, and qwtCopyArray().

template<class T>
int qwtSign const T &  x  )  [inline]
 

Return the sign.

Definition at line 116 of file qwt_math.h.

Referenced by qwtChkMono().

template<class T>
void qwtSort T &  x1,
T &  x2
 

Sort two values in ascending order.

Definition at line 224 of file qwt_math.h.

Referenced by QwtCurve::verifyRange().

template<class T>
void qwtSort const T &  x1,
const T &  x2,
T &  xmin,
T &  xmax
 

Sort two values in ascending order.

Parameters:
x1 First input value
x2 Second input value
xmax Greater value
xmin Smaller value

Definition at line 205 of file qwt_math.h.

template<class T>
T qwtSqr const T &  x  )  [inline]
 

Return the square of a number.

Definition at line 128 of file qwt_math.h.

Referenced by QwtSpline::buildPerSpline(), QwtPlot::closestCurve(), QwtPlot::closestMarker(), and QwtCurve::drawSpline().

template<class T>
void qwtSwap T &  x1,
T &  x2
 

Swap two values.

Definition at line 188 of file qwt_math.h.

QWT_EXPORT void qwtTwistArray double *  array,
int  size
 

Invert the order of array elements.

Parameters:
array Pointer to an array
size Size of the array

Definition at line 141 of file qwt_math.cpp.

Referenced by QwtCurve::drawSpline(), and QwtScaleDiv::rebuild().


Generated on Fri Nov 7 14:11:46 2003 for Qwt Developer's Guide by doxygen 1.3.2