What's the best algorithm / document about finding the nearest / nearest plane from many points in space?

Given a point cloud, what's the best way to find the nearest plane that is accurate enough but also fast enough?

I searched for the nearest plane but couldn't find any information.

I want to use this to bind them to this plane.


source to share

2 answers

I think you could also do this using principal component analysis:

Calculate the average of your scores:

C = (0,0,0);
for each point Ri in your dataset,
  { C += Ri; }
C = C * 1.0 / npoints;


Calculate the covariance matrix of your points:

A = zeros(3,3);
for each point Ri in your dataset,
  D = Ri - C;
  A += D*D';  // outer product


Calculate the inverse of A, A_inv:

  A_inv = inv(A)


Iterate through the cardinality by reapplying A_inv to a random starting vector:

  N = random vector.
  for i=1:20 (or so)
    N = A_inv*N;
    N = normalize(N);


Offset from origin to your plane k = point (N, C). The equation describing your plane has all points R such that k = point (N, R).



Least squares regression would be my guess. It will give you the coefficients for the plane that minimizes the root mean square error across all points.

You are not the first:

Planet 3D Least Squares



All Articles