qwt_math.cpp
Go to the documentation of this file.
1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
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_math.h"
11 #if QT_VERSION >= 0x050a00
12 #include <qrandom.h>
13 #endif
14 
20 double qwtNormalizeRadians( double radians )
21 {
22  double a = std::fmod( radians, 2.0 * M_PI );
23  if ( a < 0.0 )
24  a += 2.0 * M_PI;
25 
26  return a;
27 
28 }
29 
35 double qwtNormalizeDegrees( double degrees )
36 {
37  double a = std::fmod( degrees, 360.0 );
38  if ( a < 0.0 )
39  a += 360.0;
40 
41  return a;
42 }
43 
48 quint32 qwtRand()
49 {
50 #if QT_VERSION >= 0x050a00
51  return QRandomGenerator::global()->generate();
52 #else
53  return static_cast< quint32 >( qrand() ); // [0, RAND_MAX ]
54 #endif
55 }
double qwtNormalizeRadians(double radians)
Normalize an angle to be int the range [0.0, 2 * PI[.
Definition: qwt_math.cpp:20
quint32 qwtRand()
Uses QRandomGenerator for Qt >= 5.10 and qRand() otherwise.
Definition: qwt_math.cpp:48
#define M_PI
Definition: qwt_math.h:56
double qwtNormalizeDegrees(double degrees)
Normalize an angle to be int the range [0.0, 360.0[.
Definition: qwt_math.cpp:35


plotjuggler
Author(s): Davide Faconti
autogenerated on Sun Dec 6 2020 03:48:10