I am using CGAL to randomly generate points on a square and I want to assign each point an arbitrary int value. The goal is to do a range search using Fuzzy_sphere. My code runs without the added int values however, I can't seem to add a int value and make it run.
I've looked at the examples provided in the manual for doing this with neighbour searching but I can't get it to work with a range searching query.
My working code so far:
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Kd_tree.h>
#include <CGAL/Search_traits_2.h>
#include <CGAL/point_generators_2.h>
#include <CGAL/algorithm.h>
#include <CGAL/Fuzzy_sphere.h>
#include <CGAL/Random.h>
typedef CGAL::Simple_cartesian<double> K;
typedef K::Point_2 Point;
typedef CGAL::Random_points_in_square_2<Point> Random_points_iterator;
typedef CGAL::Counting_iterator<Random_points_iterator> N_Random_points_iterator;
typedef CGAL::Search_traits_2<K> Traits;
typedef CGAL::Fuzzy_sphere<Traits> Fuzzy_circle;
typedef CGAL::Kd_tree<Traits> Tree;
typedef CGAL::Random Random;
int main() {
const int no_points = 2000; // arbitrary
const int size = 1000;
Random rand;
// Vector to store Points
std::vector<Point> point_vec;
for (int i = 0; i < no_points; ++i)
point_vec.push_back(Point(rand.get_double(0, size), rand.get_double(0, size)));
// Add this to a K-D tree
Tree tree(point_vec.begin(), point_vec.end());
// Find a random point to search
Point search_point = Point(rand.get_double(0, 12), rand.get_double(0, 12));
// Creating a fuzzy circle
Fuzzy_circle search_circle(search_point, 20, 0.1); // Center, sqrd radius, fuzziness
// Searching an the area that is specified in "search_area"
boost::optional<Point> search_area = tree.search_any_point(search_circle);
// declare list to store points found in search query
std::list<Point> search_result;
// Doing a range search on the tree KD tree space
tree.search(std::back_inserter(search_result), search_circle);
std::cout << "\n Points in search area: " << search_point << ":\n";
// initiate iterator that will be used to iterate over the elements of the result list.
std::list<Point>::iterator iter;
for (iter = search_result.begin(); (iter != search_result.end()); ++iter)
std::cout << *iter << "\n";
search_result.clear();
return 0;
}
The goal is to access which points are within the range query and their associated values. Any ideas?
I'm pretty new to CGAL and C++ in general, so I'm sorry if this is an easy one.

Found what is probably a very inefficient way of doing this and I'll see how the performance goes later in the program. It works but at what cost