calculate the normal of a 3D plane

Hi! I have a circular plane, whose coordinates of the points of the circumference are:
P = importdata("node_plane.mat");
plot3(P(:,1),P(:,2),P(:,3))
I would like to know if it is correct to calculate the normal of this plane in the following way:
N = cross(P(1,:) - P(2,:), P(3,:) - P(2,:));
N = N/norm(N);

 Accepted Answer

Torsten
Torsten on 16 May 2024
Moved: Torsten on 16 May 2024
I would like to know if it is correct to calculate the normal of this plane in the following way:
N = cross(P(1,:) - P(2,:), P(3,:) - P(2,:));
N = N/norm(N);
If you are sure that all points lie in exactly one plane: yes, you can choose any three points and do as you did above.
If you first need to fit a plane to your data points: no.

4 Comments

Thanks! To be sure that all points (or possibly which points) lie exactly on a plane how can one know?
Insert all points P in the expression
N*(P-P(1,:))'
and hope that the result is 0 in all cases.
Since it is not: the best fit plane is N'*(P-C)' = 0 with N and C as below.
P = importdata("node_plane.mat");
n = size(P,1);
C = sum(P,1)/n
C = 1x3
-28.9943 -3.2320 44.2401
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
Pn = P-C;
[U, S, V] = svd(Pn);
N = V(:,3)
N = 3x1
-0.0439 -0.1877 0.9813
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
sum(abs(N'*Pn')) %Sum of distances between plane and points given in node_plane.mat
ans = 4.3799e-12
Okay, I am not very familiar with it. So the best normal that can be determined with the 'node_plane' points is the one indicated in your code with N? Correct?
Torsten
Torsten on 16 May 2024
Edited: Torsten on 16 May 2024
Yes, N is the normal and C is the centroid of your points, and the best-fit plane is N'*(x-C)' = 0.

Sign in to comment.

More Answers (0)

Products

Release

R2021b

Asked:

on 16 May 2024

Edited:

on 16 May 2024

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!