本文介绍了点云覆盖的区域与R的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个散布在2D欧氏空间中的点云。我想计算连接云的最极端(=外围)点的多边形内的面积。换句话说,我想估计云在这个空间覆盖的面积。
R中是否有公式?
感谢任何回应
Julien

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 responseJulien

推荐答案

这被称为凸包问题; R内置的 chull 函数应该做的工作。要计算面积,您可以使用。

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.

编辑:更好; splancs 包具有 areapl 函数。所以解决你的问题的函数应该看起来像这样:

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])))
}

例如:

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);

这篇关于点云覆盖的区域与R的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 06:15