Identify some nodes near a known node

1 view (last 30 days)
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

Accepted Answer

Fabio Freschi
Fabio Freschi on 9 Oct 2023
Edited: Fabio Freschi on 9 Oct 2023
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')

More Answers (1)

Matt J
Matt J on 9 Oct 2023
Edited: Matt J on 9 Oct 2023
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')

Categories

Find more on Graphics Object Programming in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!