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

2 visualizzazioni (ultimi 30 giorni)
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!

Risposte (1)

KSSV
KSSV il 11 Mar 2022
Read about inpolygon.
  5 Commenti
Simon Chan
Simon Chan il 12 Mar 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');

Accedi per commentare.

Categorie

Scopri di più su Mathematics in Help Center e File Exchange

Prodotti


Release

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by