Making a 3D volume out of splines

조회 수: 2 (최근 30일)
Ellen
Ellen 2020년 5월 31일
답변: darova 2020년 6월 14일
Hi! I am making 3D figures out of x y z coordinates. I used alphashape for this so I could also calculate the volume but alphashape creates 3D shapes which are bigger than they should be. I also used splines which creates the shape that the figures should have. However, I do not know how to make an actual 3D volume out of this like the alphashape does. An example: f.l.t.r scatterplot of the coordinates, alphashape and spline figure.
Does someone know how to make a 3D figure out of the spline figure? Or how to calculate the total volume out of this?
Thank you!
  댓글 수: 2
KSSV
KSSV 2020년 5월 31일
What do you expect?
Ellen
Ellen 2020년 6월 1일
My goal is to make a smooth correct 3D figure out of the provided coordinates. So for example, fill the figure created by the spline lines, but I don't know it that is possible. Other ideas are also very welcome.

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

답변 (1개)

darova
darova 2020년 6월 14일
Try this
clc,clear
load Coordinates.txt
x = Coordinates(:,1);
y = Coordinates(:,2);
z = Coordinates(:,3);
plot3(x,y,z,'.r')
for z0 = min(z):1:max(z)
ix = find(abs(z-z0)<0.3); % find indices of level
x1 = x(ix)-mean(x(ix)); % center data
y1 = y(ix)-mean(y(ix));
z1 = z(ix);
[t,r] = cart2pol(x1,y1); % convert to polar system
[t2,ix1] = sort(t); % order data by angle
x2 = x1(ix1)+mean(x(ix)); % return to original position
y2 = y1(ix1)+mean(y(ix));
% interpolate data
tt = [0; cumsum(hypot(diff(x2),diff(y2)))];
t3 = linspace(0,tt(end));
x3 = spline(tt,x2,t3);
y3 = spline(tt,y2,t3);
z3 = spline(tt,z1(ix1),t3);
line(x3,y3,z3)
end
axis vis3d

카테고리

Help CenterFile Exchange에서 Bounding Regions에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by