1. A method for fitting primitive shapes to a set of three-dimensional (3D) points, comprising the steps of: converting the set of 3D points to a distance field, wherein each element in the distance field is associated with a distance to a nearest point in the set of 3D points; hypothesizing a set of two or more candidates of the primitive shapes; determining a score for each candidate using the distance field; and selecting the candidate as the primitive shape to fit to the 3D points according to the scores, wherein the steps are performed in a processor.