Identify some nodes near a known node
4 次查看(过去 30 天)
显示 更早的评论
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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1506159/image.png)
0 个评论
采纳的回答
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')
0 个评论
更多回答(1 个)
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1506289/image.png)
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')
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Graphics Object Programming 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!