Calculate the normal vector between two nodes in the space
30 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Alberto Acri
el 11 de Ag. de 2024 a las 12:41
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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1750769/image.png)
0 comentarios
Respuesta aceptada
Torsten
el 11 de Ag. de 2024 a las 12:49
Editada: Torsten
el 11 de Ag. de 2024 a las 12:57
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 comentarios
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!