vendredi 26 juin 2015

count number of coordinate points in c++

i have a vector which stores a list of co-ordinate points. I would like to count the occurrence of each point within defined tolerance limit. Let us say tolerance limit has been defined as 10 for both X and Y value. and the vector contains { (100, 200), ( 110, 205 ), ( 115, 215 ), ( 120, 220 ), ( 100, 200 ), ( 150, 160 ) }. Now my desired output is ( 100, 200 ) 3 ( 110, 205 ) 4 ( 115, 215 ) 3 ( 120,220 ) 2 ( 150, 160 ) 1

The first co-ordinate count 3 includes (100, 200), ( 110, 205 ) {reason being the value is within the range 100 +- 10 and 200 +- 10 } and ( 100, 200 ) Here efficiency is high priority

Aucun commentaire:

Enregistrer un commentaire