Polygons with true and false statements
2 次查看(过去 30 天)
显示 更早的评论
Hi. I'm trying to make a polygon with true and false statements in a meshgrid of linear spaces. I managed to make a circle and a square, but nothigh further than that. Here's the code for mi circle and square
Circle:
xv = linspace(-32,32,256);
yv = linspace(-32,32,256);
[mx my] = meshgrid(xv,yv);
dat1 = (mx.*mx + my.*my > 16);
figure(1);imshow(dat1);
Square:
dat = zeros(128,128);
vtamx = 32;
vtamy = 32;
dat(64-vtamy/2:64+vtamy/2,64-vtamx/2:64+vtamx/2) = 1;
imshow(dat);
0 个评论
回答(1 个)
KSSV
2020-7-10
Read about inpolygon. You can define your required polygon vertices, and inpolygon will give you indices lying inside with 1 and lying outside with 0.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Elementary Polygons 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!