use of org.ddogleg.sorting.QuickSort_F64 in project BoofCV by lessthanoptimal.
the class TestLlahOperations method findNeighbors.
/**
* Sees if all the neighbors are found for the specified point. The specified point should not be
* included in the neighbor list
*/
@Test
void findNeighbors() {
LlahOperations llahOps = createLlahOps(LlahInvariant.AFFINE);
List<Point2D_F64> list = UtilPoint2D_F64.random(-1, 1, 20, rand);
List<Point2D_F64> expected = new ArrayList<>();
llahOps.nn.setPoints(list, false);
Point2D_F64 target = list.get(10);
var distances = new double[list.size()];
for (int i = 0; i < list.size(); i++) {
expected.add(list.get(i));
distances[i] = target.distance(list.get(i));
}
new QuickSort_F64().sort(distances, list.size(), expected);
llahOps.findNeighbors(target);
for (int i = 0; i < neighborsN; i++) {
assertTrue(llahOps.neighbors.contains(expected.get(i + 1)));
}
}
Aggregations