public void TestRectQuery() { // Verify that rectangular query works KDBush <int> kdbush = new KDBush <int>(10); kdbush.Index(points); var result = kdbush.Query(20, 30, 50, 70); List <int> correctPoints = new List <int>(new int[] { 60, 20, 45, 3, 17, 71, 44, 19, 18, 15, 69, 90, 62, 96, 47, 8, 77, 72 }); AssertPointsMatch(correctPoints, result); }
public void TestRadiusQuery() { // Verify that circular query works KDBush <int> kdbush = new KDBush <int>(10); kdbush.Index(points); var result = kdbush.Query(50, 50, 20); List <int> correctPoints = new List <int>(new int[] { 60, 6, 25, 92, 42, 20, 45, 3, 71, 44, 18, 96 }); AssertPointsMatch(correctPoints, result); }
public void IndexIsSorted() { // Verify that indexing works int[] ids = new int[] { 97, 74, 95, 30, 77, 38, 76, 27, 80, 55, 72, 90, 88, 48, 43, 46, 65, 39, 62, 93, 9, 96, 47, 8, 3, 12, 15, 14, 21, 41, 36, 40, 69, 56, 85, 78, 17, 71, 44, 19, 18, 13, 99, 24, 67, 33, 37, 49, 54, 57, 98, 45, 23, 31, 66, 68, 0, 32, 5, 51, 75, 73, 84, 35, 81, 22, 61, 89, 1, 11, 86, 52, 94, 16, 2, 6, 25, 92, 42, 20, 60, 58, 83, 79, 64, 10, 59, 53, 26, 87, 4, 63, 50, 7, 28, 82, 70, 29, 34, 91 }; KDBush <int> kdbush = new KDBush <int>(10); kdbush.Index(points); for (int i = 0; i < points.Count; i++) { Assert.AreEqual(ids[i], kdbush.points[i].UserData); } }