NetTopologySuite
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Pages
NetTopologySuite.Precision.MinimumClearance Class Reference

Computes the Minimum Clearance of a IGeometry. 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 pertubation the geometry can tolerate before becoming invalid. More...

Public Member Functions

 MinimumClearance (IGeometry geom)
 Creates an object to compute the Minimum Clearance for the given Geometry More...
 
double GetDistance ()
 Gets the Minimum Clearance distance. More...
 
ILineString GetLine ()
 Gets a LineString containing two points which are at the Minimum Clearance distance.If no distance could be found (e.g. in the case of two identical points) LINESTRING EMPTY is returned. More...
 

Static Public Member Functions

static double GetDistance (IGeometry g)
 Computes the Minimum Clearance distance for the given Geometry. More...
 
static IGeometry GetLine (IGeometry g)
 Gets a LineString containing two points which are at the Minimum Clearance distance for the given Geometry. More...
 

Detailed Description

Computes the Minimum Clearance of a IGeometry.

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 pertubation the geometry can tolerate before becoming invalid.

The concept was introduced by Thompson and Van Oosterom [TV06], based on earlier work by Milenkovic [Mi88].

The Minimum Clearance of a geometry G is defined to be the value r such that "the movement of all points by a distance of r in any direction will guarantee to leave the geometry valid" [TV06]. An equivalent constructive definition [Mi88] is that r is the largest value such:

  • No two distinct vertices of G are closer than r.
  • No vertex of G is closer than r to an edge of G of which the vertex is not an endpoint

The following image shows an example of the Minimum Clearance of a simple polygon.

If G has only a single vertex (i.e. is a IPoint), the value of the minimum clearance is double.MaxValue.

If G is a IPuntal or ILineal geometry, then in fact no amount of perturbation will render the geometry invalid. In this case a Minimum Clearance is still computed based on the vertex and segment distances according to the constructive definition.

It is possible for no Minimum Clearance to exist. For instance, a IMultiPoint with all members identical has no Minimum Clearance (i.e. no amount of perturbation will cause the member points to become non-identical). Empty geometries also have no such distance. The lack of a meaningful MinimumClearance distance is detected and suitable values are returned by GetDistance() and GetLine().

The computation of Minimum Clearance utilizes the STRtree.NearestNeighbour(NetTopologySuite.Index.Strtree.IItemDistance) method to provide good performance even for large inputs.

An interesting note is that for the case of IMultiPoints, the computed Minimum Clearance line effectively determines the Nearest Neighbours in the collection.

References

  • [Mi88] Milenkovic, V. J., Verifiable implementations of geometric algorithms using finite precision arithmetic. in Artificial Intelligence, 377-401. 1988
  • [TV06] Thompson, Rod and van Oosterom, Peter, Interchange of Spatial Data-Inhibiting Factors, Agile 2006, Visegrad, Hungary. 2006

/// <author>Martin Davis</author>

Constructor & Destructor Documentation

NetTopologySuite.Precision.MinimumClearance.MinimumClearance ( IGeometry  geom)

Creates an object to compute the Minimum Clearance for the given Geometry

Parameters
geomThe input geometry

Member Function Documentation

static double NetTopologySuite.Precision.MinimumClearance.GetDistance ( IGeometry  g)
static

Computes the Minimum Clearance distance for the given Geometry.

Parameters
gThe input geometry
Returns
The minimum clearance
double NetTopologySuite.Precision.MinimumClearance.GetDistance ( )

Gets the Minimum Clearance distance.

If no distance exists (e.g. in the case of two identical points) double.MaxValue is returned.

Returns
The value of the minimum clearance distance
or double.MaxValue if no Minimum Clearance distance exists
static IGeometry NetTopologySuite.Precision.MinimumClearance.GetLine ( IGeometry  g)
static

Gets a LineString containing two points which are at the Minimum Clearance distance for the given Geometry.

Parameters
gThe input geometry
Returns
The value of the minimum clearance distance
or LINESTRING EMPTY if no minimum clearance distance exists.
ILineString NetTopologySuite.Precision.MinimumClearance.GetLine ( )

Gets a LineString containing two points which are at the Minimum Clearance distance.If no distance could be found (e.g. in the case of two identical points) LINESTRING EMPTY is returned.

Returns
The value of the minimum clearance distance,
or LINESTRING EMPTY if no minimum clearance distance exists.

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