A sweep-line algorithm for spatial clustering