Class DistanceComparer
- Namespace
- OmegaEngine
- Assembly
- OmegaEngine.dll
Compares the distances of objects to fixed root position.
public class DistanceComparer : Comparer<IPositionable>, IComparer, IComparer<IPositionable>
- Inheritance
-
DistanceComparer
- Implements
- Inherited Members
- Extension Methods
Constructors
DistanceComparer(IPositionable, bool)
Compares the distances of objects to fixed root position.
public DistanceComparer(IPositionable rootPosition, bool inverse = false)
Parameters
rootPositionIPositionableThe root position to compare other objects to.
inverseboolfalseto sort from closest to furthest,trueto sort from furthest to closest.
Methods
Compare(IPositionable, IPositionable)
When overridden in a derived class, performs a comparison of two objects of the same type and returns a value indicating whether one object is less than, equal to, or greater than the other.
public override int Compare(IPositionable x, IPositionable y)
Parameters
xIPositionableThe first object to compare.
yIPositionableThe second object to compare.
Returns
- int
A signed integer that indicates the relative values of
xandy, as shown in the following table.Value Meaning Less than zeroxis less thany.Zeroxequalsy.Greater than zeroxis greater thany.
Exceptions
- ArgumentException
Type
Tdoes not implement either the IComparable<T> generic interface or the IComparable interface.