我有一个3d样本(冰),我正在填充球体(气泡),直到它已知密度并使用来自文件交换(http://www.mathworks.com/matlabcentral/fileexchange/8231-bubbleplot3/content/bubbleplot3.m)的bubbleplot3进行绘图。我正在使用的函数和示例输入在下面,生成的图是here。
我希望能够做的是在这个样本中切片并找到暴露在表面的球体积(如果这样做)。 (我需要计算样品的孔隙率,所以我很感兴趣的是,如果切割样品,液体能够渗入样品中。)
我尝试过一些事情,例如用“空气或冰”值填充一个大的逻辑3d矩阵,但它太大了。
欢迎任何想法。
干杯
sphere_count(1,2,4,0.025,0.885)
function [ s ] = sphere_count( x,y,z,b_d,d )
%sphere_count Summary of this function goes here
% x,y,z = dimensions of ice sample, b_d is bubble diameter, d is ice
% sample density
sample_vol = x*y*z;
air_pc = 1-(d./0.917);
air_vol = sample_vol*air_pc;
sphere_vol = 4*pi*((b_d/10)./2)^2;
number_of_spheres = floor(air_vol/sphere_vol);
P = [(x.*rand(1,1)),(y.*rand(1,1)),(z.*rand(1,1))];
k = 1;
while k < number_of_spheres
P1 = [(x.*rand(1,1)),(y.*rand(1,1)),(z.*rand(1,1))]; % Make new co-ords
D = pdist2(P1,P,'euclidean'); % calculate distance between
if D>(b_d/2) % test maximum distance
P=[P;P1]; %#ok<*AGROW> % concat
k=k+1;
end
end
x=P(:,1);y=P(:,2);z=P(:,3);
a = 0.02; % Variance
b = b_d; % Mean
R = a.*randn(numel(P(:,1)),1) + b;
bubbleplot3(x,y,z,R);