Vous suivez désormais cette question
- Les mises à jour seront visibles dans votre flux de contenu suivi.
- Selon vos préférences en matière de communication il est possible que vous receviez des e-mails.
How can I use graph object info to find: areas, number of sides, and perimeter lengths of a each connected polygon within a network of polygons?
Réponse acceptée
24 commentaires
- Make a second list of the three (at most) central points connected to each other central point.
- Start a for loop with the first edge ID, say E1, choose one end's central point (C ID, say C1); make that point the head of a vector pointing there from the other central point (chord vector).
- Find the other two central points connected to this head point (from the other list) and the corresponding vectors that point from the head to them (two edges, two chords).
- Take cross products of the first chord with each of the other two.
- Only one of these will be a positive cross product (counterclockwise turning); retain the ID of that edge and concatenate it to the edge ID we started with; we now have a 2-tuple [E1 E2]; also retain the ID of its central point to make [C1 C2].
- Keep doing this iteratively (in a while loop), with E2 taking the role of E1, etc. After every step [E1 ... Ek], check if Ek=E1. If yes, we have gone too far, and BE=[E1 ... E(k-1)] is the polygon edge set, i.e., n=k-1; likewise, you get BV=[C1 ... Cn] as the vertex set. Store BE,BV as new variables and exit the while loop.
- Close the for loop by taking the next edge ID, and do it for all of them.
- This will generate a lot of duplicate polygon variables BE(), BV(), but that's OK. Discard duplicates.
- Once we have the BE, BV vectors of edge IDs, the length of the vectors is the topology of the PCC.
- The area is computed in two steps: the polygonal area (straight edges) is obtained by the standard formula using the (x,y) coordinates of the central points belonging to the IDs of BV, or by the method you had described above.
- The circle segment areas within the arcs are either added or subtracted from that. Here we may have to go back to the way the theta is determined: we computed inner products of chords and end point directors (right?), but in the end we must have discarded their sign. We should keep the sign, because it tells us whether the arc curves counterclockwise or clockwise with respect to our edges as we go around the PCC. If we consistently concatenate our edges (as described above) by turning ccw at each central point, a ccw turning arc will subtract, a cw arc will add.
Plus de réponses (1)
2 commentaires
Voir également
Catégories
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Une erreur s'est produite
Impossible de terminer l’action en raison de modifications de la page. Rechargez la page pour voir sa mise à jour.
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.
Amériques
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
Asie-Pacifique
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)