Class TravelingCosts<TItem, TDistance>
Implementation of distance calculation from an arbitrary point to the given destination.
Inheritance
System.Object
TravelingCosts<TItem, TDistance>
Implements
System.Collections.Generic.IComparer<TItem>
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Mars.Common.Collections.KNNGraph
Assembly: Mars.Common.dll
Syntax
public class TravelingCosts<TItem, TDistance> : IComparer<TItem>
Type Parameters
Name | Description |
---|---|
TItem | Type of the points. |
TDistance | Type of the distance. |
Constructors
| Improve this Doc View SourceTravelingCosts(Func<TItem, TItem, TDistance>, TItem)
Implementation of distance calculation from an arbitrary point to the given destination.
Declaration
public TravelingCosts(Func<TItem, TItem, TDistance> distance, TItem destination)
Parameters
Type | Name | Description |
---|---|---|
System.Func<TItem, TItem, TDistance> | distance | |
TItem | destination |
Properties
| Improve this Doc View SourceDestination
Implementation of distance calculation from an arbitrary point to the given destination.
Declaration
public TItem Destination { get; }
Property Value
Type | Description |
---|---|
TItem |
Methods
| Improve this Doc View SourceCompare(TItem, TItem)
Compares 2 points by the distance from the destination.
Declaration
public int Compare(TItem x, TItem y)
Parameters
Type | Name | Description |
---|---|---|
TItem | x | Left point. |
TItem | y | Right point. |
Returns
Type | Description |
---|---|
System.Int32 | -1 if x is closer to the destination than y; 0 if x and y are equally far from the destination; 1 if x is farther from the destination than y. |
From(TItem)
Implementation of distance calculation from an arbitrary point to the given destination.
Declaration
public TDistance From(TItem departure)
Parameters
Type | Name | Description |
---|---|---|
TItem | departure |
Returns
Type | Description |
---|---|
TDistance |
Implements
System.Collections.Generic.IComparer<T>