Table of Contents

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

rootPosition IPositionable

The root position to compare other objects to.

inverse bool

false to sort from closest to furthest, true to 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

x IPositionable

The first object to compare.

y IPositionable

The second object to compare.

Returns

int

A signed integer that indicates the relative values of x and y, as shown in the following table.Value Meaning Less than zero x is less than y.Zero x equals y.Greater than zero x is greater than y.

Exceptions

ArgumentException

Type T does not implement either the IComparable<T> generic interface or the IComparable interface.