简体   繁体   中英

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:

在此处输入图片说明

You see they are placed in horizontal lines, but X coordinate is quite random. 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.

Library by JRShewchuk (and it's not hard to find triangulation implementation for any popular language)

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