Generating voxels for stl files

조회 수: 9 (최근 30일)
Memo Remo
Memo Remo 2020년 5월 13일
답변: DGM 2025년 4월 5일
Hi All,
I have a stl file of the surfaces of some complex geometries. The stl file contains the coordinates for the vertices on the surfaces of the geometries. However, I am now interested in filling the volume of each geometries with vertices so that the bigger the gometry is, the higher amount of vertices it should get.
Till now, the only idea that came to my mind is to mesh the stl files with volume elements and then extract the centroid of each volume elements. This way I can fill each geometries with specific number of vertices based on their volumes. However, since the geometries are highly complex, this process, meshing them with CAE software, can be very time consuming. I am now wondering if there is a function in matlab that can fill the volume of each geometry with a network of vertices so that the bigger geometries have more vertices in them compared to the smaller ones.
I will be really thankful if someone can help me with this problem.
Many thanks in advance,
  댓글 수: 2
darova
darova 2020년 5월 13일
Can you show sample geomtry?
Memo Remo
Memo Remo 2020년 5월 13일
Hi Darova,
Sure. Attached is the sample geometry. Please consider that there are many of these small geometries in the final file.
Best,
M

댓글을 달려면 로그인하십시오.

답변 (2개)

darova
darova 2020년 5월 13일
First you need to separate each region of interest (try clusterdata or kmeans)
Once you separate each blob generate pointcloud
Use alphaShape with inShape option to identificate points inside
  댓글 수: 4
darova
darova 2020년 6월 11일
What abou this?
clc,clear
ff = stlread('sample.stl');
ind = clusterdata(ff.vertices,10); % group data in 10 regions
cmap = rand(10,3); % generate 10 random colors
cla
f1 = ind(ff.faces); % find faces of groups
ff1.vertices = ff.vertices;
for i = 1:10
ix = find(f1(:,1)==i); % find group
ff1.faces = ff.faces(ix,:); % faces of group
ff1.facecolor= rand(1,3); % random color
patch(ff1) % display region
end
axis vis3d
result
Do you the number of separate regions?
Memo Remo
Memo Remo 2020년 6월 13일
Thanks a lot for your help. I need to give it a try. Will let you know if it works. By the way, it seems a brilliant idea!

댓글을 달려면 로그인하십시오.


DGM
DGM 2025년 4월 5일

카테고리

Help CenterFile Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by