Given a set of distinct points in 2D space, and a rectangle (coordinates of all four points, sides parallel with xy axis) how can I quickly find which points are inside the rect
I think you should store your points in a quadtree. I have not worked out the details, but it should allow to basically do something similar to a binary search that directly yields the points that are inside an rectangle.
If your points are clustered, i.e. there exist clusters that contain many points in a small area and other areas that contain no, or very few points an R-tree might be even better.
Runtime complexity should be O(logN) I think.