Interface IItemDistance<T, TItem>
- Namespace
- NetTopologySuite.Index.Strtree
- Assembly
- NetTopologySuite.dll
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.public interface IItemDistance<T, TItem> where T : IIntersectable<T>, IExpandable<T>
Type Parameters
T
TItem
Methods
Distance(IBoundable<T, TItem>, IBoundable<T, TItem>)
Computes the distance between two items.
double Distance(IBoundable<T, TItem> item1, IBoundable<T, TItem> item2)
Parameters
item1
IBoundable<T, TItem>The first item.
item2
IBoundable<T, TItem>The second item.
Returns
- double
The distance between
item1
anditem2
.
Exceptions
- ArgumentException
If the metric is not applicable to the arguments