给定一组描述该形状的坐标,如何计算封闭形状的内部面积

How to calculate the inside area of a closed shape given a set of coordinates describing the that shape

我有两个数组 https://i.stack.imgur.com/2EyfL.png, first one is y coordinates and the second one is x coordinates, when I plot a diagram with these coordinates, it becomes a closed shape like the attached image https://i.stack.imgur.com/rOQ7A.png,我正在寻求一种方法来计算 python 中这个封闭形状的内部面积。

How to calculate area of an organic shape?

看看这个link,我想它和你有同样的问题。

即使它使用另一种语言,您也可以尝试将其转换为 Python 代码。

在此处查看代码:Calculate area of polygon given (x,y) coordinates

def PolyArea(x,y):
    return 0.5*np.abs(np.dot(x,np.roll(y,1))-np.dot(y,np.roll(x,1)))