Reputation: 305
I have a list of XYZ-points that are arranged in an evenly spaced lattice in the XY-plane like so (for example):
I want to 'tile' the space between these points with triangles that connect a point to two of its immmediate (up to) eight neigbors, like so:
How do I efficiently go about doing this in Python? A naive approach would check every point for eight possible triangles, but this is hugely inefficient due to considering many many duplicate triangles. Doing something like considering the possible triangles in the lower-right corner for each point, will miss some triangles. Is there some general algorithm for this problem?
I believe Delaunay triangulation is not appropriate, as it will always create a convex triangulation.
This triangulation is a step in the process of generating 3D-meshes of buildings from LIDAR height-data. When I use the 'usual' algorithms for generating meshes from point clouds (poisson, pivoting ball), I end up with meshes that have a number of holes in them (especially at steep inclines like towers or walls). I hope I can fix a lot of these hole problems by recognizing that the point cloud forms an evenly spaced lattice in the XY-plane and triangulating it from that perspective as described above.
Upvotes: 5
Views: 338
Reputation: 65458
Consider each 2x2 subgrid where at least three of the points a
, b
, c
, d
exist.
a b
d c
To get a triangulation like the one you depicted, test whether there are only three points. If so, put a triangle consisting of those three points. Otherwise, put triangles abc
and acd
.
Upvotes: 2