简体   繁体   中英

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

I have some points distributed on an XY graph like in the picture. 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?
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).

在此处输入图片说明

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. 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. 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. It would be heavily weighted towards that corner with the 100 points.

Not familar with R so that's about the best I can do.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM