Class PointComparer
Provides a default comparer for Vector2 objects.
Inherited Members
Namespace: OpenSvg
Assembly: OpenSvg.dll
Syntax
public class PointComparer : IComparer<Vector2>
Properties
| Edit this page View SourceDefault
Returns a default PointComparer.
Declaration
public static PointComparer Default { get; }
Property Value
Type | Description |
---|---|
PointComparer |
Methods
| Edit this page View SourceCompare(Vector2, Vector2)
Compares two points using Default CompareTo. Ordering is similar to how text is read in an English document: left to right, then top to bottom
Declaration
public int Compare(Vector2 p1, Vector2 p2)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | p1 | The first point to compare. |
Vector2 | p2 | The second point to compare. |
Returns
Type | Description |
---|---|
int |
Examples
The following example demonstrates the use of the default PointComparer method for sorting points.
Point[] points = new Point[] { new Point(0, 10), new Point(20, 5) };
Array.Sort(points, PointComparer.Default);
Console.WriteLine(String.Join(", ", points));
// Output: (20, 5), (0, 10)