Calculating a Best Fit plane Through Multiple 3D Points

madaxe2

New member
Joined
Dec 4, 2020
Messages
7
I have a table of 3D Points and I need to find the best fit plane and its normal.

I have completed a series of steps see below, which results in 3 Vectors defined by three determinants, I have looked at these three vectors in my CAD application and V3 seems to be the closest result. The centroid is an exact match the the CAD, but I guess that's the easy step.

My question is, how do I use the determinants to decide which of the three vectors is the best result, or is that not the correct?

here is the resulting plane equation from the cad model
( -0.462337 * X ) + ( -0.873304 * Y ) + ( 0.153572 * Z ) = -0.026

Thanks

Madaxe


Data
xyz
119
1214
1320
2111
2217
2323
3115
3220
3326

Step 1) Centroid (=SUM(A3:A11) * (1/9)) , (=SUM(B3:B11) * (1/9)) , (=SUM(C3:C11) * (1/9))

Centroid
cxcycz
2217.22222

Step 2) Subtract the Centroid From Each Point (I think this is normalizing the point data).
rx=x-cxry=y-cyrz=z-cz
-1-1-8.22222
-10-3.22222
-112.777778
0-1-6.22222
00-0.22222
015.777778
1-1-2.22222
102.777778
118.777778

Step 3) (Not sure what this step is doing)
rx.rxrx.ryrx.rzry.ryry.rzrz.rz
118.22222218.22222267.60494
103.2222220010.38272
1-1-2.7777812.7777787.716049
00016.22222238.71605
000000.049383
00015.77777833.38272
1-1-2.2222212.2222224.938272
102.777778007.716049
118.77777818.77777877.04938

Step 4) (Again not sure why or what were doing here, other than summing the previous step)
xx=Σrx.rxxy=Σrx.ryxz=Σrx.rzyy=Σry.ryyz=Σry.rzzz=Σrz.rz
6018634247.5556

Step 5) Defining the determinants (this seems to be the cross product from the matrix from the previous step, guessing at this)
Determinants
det_x329.3333
det_y1377.333
det_z36

Step 6) Resulting Three vectors
Vectors
v1v2v3
329.3333612-108
6121377.333-204
-108-20436
 
Top