Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var points = new List<Point>();
- Point source = ...
- ....
- var closestPoints = points.Where(point => point != source).
- OrderBy(point => NotReallyDistanceButShouldDo(source, point)).
- Take(20);
- private double NotReallyDistanceButShouldDo(Point source, Point target)
- {
- return Math.Pow(target.X - source.X, 2) + Math.Pow(target.Y - source.Y, 2);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement