Question regarding finding the boundaries (vertices) of a series of data points on a 2D space
2 views (last 30 days)
Show older comments
Hello,
I have a series of x,y data that form a distinct closed shape (this shape is not a geometrical shape like circle, sphere, etc.). My problem is how to test if a new given point would fall inside or outside this shape. It seems that "inpolygon" function of matlab can answer my question, but that function requires the vertices of the object but my data is x/y info of all points that form the shape. Is there an already available function that I can use to find the vertices of these data? also, do you have any other suggestion instead of "inpolygon" for inside/outside problem? I greatly appreciate your response.
Regards, NF
2 Comments
Sven
on 15 Nov 2011
So when you say "my data is x/y info of all points that form the shape", you mean that you *don't* have vertex data of the *boundaries*, you instead have data of every point *inside* the shape?
Are all of your points in a regular grid? Can you use bwboundaries?
It will certainly help if you can show a small piece of code that demonstrates your problem.
Answers (1)
Image Analyst
on 15 Nov 2011
Have you taken a look at the convex hull, convhull()? That will give you the coordinates of the exterior perimeter points, just as if you have wrapped a rubber band around your points.
See Also
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!