简体   繁体   English

是否有用于查找点之间的相对距离的 R 函数?

[英]Is there an R function for finding relative distances between points?

I have some points distributed on an XY graph like in the picture.我在 XY 图上分布了一些点,如图所示。 Is there a way to recognize the vertex of the polygon (in this case a triangle), and to assign to each point a 3D coordinate value based on the point distances?有没有办法识别多边形的顶点(在这种情况下是三角形),并根据点距离为每个点分配一个 3D 坐标值?
Vertex would be (1, 0, 0), (0, 1, 0) and (0, 0, 1), while the other 4 points should be calculated on that reference, for instance the central point should be something like (0.33, 0.4, 0.27).顶点将是 (1, 0, 0), (0, 1, 0) 和 (0, 0, 1),而其他 4 个点应在该参考上计算,例如中心点应类似于 (0.33 , 0.4, 0.27)。

在此处输入图片说明

I would probably start with the convex hull if you are expecting convex shapes, from there you can check every 3 points and if the angle is below some threshold, delete the middle point from the polygon.如果您期望凸包形状,我可能会从凸包开始,从那里您可以每 3 个点检查一次,如果角度低于某个阈值,则从多边形中删除中间点。 Then you can just use a standard algorithm to get the central point of a polygon.然后您可以使用标准算法来获取多边形的中心点。

Another solution if an approximation is fine, you might just use the weighted center of all points.如果近似值很好,另一种解决方案是,您可能只使用所有点的加权中心。 Average of the X values and average of the Y values gives you your x/y point. X 值的平均值和 Y 值的平均值为您提供 x/y 点。 perhaps more effective if you do this with the convex hull points.如果您使用凸包点执行此操作,可能会更有效。 Though this can be biased if too many points are within a given area.尽管如果给定区域内的点太多,这可能会产生偏差。 IE: Say there was 100 points near one corner, but only 10 points near the other 2 corners of the triangle. IE:假设在一个角附近有 100 个点,但在三角形的其他 2 个角附近只有 10 个点。 It would be heavily weighted towards that corner with the 100 points. 100 分将在该角上占很大比重。

Not familar with R so that's about the best I can do.不熟悉 R 所以这是我能做的最好的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 更快地找到点组合之间的距离 - Faster way of finding distances between combinations of points 计算r中点对之间的距离 - Calculate the distances between pairs of points in r 寻找城市之间的距离? - Finding distances between cities? 计算直线与r中相交平面上所有点之间的距离 - Calculate distances between a line and all points on an intersecting plane in r 在R中有效地计算一个点和一组点之间的所有距离 - Calculating all distances between one point and a group of points efficiently in R 查找图中节点之间的最小距离/级别,如R中的数据帧 - Finding the minimum distances/levels between nodes in a graph like dataframe in R 行与sf之间的点距离 - Distances of points between rows with sf 修复功能中的瓶颈,返回R中栅格单元之间距离的数据帧 - Fixing bottleneck in function returning dataframe of distances between raster cells in R 如何用R计算参考线(或点)与长/纬点数据框之间的道路网络距离? - How to calculate road network distances between a reference line(or point) and a dataframe of long/lat points with R? 如何在R中用deldir进行Delaunay三角剖分后提取点之间的距离? - how can I extract the distances between the points after a Delaunay Triangulation with deldir in R?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM