title: What algorithm can I use to determine points within a semi-circle?
body: <p>I have a list of two-dimensional points and I want to obtain which of them fall within a semi-circle.  </p>
  
  <p>Originally, the target shape was a rectangle aligned with the x and y axis.  So the current algorithm sorts the pairs by their X coord and binary searches to the first one that could fall within the rectangle.  Then it iterates over each point sequentially. It stops when it hits one that is beyond both the X and Y upper-bound of the target rectangle.  </p>
  
  <p>This does not work for a semi-circle as you cannot determine an effective upper/lower x and y bounds for it.  The semi-circle can have any orientation.  </p>
  
  <p>Worst case, I will find the least value of a dimension (say x) in the semi-circle, binary search to the first point which is beyond it and then sequentially test the points until I get beyond the upper bound of that dimension.  Basically testing an entire band's worth of points on the grid.  The problem being this will end up checking many points which are not within the bounds.</p>