Fitting¶
[2]:
from geo3d.fit import fit_plane
from geo3d import Point, Plane, Vector
Plane Fit to Points¶
Fit a plane to an array of points. The fitted plane is defined by a Plane.point
attribute giving the centroid of the fitted points, and a normal vector attribute Plane.normal
.
[3]:
points = [[1,0,0], [0,1,0], [-1,0,0]]
plane = fit_plane(points)
plane
[3]:
Plane(normal=<Vector at 2697000856352> [0. 0. 1.], point=<Point at 2697005808896> [0. 0.33333333 0. ])
Express the plane as coefficients a
, b
, c
, d
in \(a x + b y + c z + d = 0\):
[6]:
(a,b,c,d) = plane.as_abcd()
(a,b,c,d)
[6]:
(0.0, 0.0, 1.0, -0.0)