1. A computer-implemented method being executed by a processor of an electronic device, the method comprising: (a) inputting a moving object and a reference object; (b) acquiring triangle data of the moving object, and fitting feature elements of the moving object according to the triangle data; (c) matching the feature elements of the moving object and feature elements of the reference object; (d) moving the moving object from a position of a center point of the feature elements of the moving object to a position of a center point of the matching feature elements of the reference object; (e) obtaining a moving-and-rotating matrix of the moving object according to Quasi-Newton methods; and (f) aligning the moving object and the reference object by moving and rotating the moving object according to the moving-and-rotating matrix.