public void DoesNotThrowIfRequestingTooManyItemsForMaxDistance() { var bush = new RBush <Box>(); bush.BulkLoad(boxes); bush.Knn(1000, 40, 40, maxDistance: 10); }
public void DoesNotThrowIfRequestingTooManyItems() { var bush = new RBush <Box>(); bush.BulkLoad(boxes); bush.Knn(1000, 40, 40); }
public void FindsNNeighbors() { var bush = new RBush <Box>(); bush.BulkLoad(boxes); var result = bush.Knn(10, 40, 40); var expected = boxes .OrderBy(b => b.DistanceTo(40, 40)) .Take(10) .ToList(); Assert.Equal(expected, result); }
public void FindAllNeighborsForMaxDistance() { var bush = new RBush <Box>(); bush.BulkLoad(boxes); var result = bush.Knn(0, 40, 40, maxDistance: 10); var expected = boxes .Where(b => b.DistanceTo(40, 40) <= 10) .OrderBy(b => b.DistanceTo(40, 40)) .ToList(); Assert.Equal(expected, result); }
public void FindNeighborsThatSatisfyAGivenPredicate() { var bush = new RBush <Box>(); bush.BulkLoad(richData); var result = bush.Knn(1, 2, 4, predicate: b => b.Version < 5); var expected = richData .Where(b => b.Version < 5) .OrderBy(b => b.DistanceTo(2, 4)) .Take(1) .ToList(); Assert.Equal(expected, result); }