how to check the length of stl model edge in matlab

14 views (last 30 days)
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.

Answers (1)

Sleh Eddine Brika
Sleh Eddine Brika on 13 Apr 2017
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

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!