How can I quantify the number of polygons that cover a a particular point?

1 view (last 30 days)
Hello, I have a population of polygons, each representing a particular region in space. I would like to know the distribution of these polygons across space. I can visualize this by plotting them as patches and decreasing the transparency. Thus, as more polygons cover a particular area, it appears darker as they 'pile-up' over it. However, I would like to quantify this. How can I look at each pixel in my plot and see how many polygons are sitting above it? I imagine this like a surface plot except instead of each point representing a value it represents the 'depth' of polygons that have been plotted there.
A solution I have considered is to fill each polygon with ones (so I have a matrix representing the entire space, with ones where the polygon lies and zeros elsewhere) and then summing the matrices; but I don't know how to do this.
Any help is appreciated.

Accepted Answer

Walter Roberson
Walter Roberson on 24 Feb 2011
Perhaps inpolygon() would be useful for this.
  1 Comment
David
David on 24 Feb 2011
Maybe, but the points that I want to test as in or out of the polygon would be the entire background space. I'm not sure how to do this either.

Sign in to comment.

More Answers (1)

David
David on 24 Feb 2011
I have solved this (a bit amateurishly) by using two vectors that represent all of the background space, along with the polygon, as inputs to inpolygon.

Community Treasure Hunt

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

Start Hunting!