qwt_math.cpp
Go to the documentation of this file.
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_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 }
qwt_math.h
qwtNormalizeDegrees
double qwtNormalizeDegrees(double degrees)
Normalize an angle to be int the range [0.0, 360.0[.
Definition: qwt_math.cpp:35
M_PI
#define M_PI
Definition: qwt_math.h:56
qwtNormalizeRadians
double qwtNormalizeRadians(double radians)
Normalize an angle to be int the range [0.0, 2 * PI[.
Definition: qwt_math.cpp:20
qwtRand
quint32 qwtRand()
Uses QRandomGenerator for Qt >= 5.10 and qRand() otherwise.
Definition: qwt_math.cpp:48


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:45