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 
17 double qwtGetMin( const double *array, int size )
18 {
19  if ( size <= 0 )
20  return 0.0;
21 
22  double rv = array[0];
23  for ( int i = 1; i < size; i++ )
24  rv = qMin( rv, array[i] );
25 
26  return rv;
27 }
28 
29 
35 double qwtGetMax( const double *array, int size )
36 {
37  if ( size <= 0 )
38  return 0.0;
39 
40  double rv = array[0];
41  for ( int i = 1; i < size; i++ )
42  rv = qMax( rv, array[i] );
43 
44  return rv;
45 }
46 
52 double qwtNormalizeRadians( double radians )
53 {
54  double a = ::fmod( radians, 2.0 * M_PI );
55  if ( a < 0.0 )
56  a += 2.0 * M_PI;
57 
58  return a;
59 
60 }
61 
67 double qwtNormalizeDegrees( double degrees )
68 {
69  double a = ::fmod( degrees, 360.0 );
70  if ( a < 0.0 )
71  a += 360.0;
72 
73  return a;
74 }
double qwtNormalizeRadians(double radians)
Normalize an angle to be int the range [0.0, 2 * PI[.
Definition: qwt_math.cpp:52
double qwtGetMin(const double *array, int size)
Find the smallest value in an array.
Definition: qwt_math.cpp:17
double qwtGetMax(const double *array, int size)
Find the largest value in an array.
Definition: qwt_math.cpp:35
int i
double qwtNormalizeDegrees(double degrees)
Normalize an angle to be int the range [0.0, 360.0[.
Definition: qwt_math.cpp:67
int a


plotjuggler
Author(s): Davide Faconti
autogenerated on Sat Jul 6 2019 03:44:17