title: Sorting Coordinate Points c++
body: <p>in an application I measure a lot of 2d coordinates (x,y) of a
  pattern. This pattern consists of a set of points on grid with fixed
  pitches in x and y direction. These coordinates all have a score for
  quality and are sorted on this score. What I want to do is to sort
  these coordinates first on x and define groups (regions) of
  x-coordinates that belong together. After this step I want to sort the
  different x-regions in y-regions.</p>
  
  <p>After this I am able to label the coordinates to the corresponding
  pattern (grid) label.</p>
  
  <p>Example: Measured coordinates
  (x,y)= (2,2),(2,3),(1,2),(1,3),(2,1),(1,1),(3,2),(3,3),(3 ,1)</p>
  
  <p>after step 1:
  (x,y)= (1,2),(1,3),(1,1) (2,2),(2,3),(2,1) (3,2),(3,3),(3,1)</p>
  
  <p>after step 2:
  (x,y)= (1,1),(1,2),(1,3),(2,1),(2,2),(2,3),(3,1),(3,2),(3 ,3)</p>
  
  <p>Is there a sort routine that already performs this task? The routine
  should also work if some coordinates of the pattern are not measured.</p>
  
  <p>Can somebody give me some clues, I'm not an experienced c++
  programmer, but maybe with some hints I can do the job!</p>