QGIS API Documentation 4.3.0-Master (90cb4ecf9ef)
Loading...
Searching...
No Matches
qgsmathutils.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsmathutils.h
3 ----------------------
4 begin : July 2025
5 copyright : (C) 2025 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#include "qgis_core.h"
17#include "qgis_sip.h"
18#include "qgsrange.h"
19
20#include <QObject>
21
22#ifndef QGSMATHUTILS_H
23#define QGSMATHUTILS_H
24
30class CORE_EXPORT QgsMathUtils
31{
32 Q_GADGET
33
34 public:
44 Q_INVOKABLE static void doubleToRational( double value, qlonglong &numerator SIP_OUT, qlonglong &denominator SIP_OUT, double tolerance = 1.0e-9, int maxIterations = 100 );
45
54 static double roundingInterval( double span, int divisions = 10 );
55
67 static QgsDoubleRange roundedRange( const QgsDoubleRange &range );
68};
69
70#endif // QGSMATHUTILS_H
QgsRange which stores a range of double values.
Definition qgsrange.h:217
Contains utility functions for mathematical operations.
static Q_INVOKABLE void doubleToRational(double value, qlonglong &numerator, qlonglong &denominator, double tolerance=1.0e-9, int maxIterations=100)
Converts a double value to a rational fraction.
static QgsDoubleRange roundedRange(const QgsDoubleRange &range)
Expands a range outward to round values, e.g.
static double roundingInterval(double span, int divisions=10)
Returns a round interval, a power of ten, which splits the given span into at least divisions parts.
#define SIP_OUT
Definition qgis_sip.h:57