R 点云覆盖的区域

发布于 2024-09-18 11:26:50 字数 98 浏览 2 评论 0原文

我有一团分散在二维欧几里得空间中的点。我想计算连接云的最极端(=外围)点的多边形内部的面积。换句话说,我想估计这个空间中云覆盖的面积。 R中有公式吗? 非常感谢您的任何回复 朱利安

I have a cloud of points scattered in a 2D Euclidean space. I would like to calculate the area inside the polygon linking the most extreme (=peripheral) points of the cloud. In other words, I would like to estimate the area covered by the cloud in this space.
Is there a formula in R?
Thanks a lot for any response
Julien

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

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

发布评论

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

评论(1

不可一世的女人 2024-09-25 11:26:50

这称为凸包问题; R 内置的 chull 函数应该可以完成这项工作。要计算面积,您可以使用此处的公式

编辑:更好; splancs 包有 areapl 函数。因此,解决您的问题的函数应该如下所示:

cha<-function(x,y){
chull(x,y)->i
return(areapl(cbind(x[i],y[i])))
}

例如:

library(splancs);
x<-rnorm(20);rnorm(20)->y;
#Some visualization
i<-chull(x,y);plot(x,y);polygon(x[i],y[i]);
#The area
cha(x,y);

This is called the convex-hull problem; R built-in chull function should do the work. To count area, you may use a formula from here.

EDIT: Even better; splancs package has areapl function. So the function solving your problem should look like this:

cha<-function(x,y){
chull(x,y)->i
return(areapl(cbind(x[i],y[i])))
}

For instance:

library(splancs);
x<-rnorm(20);rnorm(20)->y;
#Some visualization
i<-chull(x,y);plot(x,y);polygon(x[i],y[i]);
#The area
cha(x,y);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文