#include <PrecisionUtil.h>
Unions a collection of geometries in an efficient way, using OverlayNG to ensure robust computation.
- Author
- Martin Davis
Definition at line 49 of file PrecisionUtil.h.
geos::operation::overlayng::PrecisionUtil::PrecisionUtil |
( |
| ) |
|
|
inline |
static double geos::operation::overlayng::PrecisionUtil::inherentScale |
( |
double |
value | ) |
|
|
static |
Computes the inherent scale of a number. The inherent scale is the scale factor for rounding which preserves all digits of precision (significant digits) present in the numeric value. In other words, it is the scale factor which does not change the numeric value when rounded:
num = round( num, inherentScale(num) )
static double geos::operation::overlayng::PrecisionUtil::inherentScale |
( |
const Geometry * |
geom | ) |
|
|
static |
Computes the inherent scale of a geometry. The inherent scale is the scale factor for rounding which preserves all digits of precision (significant digits) present in the geometry ordinates.
This is the maximum inherent scale of all ordinate values in the geometry.
static double geos::operation::overlayng::PrecisionUtil::inherentScale |
( |
const Geometry * |
a, |
|
|
const Geometry * |
b |
|
) |
| |
|
static |
Computes the inherent scale of two geometries. The inherent scale is the scale factor for rounding which preserves all digits of precision (significant digits) present in the geometry ordinates.
This is the maximum inherent scale of all ordinate values in the geometries.
static double geos::operation::overlayng::PrecisionUtil::maxBoundMagnitude |
( |
const Envelope * |
env | ) |
|
|
staticprivate |
Determines the maximum magnitude (absolute value) of the bounds of an of an envelope. This is equal to the largest ordinate value which must be accommodated by a scale factor.
static int geos::operation::overlayng::PrecisionUtil::numberOfDecimals |
( |
double |
value | ) |
|
|
static |
Determines the number of decimal places represented in a double-precision number (as determined by Java). This uses the Java double-precision print routine to determine the number of decimal places, This is likely not optimal for performance, but should be accurate and portable.
static double geos::operation::overlayng::PrecisionUtil::precisionScale |
( |
double |
value, |
|
|
int |
precisionDigits |
|
) |
| |
|
staticprivate |
Computes the scale factor which will produce a given number of digits of precision (significant digits) when used to round the given number.
For example: to provide 5 decimal digits of precision for the number 123.456 the precision scale factor is 100; for 3 digits of precision the scale factor is 1; for 2 digits of precision the scale factor is 0.1.
Rounding to the scale factor can be performed with PrecisionModel#round
- See also
- PrecisionModel.round
Determines a precision model to use for robust overlay operations. The precision scale factor is chosen to maximize output precision while avoiding round-off issues.
NOTE: this is a heuristic determination, so is not guaranteed to eliminate precision issues.
WARNING: this is quite slow.
Determines a precision model to use for robust overlay operations for one geometry. The precision scale factor is chosen to maximize output precision while avoiding round-off issues.
NOTE: this is a heuristic determination, so is not guaranteed to eliminate precision issues.
WARNING: this is quite slow.
static double geos::operation::overlayng::PrecisionUtil::robustScale |
( |
double |
inherentScale, |
|
|
double |
safeScale |
|
) |
| |
|
staticprivate |
static double geos::operation::overlayng::PrecisionUtil::robustScale |
( |
const Geometry * |
a, |
|
|
const Geometry * |
b |
|
) |
| |
|
static |
Determines a scale factor which maximizes the digits of precision and is safe to use for overlay operations. The robust scale is the minimum of the inherent scale and the safe scale factors.
static double geos::operation::overlayng::PrecisionUtil::robustScale |
( |
const Geometry * |
a | ) |
|
|
static |
Determines a scale factor which maximizes the digits of precision and is safe to use for overlay operations. The robust scale is the minimum of the inherent scale and the safe scale factors.
static double geos::operation::overlayng::PrecisionUtil::safeScale |
( |
double |
value | ) |
|
|
static |
Computes a safe scale factor for a numeric value. A safe scale factor ensures that rounded number has no more than MAX_PRECISION_DIGITS digits of precision.
static double geos::operation::overlayng::PrecisionUtil::safeScale |
( |
const Geometry * |
geom | ) |
|
|
static |
Computes a safe scale factor for a geometry. A safe scale factor ensures that the rounded ordinates have no more than MAX_PRECISION_DIGITS digits of precision.
static double geos::operation::overlayng::PrecisionUtil::safeScale |
( |
const Geometry * |
a, |
|
|
const Geometry * |
b |
|
) |
| |
|
static |
Computes a safe scale factor for two geometries. A safe scale factor ensures that the rounded ordinates have no more than MAX_PRECISION_DIGITS digits of precision.
constexpr int geos::operation::overlayng::PrecisionUtil::MAX_ROBUST_DP_DIGITS = 14 |
|
static |
The documentation for this class was generated from the following file: