How to find whether the point lies with in the enclosed boundary region or not

2 visualizaciones (últimos 30 días)
Hello,
I have a set of points for which i have created a enclosed region using boundary function.
Are there some ways to find whether a point lies with in the enclosed region or not?.Please see the attached picture.for ex; if i want to know whether (x = 20 y =5) is with in the enclosed region or not.
Thanks!

Respuestas (1)

KSSV
KSSV el 11 de Mzo. de 2022
Read about inpolygon.
  5 comentarios
Simon Chan
Simon Chan el 12 de Mzo. de 2022
Vertices are not arranged in a correct order and function boundary do the job for you.
clear; clc;
load('xy.mat')
xq = 10;
yq = 10;
pgon1 = polyshape(xv,yv);
Warning: Polyshape has duplicate vertices, intersections, or other inconsistencies that may produce inaccurate or unexpected results. Input data has been modified to create a well-defined polyshape.
subplot(1,2,1)
plot(pgon1);
hold on
plot(xq,yq,'r*');
title('Use xv and yv');
subplot(1,2,2);
bd1 = boundary(xv,yv);
pgon1b = polyshape(xv(bd1),yv(bd1));
plot(pgon1b);
hold on
plot(xq,yq,'r*');
title('Use xv and yv with function boundary');

Iniciar sesión para comentar.

Categorías

Más información sobre Mathematics en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by