Polygons with true and false statements

1 visualización (últimos 30 días)
Juan José Gómez Romero
Juan José Gómez Romero el 10 de Jul. de 2020
Respondida: KSSV el 10 de Jul. de 2020
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);

Respuestas (1)

KSSV
KSSV el 10 de Jul. de 2020
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.

Categorías

Más información sobre Elementary Polygons 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!

Translated by