Levelling of 3D built in stl file

조회 수: 1 (최근 30일)
Noor Mohammad
Noor Mohammad 2019년 8월 6일
댓글: DGM 2025년 6월 27일
Hello Community,
I have a stl file of 3D image. This image is titled 45 degree. I want to level (project) it on a plane so that I could get z values (height of the different parts of the cracks). For details please have a look at the attachment. This is sample which contains many cracks. Some of the cracked are elevated, i.e., curled ups. I want to know the height of these curlings. Thanks.
  댓글 수: 2
darova
darova 2019년 8월 6일
You forgot to attach the image :(
Noor Mohammad
Noor Mohammad 2019년 8월 6일
편집: Noor Mohammad 2019년 8월 7일
It is uploaded now. Thanks drova for your response.

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

답변 (1개)

KSSV
KSSV 2019년 8월 7일
편집: KSSV 2019년 8월 7일
Download this file exchange function:
[t,p] = stlread('Tr_3.stl') ;
% Rotate along z axes by 45 degrees
th = 45 ;
R = [cosd(th) -sind(th) 0 ; sind(th) cosd(th) 0 ; 0 0 1] ; % Rotation matrix
pr = p*R ; % Rotate the points
pr(:,3) = pr(:,3)-mean(pr(:,3)) ;
% plot
trisurf(t,pr(:,1),pr(:,2),pr(:,3),'EdgeColor','none')
xlabel('x')
ylabel('y')
zlabel('z')
  댓글 수: 5
KSSV
KSSV 2019년 8월 7일
Okay.....the points have been shifted to (x,y) plane and mean is removed along z......wont this work out?
DGM
DGM 2025년 6월 27일
I'm going to assume that the datum is the lowest point, since the material can't intersect with the container.
% for the forum
unzip Tr_3.zip
% Inputs
T = stlread('Tr_3.stl'); % built-in since R2018b
th = -45; % parameter
% Since we're using the built-in reader
F = T.ConnectivityList;
V = T.Points;
R = [1 0 0; 0 cosd(th) -sind(th); 0 sind(th) cosd(th)]; % Rotation matrix
Vr = V*R; % Rotate the points around x
Vr(:,3) = Vr(:,3) - min(Vr(:,3)); % Remove z-offset
% Plot
trisurf(F,Vr(:,1),Vr(:,2),Vr(:,3),'EdgeColor','none')
xlabel('x')
ylabel('y')
zlabel('z')
axis equal

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

카테고리

Help CenterFile Exchange에서 STL (STereoLithography)에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by