|
QGIS API Documentation 4.3.0-Master (90cb4ecf9ef)
|
Contains utility functions for mathematical operations. More...
#include <qgsmathutils.h>
Static Public Member Functions | |
| 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. | |
Contains utility functions for mathematical operations.
Definition at line 30 of file qgsmathutils.h.
|
static |
Converts a double value to a rational fraction.
| value | value to convert |
| numerator | calculated numerator |
| denominator | calculated denominator |
| tolerance | desired precision. The returned fraction will be at within this tolerance of the original value. |
| maxIterations | maximum number of iterations. Higher values result in better approximations, but at the cost of additional computation. |
Definition at line 25 of file qgsmathutils.cpp.
|
static |
Expands a range outward to round values, e.g.
a range of 1234.5 - 3456.7 is expanded to 1200 - 3500.
The bounds are rounded to a tenth of the order of magnitude of the range's size, so that the returned range stays close to the original one.
Infinite and empty ranges are returned unchanged.
Definition at line 100 of file qgsmathutils.cpp.
|
static |
Returns a round interval, a power of ten, which splits the given span into at least divisions parts.
E.g. a span of 2222 returns 100 for 10 divisions and 10 for 100 divisions.
Returns 0 if span is not finite or is not greater than 0, or if divisions is lower than 1.
Definition at line 92 of file qgsmathutils.cpp.