Identify some nodes near a known node

조회 수: 2 (최근 30일)
Alberto Acri
Alberto Acri 2023년 10월 9일
편집: Fabio Freschi 2023년 10월 9일
Is there a way to identify the upper and lower nodes of this geometry by knowing a node?
nodes = importdata("NODES.mat");
faces = importdata("FACES.mat");
P1 = [28.9646, -21.3886, 97.3614];
P2 = [17.2506, -22.7154, 62.1242];
figure
plot3(nodes(:,1),nodes(:,2),nodes(:,3),'k.','Markersize',2);
hold on
trimesh(faces(:,:),nodes(:,1),nodes(:,2),nodes(:,3),'EdgeColor','k','Linewidth',0.1,'Facecolor','b','FaceAlpha',0.2)
plot3(P1(:,1),P1(:,2),P1(:,3),'r.','Markersize',27);
plot3(P2(:,1),P2(:,2),P2(:,3),'r.','Markersize',27);
hold off
axis equal

채택된 답변

Fabio Freschi
Fabio Freschi 2023년 10월 9일
편집: Fabio Freschi 2023년 10월 9일
You can use featureEdges. You get both upper and lower nodes, but it's not difficult to distinguish them
You can also check for nodes lying on the plane, as I suggested in yhe answer to your previous question here
nodes = importdata("NODES.mat");
faces = importdata("FACES.mat");
P1 = [28.9646, -21.3886, 97.3614];
P2 = [17.2506, -22.7154, 62.1242];
figure
plot3(nodes(:,1),nodes(:,2),nodes(:,3),'k.','Markersize',2);
hold on
trimesh(faces(:,:),nodes(:,1),nodes(:,2),nodes(:,3),'EdgeColor','k','Linewidth',0.1,'Facecolor','b','FaceAlpha',1)
plot3(P1(:,1),P1(:,2),P1(:,3),'r.','Markersize',27);
plot3(P2(:,1),P2(:,2),P2(:,3),'r.','Markersize',27);
% hold off
axis equal
TR = triangulation(faces,nodes);
E = featureEdges(TR,pi/3);
P = nodes(E(:),:);
plot3(P(:,1),P(:,2),P(:,3),'ro','MarkerFaceColor','r')

추가 답변 (1개)

Matt J
Matt J 2023년 10월 9일
편집: Matt J 2023년 10월 9일
It can help. The outliers in d below near correspond to the faces at the caps of the tube. Once you have these faces, you can use TR.ConnectivityList to determine the vertices attached to them.
nodes = importdata("NODES.mat");
faces = importdata("FACES.mat");
P1 = [28.9646, -21.3886, 97.3614];
P2 = [17.2506, -22.7154, 62.1242];
TR=triangulation(faces,nodes);
u=(P1-P2)/norm(P1-P2);
d=faceNormal(TR)*u(:);
plot(d,'x')

카테고리

Help CenterFile Exchange에서 Graphics Object Programming에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by