Select all points inside a polygon to create a new matrix

8 vues (au cours des 30 derniers jours)
Martha
Martha le 31 Mar 2014
Commenté : Martha le 31 Mar 2014
Hi, I have a point cloud matrix x,y and I want to create a new matrix with all the points that are inside a polygon to create a new matrix with all the points that are inside a polygon.
Thank you in advance, Martha

Réponse acceptée

Walter Roberson
Walter Roberson le 31 Mar 2014
Find the convex hull, and then you can use the vertices in poly2mask()
If you want the hull to be non-convex (e.g., to follow the points of a "star") then you have more difficulty in defining "inside".
  1 commentaire
Martha
Martha le 31 Mar 2014
Thank you Walter, Im going to try it now!

Connectez-vous pour commenter.

Plus de réponses (1)

Star Strider
Star Strider le 31 Mar 2014
Would the inpolygon function do what you want?
  1 commentaire
Martha
Martha le 31 Mar 2014
I try the inpolygon, but it return to me a matrix of the same size, only specifying with 1 and 0 the points that are in or out. But I want a new matrix with only the elements that are inside the polygon

Connectez-vous pour commenter.

Catégories

En savoir plus sur Elementary Polygons dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by