Interface IItemDistance<T, TItem>
A function method which computes the distance between two IBoundable<T, TItem>s in an STRtree<TItem>. Used for Nearest Neighbour searches.
To make a distance function suitable for querying a single index tree via NearestNeighbour(IItemDistance<Envelope, TItem>), the function should have a non-zero reflexive distance. That is, if the two arguments are the same object, the distance returned should be non-zero. If it is required that only pairs of distinct items be returned, the distance function must be anti-reflexive, and must return MaxValue for identical arguments.
Namespace: NetTopologySuite.Index.Strtree
Assembly: NetTopologySuite.dll
Syntax
public interface IItemDistance<T, TItem>
where T : IIntersectable<T>, IExpandable<T>
Type Parameters
Name | Description |
---|---|
T | |
TItem |
Methods
| Improve this Doc View SourceDistance(IBoundable<T, TItem>, IBoundable<T, TItem>)
Computes the distance between two items.
Declaration
double Distance(IBoundable<T, TItem> item1, IBoundable<T, TItem> item2)
Parameters
Type | Name | Description |
---|---|---|
IBoundable<T, TItem> | item1 | The first item. |
IBoundable<T, TItem> | item2 | The second item. |
Returns
Type | Description |
---|---|
Double | The distance between |
Exceptions
Type | Condition |
---|---|
ArgumentException | If the metric is not applicable to the arguments |