如何计算一系列随机点的面积?

发布于 2024-09-16 10:22:01 字数 212 浏览 10 评论 0原文

因此,我正在编写一段代码,以获取 RC 飞机作物喷粉机的位置数据并计算横向总表面积(无需重复计算任何面积)。我不知道如何计算给定运行期间的面积。

根据下表计算点覆盖的面积。

x,y
1,2
1,5
4,3
6,6
3,4
3,1

有什么想法吗?我浏览过格林斯定理,但我没有一个实用的编码概念。

感谢您的任何建议

So I'm working on a piece of code to take positional data for a RC Plane Crop Duster and compute the total surface area transversed (without double counting any area). I cannot figure out how to calculate the area for a given period of operation.

Given the following Table Calculate the area the points cover.

x,y
1,2
1,5
4,3
6,6
3,4
3,1

Any Ideas? I've browsed Greens Theorem and I'm left without a practical concept in which to code.

Thanks for any advise

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

木緿 2024-09-23 10:22:01
  1. 从给定点构建凸包

    此处描述了算法

    查看一个非常好的 python 演示 + src

  2. 计算它的面积

    Python 代码位于此处

  1. Build the convex hull from the given points

    Algorithms are described here

    See a very nice python demo + src

  2. Calculate its area

    Python code is here

極樂鬼 2024-09-23 10:22:01

比我更数学的人可能需要验证这里的信息。但它看起来合法: http://www.wikihow.com/Calculate -the-Area-of-a-Polygon 并且相当容易在代码中应用。

Someone mathier than me may have to verify the information here. But it looks legit: http://www.wikihow.com/Calculate-the-Area-of-a-Polygon and fairly easy to apply in code.

生生不灭 2024-09-23 10:22:01

我不完全确定您正在寻找“表面积”,就像您正在寻找距离一样。您似乎想计算该列表中的一个点与下一个点之间的距离。如果是这种情况,只需使用距离公式即可。

如果飞机在这些点之间飞行时掉落恒定宽度的灰尘,则面积就是这些点之间的距离乘以喷雾宽度。

I'm not entirely sure that you're looking for "Surface area" as much as you're looking for Distance. It seems like you want to calculate the distance between one point and the next for that list. If that's the case, simply use the Distance Formula.

If the plane drops a constant width of dust while flying between those points, then the area is simply the distance between those points times the width of the spray.

浅暮の光 2024-09-23 10:22:01

如果您的点保证位于整数网格上 - 正如您的示例中所示 - (并且您确实正在寻找封闭区域)将 皮克定理 有帮助吗?

If your points are guaranteed to be on an integer grid - as they are in your example - (and you really are looking for enclosed area) would Pick's Theorem help?

枕花眠 2024-09-23 10:22:01

您必须将复杂的多边形大致划分为标准多边形(三角形、矩形等),然后找到所有多边形的面积。这就像常规积分一样(唯一的区别是您尚未找到近似数据的公式)。

上述几点是当您假设您正在使用数据形成闭合多边形时的情况。

You will have to divide the complex polygon approximately into standard polygons (triangles, rectangles etc) and then find area of all of them. This is just like regular integration (only difference is that you are yet to find a formula to approximate your data).

The above points are when you assume that you are forming a closed polygon with your data.

清秋悲枫 2024-09-23 10:22:01

使用 QHull 对区域进行三角测量,然后将所得三角形的面积相加。

Use to QHull to triangulate the region, then sum the areas of the resulting triangles.

丢了幸福的猪 2024-09-23 10:22:01

Python 现在方便地有一个库来实现 Lior 提供的方法。 https://docs.scipy.org/doc/ scipy/reference/ generated/scipy.spatial.ConvexHull.html 将计算任何 N 维空间的凸包,并为您计算面积/体积。有关详细信息,请参阅页面底部的示例和返回值属性。

Python now conveniently has a library that implements the method Lior provided. https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.ConvexHull.html will calculate the convex hull for any N dimensional space and calculate the area/volume for you as well. See the example and return value attributes towards the bottom of the page for details.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文