How to evalutate AREA from connected points?
3 views (last 30 days)
Show older comments
Veronica Taurino
on 30 Aug 2017
Edited: Veronica Taurino
on 25 Feb 2021
I have a group of points and their connectivity matrix (how the points are connected, actually I'm working on a water network). I need to evaluate all the areas between all the lines (you can see the example picture). I've found different functions but I don't know if there is something more specific. I thought first to create polygons and then to evaluate the area but I don't know how to create polygons using the connectivity matrix.
The image above represents my points as a graph
2 Comments
Accepted Answer
More Answers (2)
Guillaume
on 30 Aug 2017
There are a fair number of graph analysis functions that were introduced in R2015b, I'm not sure any of them are that useful for your purpose though.
The main difficulty will be to identify the smallest polygons created by your graph. I'm not sure how you'd do that. It's probably been done before so I would search the literature. Once you have identified the polygons, calculating their area is done with polyarea.
5 Comments
John D'Errico
on 31 Aug 2017
Edited: John D'Errico
on 31 Aug 2017
It is often true that what looks easy to the eye/brain is not so trivial do do by computer. And even if it may be easy, but if nobody else ever identifies a need to do that, then somebody will need to write the code for it. I've never seen anyone else asking for this, so what do you expect?
I'd suggest a simple algorithm.
1. Identify any nodes that have only one edge that touches them. This will prune away all edges that cannot belong to any polygon. Repeat this step if new nodes appear that connect to only one other node.
2. Find any closed polygon. Does that polygon have any nodes that branch off internally into the polygon? If so, then unless that branch terminates, then you can split the polygon into smaller polygons. Repeat the dissection on each piece recursively, until all polygons are minimal. Now find another polygon, one that does not include those you have already found. (This last part may be the least easy.)
Another simple scheme:
0. Maintain a list of all polygons that have been found so far. The list will be empty to start.
1. Identify any nodes that have only one edge that touches them. This will prune away all edges that cannot belong to any polygon. Repeat this step if new nodes appear that connect to only one other node.
2. Pick any point at random in the domain. Does it belong to a polygon that is in our list? If not, then any ray that extends from the point will intersect some edge of the enclosing polygon. Follow that polygon, going in a consistent direction (clockwise, for example.) When the polygon closes on itself, add it to the list of identified minimal polygons.
Repeat step 2 until the sum of all identified polygonal areas is the total area. You are now done.
I'm sure I can think of other heuristics that will be workable.
1 Comment
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!