problem with polyarea method, return NAN
Mostra commenti meno recenti
Hi, I have multiple circles that intersect each other in the static area,I want to find union of them. I use polyarea method to find union,My problem is that this method sometimes return numerical result and sometimes return NAN result.What should I do to not get NAN as a result?
please Help me if you now my answer. Thanks.
2 Commenti
Mohammad Abouali
il 13 Ott 2014
Polyarea is to get the area of a polygon, Why do you use that to get the union area?
fahimeh
il 14 Ott 2014
Risposta accettata
Più risposte (1)
John D'Errico
il 21 Ott 2014
0 voti
Note that the union of two polygons need not be a simple polygon. In fact, if the polygons are disjoint, then I'll bet that you get a result with a NaN in it. (I don't have the mapping toolbox that contains polybool, so I cannot test that statement.)
One solution is to discretize as Image Analyst has said, however, that will incur some loss due to the digitization into an image. Note that depending on the size of the numbers in your polygon, the digitization process may create a seriously huge image. So be careful!
A second solution is to catch the case when a NaN is returned, and then to perform the area computation as the sum of the two areas.
1 Commento
fahimeh
il 21 Ott 2014
Categorie
Scopri di più su Elementary Polygons in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!