6
$\begingroup$

Bug introduced in 11.1 or earlier and persisting through 11.2.0 or later


I use Area function to evaluate the area of the polygon. I found that when two vertex points are the same, the Area give the wrong result. For example, I define the following function:

areacoor[x_, y_] := Area@Polygon[{{x, y}, {0.5, 0.5}, {1, 1}}]

which is the area of the triangle whose vertex points is {x, y}, {0.5, 0.5} and {1, 1}. When $(x,y)$ move towards to any two other points, for example, $(x,y)\to (0.5,0.5)$, the area of the triangle will become smaller and smaller. When $(x,y)=(0.5,0.5)$, the triangle will become a line and the area should be 0. However areacoor[0.5,0.5] gives 0.707107. I wonder why I obtain this result, which I think is not reasonable.

$\endgroup$
4
  • 1
    $\begingroup$ I think this is a bug. Maybe somebody tried to make the definition of Area rebust for degenerating polygons, deleted duplicate vertex coordinates and somewhat mixed up Area and RegionMeasure... $\endgroup$ Jan 26, 2018 at 9:10
  • $\begingroup$ Added the bugs tag. Please report it to the tech support. $\endgroup$ Jan 26, 2018 at 11:32
  • $\begingroup$ Area[Polygon[{{0.4, 0.4}, {0.5, 0.5}, {1, 1}}]], too, misfires. $\endgroup$
    – Michael E2
    Jan 26, 2018 at 14:20
  • $\begingroup$ in 11.1 other colinear point sets generate an (incomprehensible) error message. Only a "wrong" result for coincident points. $\endgroup$
    – george2079
    Jan 26, 2018 at 16:03

1 Answer 1

5
$\begingroup$

Interesting question! Workaround with Evaluate works as expected:

areacoor[x_ , y_ ] :=Evaluate@Area@Polygon[{{x, y}, {0.5, 0.5}, {1, 1}}]     
areacoor[0.5, 0.5 ] 
(* 0 *)
Plot3D [areacoor[x, y], {x, 0, 1}, {y, 0, 1}]

enter image description here

appendix Without Evaluate the bug(comment @Henrik Schumacher) can be illustrated

Plot3D [Area[Polygon[{{x, y}, {1/2, 1/2}, {1, 1}}] ], {x, 0, 1}, {y,0, 1}]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.