private void findNeighbors() { // find the nearest-neighbor for each point in the cloud nn.setPoints(usedNnData, listPointVector.toList()); for (int i = 0; i < listPointVector.size; i++) { // find the nearest-neighbors resultsNN.reset(); double[] targetPt = usedNnData.get(i); // numNeighbors+1 since the target node will also be returned and is removed nn.findNearest(targetPt, maxDistanceNeighbor, numNeighbors + 1, resultsNN); PointVectorNN p = listPointVector.get(i); // save the results p.neighbors.reset(); for (int j = 0; j < resultsNN.size; j++) { NnData<PointVectorNN> n = resultsNN.get(j); // don't add the point to its own list of neighbors list if (n.point != targetPt) { p.neighbors.add(n.data); } } } }