I have to make 2d triangles from a list of 2d points with a condition: length of any edge can't be longer than a predefined constant.
Something like this:
Do you know any algorithm that can do this? Or any advise?
Thanks!
Try Delaunay triangulation , then remove any edges which are too long.
From the above article, you see a link to CGAL's 2D triangulation page .
First, generate all possible edges (ie connecting a pair of vertices that are closer than the constant). Then when two of them intersect, remove one of them. Repeat this step until there are no intersections.
This solution is quite primitive, it's probably possible to do it faster.
I like svick's answer -
when implementing I would do the following
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.