What's the best algorithm / document about finding the nearest / nearest plane from many points in space?
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).
+1
source to share