cyaron icon indicating copy to clipboard operation
cyaron copied to clipboard

关于 Polygon 的面积计算

Open weilycoder opened this issue 4 months ago • 2 comments

无法正确计算非简单多边形(有自交)的面积

from cyaron import *

p = Polygon(
    [(-3, 4), (1.5, 3), (-6, -2), (-3, -4)]
)
print(p.area()) # output: 3.0

如图,显然面积为 $15$。

2024-10-04_19-08

即使这种情形在应用时不常见,是否应在文档中警告,或者在代码逻辑中加入判断?

weilycoder avatar Oct 04 '24 11:10 weilycoder