given following set of points in a vector {( 100, 150 ), ( 101, 152 ), ( 102, 151 ), ( 105, 155 ), ( 50, 50 ), ( 51, 55 ), ( 55, 55 ), ( 150, 250 ), ( 190, 260 ) }
I need to identify neighboring points and their count. Let us say the acceptable distance has been set as 5. Now I need following output: frequency of point ( 100, 150 ) with in 5 units is 4. frequency of point ( 50, 50 ) with in 5 units is 3 frequency of point ( 150, 250 ) within 5 units is 1 frequency of point ( 190, 260 ) within 5 units is 1
I have tried a RTree solution to this problem but couldn't determine the logic to exclude all neighboring points as candidates. Means Once I have identified there are four neighbors of ( 100, 150 ), I don't want to identify the neighbors of those neighbors. I would like to move on to next value. Here are the presumptions: 1. efficiency is the topmost concern 2. The vector is unsorted 3. the vector may contain thousands of points. I am using C++ and boost implementation of RTree. Please guide me how can I achieve the solution
EDIT
I can't post an answer because the question has been erroneously put on hold. The code to solve this the way you want is here. If the question reopens I could elaborate on it, for now try to read it and be patient
Aucun commentaire:
Enregistrer un commentaire