Fit a plane to a list of (more than three) points.
points (sequence[point]) – A list of points represented by their XYZ coordinates.
[float, float, float] – Base point.
[float, float, float] – Normal vector (normalized).
This method will minimize the squares of the residuals as perpendicular to the main axis, not the residuals perpendicular to the plane. If the residuals are small (i.e. your points all lie close to the resulting plane), then this method will probably suffice. However, if your points are more spread then this method may not be the best fit. For more information see [ernerfeldt2015]
Ernerfeldt, E. Fitting a plane to many points in 3D. Available at: http://www.ilikebigbits.com/blog/2015/3/2/plane-from-points