Obtaining a best fitting plane through 3D georeferenced data

The orientation of a surface can be derived from the X, Y, Z position of three or more points lying on it. Two different methods are presented to obtain average surface orientations from points belonging to the surface. One consists of calculating a best-fit plane through a planar regression of data, which yields an average orientation for sets of more than three points. The second approach consists of analyzing the moment of inertia of the set of points to obtain the orientation of the best-fit plane and a measure of the spatial distribution of points. The quality of the orientation measurement depends strongly on the spatial distribution of points and can be evaluated with the use of eigenvalues.