Best plane fit to 3d points.

kepler

New member
Joined
Jul 14, 2015
Messages
26
Hi.

Some time ago I've placed this problem at this forum. Still, it wasn't solved.

Given a set of 3 points (3D), I want to find the best fit plane that passes through them and also the origin (0,0,0)

If they were 2 points only, I would simply find the cross product between them (vetor OP and OQ, being O the origin and P and Q the 2 points) , and it would be a perfect fit.

Can someone help me out translating this small problem into a piece of code?

Kind regards,

Kepler
 
Some time ago I've placed this problem at this forum. Still, it wasn't solved.

Given a set of 3 points (3D), I want to find the best fit plane that passes through them and also the origin (0,0,0)

If they were 2 points only, I would simply find the cross product between them (vetor OP and OQ, being O the origin and P and Q the 2 points) , and it would be a perfect fit.

Can someone help me out translating this small problem into a piece of code?
The original thread was here. It appears that the "solving" requested may be the writing of the code, as otherwise the mathematical portion seems to have been completed for the poster already. ;)
 
}
Hi.

Some time ago I've placed this problem at this forum. Still, it wasn't solved.

Given a set of 3 points (3D), I want to find the best fit plane that passes through them and also the origin (0,0,0)

If they were 2 points only, I would simply find the cross product between them (vetor OP and OQ, being O the origin and P and Q the 2 points) , and it would be a perfect fit.
That would be one answer. Actually there are an infinite number of planes that contain two given points. You added the origin.

Can someone help me out translating this small problem into a piece of code?

Kind regards,

Kepler
Any plane can be written in the form z= Ax+ By+ C. Given a point, (a, b, c), you can define the "difference" from the plane to the point as \(\displaystyle |c- (Aa+ Bb+ C)|= \sqrt{(Aa+ Bb+ C- c)^2}\). For a large number of points, including (0, 0, 0), that can be taken as \(\displaystyle \sum \sqrt{(Aa+ Bb+ C- c)}\) where the sum is over all points. To find the "least squares" fit, take the derivatives of that with respect to A, B, and C, set them equal to 0, and solve for A, B, and C.
 
Last edited:
Top