public Point[] GetBestPoint(Point startPoint, Point[] nextPossiblePoints, int beamWith) { var bestPoints = new DistanceAndPointIdArray(beamWith); foreach (var point in nextPossiblePoints) { var distance = point.CalculateDistanceTo(startPoint); bestPoints.InsertIfPossible(distance, point); } return(bestPoints.CreatePointArray()); }
public Point[] GetBestPoint(Point startPoint, Point[] nextPossiblePoints, int beamWith) { var bestPoints = new DistanceAndPointIdArray(beamWith); for (int i = 0; i < nextPossiblePoints.Length; i++) { var point = nextPossiblePoints[i]; var distance = point.CalculateDistanceTo(startPoint); bestPoints.InsertIfPossible(distance, point); } return(bestPoints.CreatePointArray()); }