Fill cylinder inside a matrix
2 次查看(过去 30 天)
显示 更早的评论
Given a 3d matrix:
vx = 1; % mm
vy = 1; % mm
vz = 1; % mm
nx = 500; %Number of elements in x direction
ny = 500; %Number of elements in y direction
nz = 100; %Number of elements in z direction
x = linspace(-vx/2,vx/2,nx);
y = linspace(-vy/2,vy/2,ny);
z = linspace(-vz/2,vz/2,nz);
[X,Y,Z] = ndgrid(x,y,z);
mat= zeros(size(X)); %Matrix to fill with cyliinders
and 2 random points on the edge of the cube,
How can I make a cylinder of radius R between those 2 points?
I want to fill up the binary matrix with 1 where the cylinder is placed and 0 everywhere else.
Thank you for your help.
0 个评论
采纳的回答
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Computational Geometry 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!