#include <CGAL/basic.h>
#include <CGAL/Search_traits.h>
#include <CGAL/point_generators_3.h>
#include <CGAL/Orthogonal_k_neighbor_search.h>
#include "Point.h"
#include "Distance.h"
typedef CGAL::Random_points_in_cube_3<Point> Random_points_iterator;
typedef K_neighbor_search::Tree Tree;
int main() {
const int N = 1000;
const unsigned int K = 5;
Random_points_iterator rpit( 1.0);
Tree tree(N_Random_points_iterator(rpit,0),
N_Random_points_iterator(N));
Point query(0.0, 0.0, 0.0);
Distance tr_dist;
K_neighbor_search search(tree, query, K);
for(K_neighbor_search::iterator it = search.begin(); it != search.end(); it++){
std::cout << " d(q, nearest neighbor)= "
<< tr_dist.inverse_of_transformed_distance(it->second) << std::endl;
}
K_neighbor_search search2(tree, query, K, 0.0, false);
for(K_neighbor_search::iterator it = search2.begin(); it != search2.end(); it++){
std::cout << " d(q, furthest neighbor)= "
<< tr_dist.inverse_of_transformed_distance(it->second) << std::endl;
}
return 0;
}