How to divide the object cone into layers (e.g. slices) of certain thickness(e.g. thickness = 10 or 5 ...) to measure it volume layers-wise.?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
M.S. Khan
el 27 de Ag. de 2020
Comentada: M.S. Khan
el 1 de Sept. de 2020
I have a cone. I measured its volume using code below. very thankful to Mr. Bruno Luong for his guidance. My aim is to divide this cone into number of layers using certians thickness, then i want to measure the volume of each layer (i.e. slice). For example, using thickness of layers = 10, i will get certain numer of layers (i.e. slices). How can we perform such operations using matlab. Thanks in advance for all cooperation.
Attached is file for coordinates of the cone using following cone parameters.
% Cone parameters
% x, y, and z coordinates are given in attached file.
R = 78; % radius of the cone
h = 188.4; % height of the cone.
N = 20000; % points used to generate the cone.
tri = delaunay(x,y,z);
trisurf(tri,x,y,z)
% indices of triangle
i1 = tri(:,1);
i2 = tri(:,2);
i3 = tri(:,3);
i4 = tri(:,4);
%% Volume by summing tetrahedron
v1 = [x(i1)-x(i2) y(i1)-y(i2) z(i1)-z(i2)];
v2 = [x(i1)-x(i3) y(i1)-y(i3) z(i1)-z(i3)];
v3 = [x(i1)-x(i4) y(i1)-y(i4) z(i1)-z(i4)];
A = 1/2*cross(v1,v2,2); % surface of a triangle
V = 1/3*dot(A,v3,2); % volume of a tetrahedron
format longG
V = sum(abs(V))
3 comentarios
Respuesta aceptada
Bruno Luong
el 31 de Ag. de 2020
Editada: Bruno Luong
el 31 de Ag. de 2020
Among the methods that you request , this one is the worst method.
R = 78;
h = 188.4000;
Vtheoretical = pi*R^2*h/3 % 1200324.64
load('xyz_coords_cone.txt');
z = xyz_coords_cone(:,3);
dz = 10; % WARNING: chosen carefully the step depending on the desity of points, otherwise inaccurate result returned
zbin = min(z):dz:max(z);
zbin(end) = Inf;
[n, loc] = histc(z, zbin);
nbins = length(n);
s = zeros(1,nbins);
for k=1:nbins
xy = xyz_coords_cone(loc==k,[1 2]);
if ~isempty(xy)
[~,s(k)] = convhull(xy);
end
end
V = sum(s)*dz % 1195520.00
Más respuestas (0)
Ver también
Categorías
Más información sobre 3-D Volumetric Image Processing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!