public PathClusterFinderWithListTests() { _numberOfCoordinates = 1000; _pointPerCluster = 500; _arrayOfCoordinates = KdTreeHelper.GenerateCoordinates(_numberOfCoordinates).ToArray(); _listOfCoordinates = _arrayOfCoordinates.ToList(); }
public KdTreeTests() { _numberOfCoordinates = 10000; _pointPerCluster = 500; _coordinatesAsDoubleArray = KdTreeHelper.GenerateDoubles(_numberOfCoordinates, range: 10000); _arrayOfCoordinates = KdTreeHelper.GenerateCoordinatesFromArray(_coordinatesAsDoubleArray).ToArray(); _listOfCoordinates = _arrayOfCoordinates.ToList(); }
public void SquareOfDistanceWorksCorrectlyInBothVersionOfKdTree() { var minPoint = new Coordinate { Latitude = 6544, Longitude = 5577 }; var maxPoint = new Coordinate { Latitude = 9687, Longitude = 1254 }; var minPointA = new[] { minPoint.Latitude, minPoint.Longitude }; var maxPointA = new[] { maxPoint.Latitude, maxPoint.Longitude }; var coordinateDistance = KdTreeHelper.L2Norm_Squared_Coordinate(minPoint, maxPoint); var doubleArrayDistance = KdTreeHelper.L2Norm_Squared_Double(minPointA, maxPointA); coordinateDistance.Should().Be(doubleArrayDistance); }
public List <PathGrid> GetListOfPathGridForRefreshGrid(int pointPerCluster, List <PathGrid> gridData) { return(gridData.Select((p, index) => new PathGrid { RowNumber = ++index, PathName = $"مسیر شماره - {index}", TemporaryId = Guid.NewGuid(), Checked = p.Checked, ToziZamaniPishfarz = p.ToziZamaniPishfarz, BazeZamaniTour = p.BazeZamaniTour, PointClusterCoordinates = p.PointClusterCoordinates, PointsPerCluster = p.PointClusterCoordinates.Count, GradeAvaliyeBazar = p.PointClusterCoordinates.Average(a => a.PotansielAvalie), Enheraf = pointPerCluster - p.PointClusterCoordinates.Count, OriginDestinationDistance = Math.Round((KdTreeHelper.GetDistanceCoordinate(p.PointClusterCoordinates.First(), p.PointClusterCoordinates.Last()) / 1000), 2) //convert to kilometer }).ToList()); }
public IEnumerable <PathGrid> GetListOfPathGrid(PathFinderIndexViewModel viewModel, List <PointCluster> pointClusters) { return(pointClusters.Select((p, index) => new PathGrid { RowNumber = ++index, PathName = $"مسیر شماره - {index}", IdPlaceTree = p.IdPlaceTree, TemporaryId = Guid.NewGuid(), Checked = false, ToziZamaniPishfarz = viewModel.DefaultTimeDistribution, BazeZamaniTour = viewModel.TourTimeSpan, PointClusterCoordinates = p.PointClusterCoordinates, PointsPerCluster = p.PointClusterCoordinates.Count, GradeAvaliyeBazar = p.PointClusterCoordinates.Average(a => a.PotansielAvalie), Enheraf = viewModel.PointsOnPath - p.PointClusterCoordinates.Count, OriginDestinationDistance = Math.Round((KdTreeHelper.GetDistanceCoordinate(p.PointClusterCoordinates.First(), p.PointClusterCoordinates.Last()) / 1000), 2) //convert to kilometer })); }