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 allfigurepatch(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 allfigurepatch(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

## Best Answer