how to check the length of stl model edge in matlab

8 次查看(过去 30 天)
I drew a cubic whose lengeh is 1mm formating stl.After importing the stl model into matlab,I got p(the coordinate of all the vertexes or points),tnorm(all the face normals) and t(all the triangles contains the indexes of the composed points of each triangle),but I want to find all the edges that are longer than 0.5mm,and interpolate a midpoint.How can I make it? Thank you.

回答(1 个)

Sleh Eddine Brika
Sleh Eddine Brika 2017-4-13
I hope you already find a solution for this but anyway I am going to answer that if anyone needs it.
%Import the STL file
model = createpde(1);
b=importGeometry(model,'C:\...\filename.stl'); % Put your file name here
g=model.Geometry;
%Calculate the edges length
[Ex, Ey, Ez] = g.allDisplayEdges(); %list of edges
c=(sqrt((Ex(1,:)-Ex(2,:)).^2+(Ey(1,:)-Ey(2,:)).^2+(Ez(1,:)-Ez(2,:)).^2));%the matrix with the length of each edge

Community Treasure Hunt

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

Start Hunting!

Translated by