#include #include #include #include #include #include typedef CGAL::Simple_cartesian K; typedef K::Point_2 Point_d; typedef CGAL::Random_points_in_square_2 Random_points_iterator; typedef CGAL::Counting_iterator N_Random_points_iterator; typedef CGAL::Search_traits_2 Traits; typedef CGAL::Kd_tree Tree; typedef CGAL::Fuzzy_iso_box Fuzzy_iso_box; int main() { const int N = 1000; std::list points; points.push_back(Point_d(0,0)); Tree tree; Random_points_iterator rpg; for(int i = 0; i < N; i++){ tree.insert(*rpg++); } std::list result; // define range query Point_d p(0.2, 0.2); Point_d q(0.7, 0.7); // Searching an exact range // using default value 0.0 for epsilon fuzziness paramater // Fuzzy_box exact_range(r); replaced by Fuzzy_iso_box exact_range(p,q); std::cout << "tree.search(..)" << std::endl; //tree.report_all_points(std::ostream_iterator(std::cout,"\n")); tree.search( std::back_inserter( result ), exact_range); std::cout << "The points in the box [0.2,0.7]x[0.2,0.7] are: " << std::endl; std::copy (result.begin(), result.end(), std::ostream_iterator(std::cout,"\n") ); std::cout << std::endl; result.clear(); // Searching a fuzzy range // using value 0.1 for fuzziness paramater Fuzzy_iso_box approximate_range(p, q, 0.1); tree.search(std::back_inserter( result ), approximate_range); std::cout << "The points in the fuzzy box [<0.1-0.3>,<0.6-0.9>]x[<0.1-0.3>,<0.6-0.9>] are: " << std::endl; std::copy (result.begin(), result.end(), std::ostream_iterator(std::cout,"\n") ); std::cout << std::endl; return 0; }