Is it possible to draw partially filed polygons?
1 view (last 30 days)
Show older comments
Mike Wilson
on 17 Oct 2016
Commented: Mike Wilson
on 18 Oct 2016
Anybody know of an easy way to draw partially filled polygons?
I'm working on a visual flow model for water district and need to show changing storage status of multiple reservoirs (both surface and groundwater). Each has a maximum capacity that would be represented by the full polygon. As the model goes into action and water gets drawn down, I'd like to represent current storage in each reservoir as a fill percentage of its full shape. Looking for an easy way to do this and not finding anything like it in the docs. Any ideas?
Thanks!
Mike
0 Comments
Accepted Answer
Walter Roberson
on 17 Oct 2016
No, there is no routine provided for this. You need to calculate the height at which the fill percentage is reached, then create a new polygon and fill that.
Calculating the height at which the fill percentage is reached is not trivial for irregularly shaped polygons, especially if the polygons are not convex. For example,
| |
| |
| _____ |
| | |_____|
|_______|
the area on the right cannot fill until the water has raised to a certain level, but once it has raised to that level the water does not start rising again until the right fills up.
You can easily see that you could create two chambers of the same volume with a small gap connecting them near the top; if the fill is into one side only then "almost half full" for the reservoir as a whole would involve having one side completely filled while the other was empty.
If you were to restrict to convex polygons the calculations are easier but still need to proceed piecewise to each change in angle of the sides.
More Answers (0)
See Also
Categories
Find more on Computational Geometry in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!