Find Concave Edges in STL-File
22 views (last 30 days)
Show older comments
Timo Schmid on 19 Jan 2021
Commented: Alfredo Bagalà on 14 Sep 2022
I am looking for a method to identify concave edges of an STL model which is not too computationally intensive..
The stlread function provides the vertex-coordinates (mx3), faces (nx3) and normals of the faces (nx3)... Where m is the number of all triangle vertices and n is the number of corresponding face-indices.
The edges I want to identify are the ones I marked red (as an example):
I tried different methods which all took ages too compute.
For example I created an Triangulation object using the triangulate function and compared the angle between normals of adjacent faces to further on store their common edge in case of exceeding a treshold - stopped working on this idea because of the sheer amount of calculations needed.
TR = triangulation(faces,x,y,z);
% Compare all faces if they are neighbors
for compId = 1:(size(TR.ConnectivityList,1))
% ID for comparison is not equal to query ID
if queryId ~= compId
% If faces are connected calculate angle between face
n1 = TR.faceNormal(queryId);
n2 = TR.faceNormal(compId);
theta = acos(dot(n1,n2) / (norm(n1)*norm(n2)));
% Do further calculations here if theta > treshold
I also tried using the Triangulation objects property "featureEdges" to extract these edges, but unfortunately it doesn't yield the result I expected (right picture), although it works quite fine for the example (left picture) provided in the function file.
Hope anybody can help me. Thanks!
Find more on STL (STereoLithography) 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!