geos::operation::overlayng::PrecisionUtil Class Reference

`#include <PrecisionUtil.h>`

## Classes

class | InherentScaleFilter

## Static Public Member Functions

static PrecisionModel | robustPM (const Geometry *a, const Geometry *b)
static PrecisionModel | robustPM (const Geometry *a)
static double | robustScale (const Geometry *a, const Geometry *b)
static double | robustScale (const Geometry *a)
static double | safeScale (double value)
static double | safeScale (const Geometry *geom)
static double | safeScale (const Geometry *a, const Geometry *b)
static double | inherentScale (double value)
static double | inherentScale (const Geometry *geom)
static double | inherentScale (const Geometry *a, const Geometry *b)
static int | numberOfDecimals (double value)

## Static Public Attributes

static constexpr int | MAX_ROBUST_DP_DIGITS = 14

## Detailed Description

Unions a collection of geometries in an efficient way, using `OverlayNG` to ensure robust computation.

Author
  Martin Davis

## Member Function Documentation

## inherentScale() [1/3]

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.

## inherentScale() [2/3]

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.

## inherentScale() [3/3]

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) )

## numberOfDecimals()

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.

## robustPM() [1/2]

PrecisionModel geos::operation::overlayng::PrecisionUtil::robustPM | ( | const Geometry * | a | ) |

static

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.

## robustPM() [2/2]

PrecisionModel geos::operation::overlayng::PrecisionUtil::robustPM | ( | const Geometry * | a,
|  | const Geometry * | b )

static

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.

## robustScale() [1/2]

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.

## robustScale() [2/2]

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.

## safeScale() [1/3]

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.

## safeScale() [2/3]

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.

## safeScale() [3/3]

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.

The documentation for this class was generated from the following file:

- PrecisionUtil.h