MATLAB Answers

How to import geometry from STL without approximation ?

3 views (last 30 days)
Sung Wook Choi
Sung Wook Choi on 28 Aug 2021
Commented: Sung Wook Choi on 29 Aug 2021
Hi all.
I'm now trying to generate geometry from stl file.
ImportGeometry from .stl makes too low density of vertices(and edges) to simulate because of approximation.
In this reason, I added more vertices to original geometry.
However, adding additional viertices without adding edges makes bad mesh boundary.
Is there any method to import all vertices of stl file or increse vertices density of geometry?
Thanks.

Accepted Answer

darova
darova on 29 Aug 2021
Here is an example. Read more: 2-D Geometry Creation at Command Line
t = 0:0.2:2*pi; % make sure the curve is unclosed (decsg throws an error)
r = 5 + sin(5*t);
[x,y] = pol2cart(t,r);
dl = [2; length(x); x(:); y(:)]; % [polygon; # of points; x; y]
gd = decsg(dl); % decomposition
[p,e,t] = initmesh(gd,'Hmax',0.5); % max side triangle 0.5
pdemesh(p,e,t);
hold on
plot(x,y,'.g')
  1 Comment
Sung Wook Choi
Sung Wook Choi on 29 Aug 2021
Thanks darova! I sort vertices in contour lines and draw geometry using decsg function. It works!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by