Loading...
Searching...
No Matches
qwt_math.cpp
/******************************************************************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#include "qwt_math.h"
#if QT_VERSION >= 0x050a00
#include <qrandom.h>
#endif
double qwtNormalizeRadians( double radians )
{
double a = std::fmod( radians, 2.0 * M_PI );
if ( a < 0.0 )
a += 2.0 * M_PI;
return a;
}
double qwtNormalizeDegrees( double degrees )
{
double a = std::fmod( degrees, 360.0 );
if ( a < 0.0 )
a += 360.0;
return a;
}
quint32 qwtRand()
{
#if QT_VERSION >= 0x050a00
return QRandomGenerator::global()->generate();
#else
return static_cast< quint32 >( qrand() ); // [0, RAND_MAX ]
#endif
}