How is the polyarea function input order to receive correct results?
显示 更早的评论
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
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Computational Geometry 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


