[英]Algorithm to generate rectangle coordinates given a set of points
I have a set of points on 2D plane, each has its screen coordinates X and Y. They are placed this way: 我在2D平面上有一组点,每个点都有其屏幕坐标X和Y。它们的放置方式是:
You see they are placed in horizontal lines, but X coordinate is quite random. 您会看到它们被放置在水平线上,但是X坐标是相当随机的。 A number of points in each line is not necessarily the same. 每行中的点数不一定相同。
Given these coordinates, I need to generate triangles so that each edge of the triangle connects a pair of points which are close to each other, if possible: 给定这些坐标,我需要生成三角形,以便三角形的每个边缘连接一对彼此靠近的点,如果可能的话:
Is there any known algorithm or library for this? 是否有任何已知的算法或库?
You need point set triangulation . 您需要点集三角剖分 。
In described case Delaunay triangulation should give desired result. 在所描述的情况下, Delaunay三角剖分应给出期望的结果。
Library by JRShewchuk (and it's not hard to find triangulation implementation for any popular language) JRShewchuk编写的库 (不难发现任何流行语言的三角剖分实现)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.