How is the polyarea function input order to receive correct results?
Afficher commentaires plus anciens
Hi everyone,
In the help of the polyarea function it says that the value returned can depend on the order of the input values?
Does anybody know more about that? When does it depend any when not? how do i hve to order my input values so that the result will be correct?
v1=[0 0 1 1];
v2=[0 1 0 1];
close all
figure
patch(v1,v2,rand(1,3))
A = polyarea(v1,v2) ;
This will lead to 2 triangles, somehow one with a negativ and one with positiv area. At least that is whats happening i think, because the result is 0, even though that these 4 point form a square.
v1=[0 0 1 1];
v2=[0 1 1 0];
close all
figure
patch(v1,v2,rand(1,3))
A = polyarea(v1,v2) ;
This instead will lead to a square with the area 1.
Im trying to use voronoin function, to get n articicial grin structure and i later have to dd more polyeders inside the existing "mesh" and the areas of those hould be calculated correctly, so i need to know how to order the input values.
Many thanks in advance
Best regards
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Computational Geometry dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


