Calculate the normal vector between two nodes in the space
4 views (last 30 days)
Show older comments
Hi! I have two nodes A and B. These are positioned in space with the same value of X and Y but different Z. The normal in this case would be n=[0 0 1] (red plane parallel to the XY plane).
I would like to calculate the normal n 'green' in the case of nodes A and C. Is this possible?
A = [-33.24 -10.70 7.41];
B = [A(1,1), A(1,2), A(1,3)+5];
N = [A;B];
C = [A(1,1), A(1,2)+7, A(1,3)+5];
NN = [A;C];
figure
plot3(A(1,1),A(1,2),A(1,3),'k.','Markersize',30);
hold on
plot3(B(1,1),B(1,2),B(1,3),'r.','Markersize',30);
plot3(C(1,1),C(1,2),C(1,3),'g.','Markersize',30);
plot3(N(:,1),N(:,2),N(:,3),'-k','LineWidth',1);
plot3(NN(:,1),NN(:,2),NN(:,3),'-k','LineWidth',1);
hold off
axis equal

0 Comments
Accepted Answer
Torsten
on 11 Aug 2024
Edited: Torsten
on 11 Aug 2024
n = [0 0 1] points from A to B. So I don't understand what you mean by "normal" to the line connecting two points in 3d.
Usually, it's the set of all vectors perpendicular to the line. You get a basis for this set of vectors by the "null" command:
A = [0 0 0];
B = [0 0 1];
AB = -A + B;
N = null(AB)
N.'*AB.' % Check for orthogonality
2 Comments
More Answers (0)
See Also
Categories
Find more on Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!