Namespace NetTopologySuite.Precision
Provides classes for analyzing and manipulating the precision of Geometries.
Classes
CommonBits
Determines the maximum number of common most-significant bits in the mantissa of one or numbers. Can be used to compute the double-precision number which is represented by the common bits. If there are no common bits, the number computed is 0.0.
CommonBitsOp
Provides versions of Geometry spatial functions which use common bit removal to reduce the likelihood of robustness problems. In the current implementation no rounding is performed on the reshifted result point, which means that it is possible that the returned Geometry is invalid. Client classes should check the validity of the returned result themselves.
CommonBitsRemover
Removes common most-significant mantissa bits from one or more Geometrys.
The CommonBitsRemover "scavenges" precision which is "wasted" by a large displacement of the geometry from the origin. For example, if a small geometry is displaced from the origin by a large distance, the displacement increases the significant figures in the coordinates, but does not affect the relative topology of the geometry. Thus the geometry can be translated back to the origin without affecting its topology. In order to compute the translation without affecting the full precision of the coordinate values, the translation is performed at the bit level by removing the common leading mantissa bits.
If the geometry envelope already contains the origin, the translation procedure cannot be applied. In this case, the common bits value is computed as zero.
If the geometry crosses the Y axis but not the X axis (and mutatis mutandum), the common bits for Y are zero, but the common bits for X are non-zero.
CommonBitsRemover.CommonCoordinateFilter
CoordinatePrecisionReducerFilter
Reduces the precision of the Coordinates in a CoordinateSequence to match the supplied PrecisionModel.
EnhancedPrecisionOp
Provides versions of Geometry spatial functions which use enhanced precision techniques to reduce the likelihood of robustness problems.
GeometryPrecisionReducer
Reduces the precision of a Geometry according to the supplied PrecisionModel, ensuring that the result is valid (unless specified otherwise).
By default the geometry precision model is not changed. This can be overridden by using ChangePrecisionModel.
Topological Precision Reduction
The default mode of operation ensures the reduced result is topologically valid (i.e. IsValid is true). To ensure this polygonal geometry is reduced in a topologically valid fashion (technically, by using snap-rounding). Note that this may change polygonal geometry structure (e.g.two polygons separated by a distance below the specified precision will be merged into a single polygon). Duplicate vertices are removed. This mode is invoked by the static method Reduce(Geometry, PrecisionModel).
Normally, collapsed linear components(e.g.lines collapsing to a point)
are not included in the result.
This behavior can be changed
by setting RemoveCollapsedComponents to false
,
or by using the static method ReduceKeepCollapsed(Geometry, PrecisionModel).
In general input must be valid geometry, or an ArgumentException will be thrown. However if the invalidity is "mild" or very small then it may be eliminated by precision reduction.
Pointwise Precision Reduction
Alternatively, geometry can be reduced pointwise by using {@link #setPointwise(boolean)}. Linear and point geometry are always reduced pointwise(i.e.without further change to topology or structure), since this does not change validity. Invalid inputs are allowed. Duplicate vertices are preserved. Collapsed components are always included in the result. The result geometry may be invalid.This mode is invoked by the static method ReducePointwise(Geometry, PrecisionModel).
MinimumClearance
Computes the Minimum Clearance of a Geometry.
The Minimum Clearance is a measure of what magnitude of perturbation of the vertices of a geometry can be tolerated before the geometry becomes topologically invalid. The smaller the Minimum Clearance distance, the less vertex perturbation the geometry can tolerate before becoming invalid.
PrecisionReducerCoordinateOperation
SimpleMinimumClearance
Computes the minimum clearance of a geometry or set of geometries.
The Minimum Clearance is a measure of what magnitude of perturbation of its vertices can be tolerated by a geometry before it becomes topologically invalid.
This class uses an inefficient O(N^2) scan. It is primarily for testing purposes.