How can I fill many polygons with a particular colour within a periodically bounded box in matlab ?
2 views (last 30 days)
Show older comments
I tried with the 'patch' or 'fill' function. But the main problem is, for the periodically bounded box, there are many situations where half of a polygon is near the left boundary of the box and rest part of that polygon is near the right most boundary of the box, which is just opposite to the left part. The 'fill' or 'patch' function simply connects the two parts of the polygon and fills the colour throughout the box !! I just want to fill the colour in the two parts of the same polygon separately( so that virtually the two parts has to be treated as two separate polygons). I am attaching a figure, where I tried to fill the polygons through the 'patch' function. You can see the problem for the near-boundary polygons. If anyone can help me regardig the issue, it would be great.
2 Comments
KSSV
on 12 May 2022
How is your data? You need to adjust the half polygons. It seems the half polygons data is contnuous.
Answers (1)
Image Analyst
on 16 May 2022
You need to get the coordinates of the polygons on the edge of the image and close them by tacking on the first point to the end of the coordinate list. Then the polygon will be closed and should get filled.
0 Comments
See Also
Categories
Find more on Elementary Polygons 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!