Well , what can I say sorry for misunderstanding
I already started writing the code , but I have one little glitch and I post it here if someone is able to help me.
So I am trying to sort with my custom function List<Point>:
and then I just use this in order to sort:Code:public class PointSort : IComparer { public enum Mode { sinus, cos } Mode currentMode = Mode.sinus; public PointSort(Mode mode) { currentMode = mode; } int IComparer.Compare(object a, object b) { Point one = (Point)a; Point two = (Point)b; if ((one.x - sx) / (Math.Sqrt(Math.Pow(one.x - sx, 2) + Math.Pow(one.y - sy, 2))) > (two.x - sx) / (Math.Sqrt(Math.Pow(two.x - sx, 2) + Math.Pow(two.y - sy, 2)))) { return 1; } else { return 0; } } }
and the error is:Code:Array.Sort(masiv, new PointSort(PointSort.Mode.sinus));
Where masiv is List<Point> and here my struct for Point:
Code:public struct Point { public int x, y; public Point(int p1, int p2) { x = p1; y = p2; } }






Reply With Quote