voronoi diagram and delaunay triangulation understanding - geometry

Can someone help me to understand the purpose of delaunay triangulation? what is it use for?
Also I got to know that delaunay triangulation is the dual graph of voronoi diagram but not really fully understand it. Thanks so much

The Delaunay triangulation is a "good" triangulation in that it finds triangles that are not too skewed. It is unique and guarantees that the circumcircle of any triangle is empty. It is relatively fast to build, requiring no more than O(N Log(N)) operations.
It is used where triangulations are used, for instance for interpolation on irregular 2D point sets.
It is said to be the dual of the Voronoi diagram because vertexes (sites) are in one-to-one correspondence with the faces (regions) and vice versa. And when two Voronoi regions share an edge, the corresponding sites are linked by a triangle side.

Related

Consistent normal calculation of a point cloud

Is there a library in python or c++ that is capable of estimating normals of point clouds in a consistent way?
In a consistent way I mean that the orientation of the normals is globally preserved over the surface.
For example, when I use python open3d package:
downpcd.estimate_normals(search_param=o3d.geometry.KDTreeSearchParamHybrid(
radius=4, max_nn=300))
I get an inconsistent results, where some of the normals point inside while the rest point outside.
many thanks
UPDATE: GOOD NEWS!
The tangent plane algorithm is now implemented in Open3D!
The source code and the documentation.
You can just call pcd.orient_normals_consistent_tangent_plane(k=15).
And k is the knn graph parameter.
Original answer:
Like Mark said, if your point cloud comes from multiple depth images, then you can call open3d.geometry.orient_normals_towards_camera_location(pcd, camera_loc) before concatenating them together (assuming you're using python version of Open3D).
However, if you don't have that information, you can use the tangent plane algorithm:
Build knn-graph for your point cloud.
The graph nodes are the points. Two points are connected if one is the other's k-nearest-neighbor.
Assign weights to the edges in the graph.
The weight associated with edge (i, j) is computed as 1 - |ni ⋅ nj|
Generate the minimal spanning tree of the resulting graph.
Rooting the tree at an initial node,
traverse the tree in depth-first order, assigning each node an
orientation that is consistent with that of its parent.
Actually the above algorithm comes from Section 3.3 of Hoppe's 1992
SIGGRAPH paper Surface Reconstruction from Unorganized Points. The algorithm is also open sourced.
AFAIK the algorithm does not guarantee a perfect orientation, but it should be good enough.
If you know the viewpoint from where each point was captured, it can be used to orient the normals.
I assume that this not the case - so given your situation, which seems rather watertight and uniformly sampled, mesh reconstruction is promising.
PCL library offers many alternatives in the surface module. For the sake of normal estimation, I would start with either:
ConcaveHull
Greedy projection triangulation
Although simple, they should be enough to produce a single coherent mesh.
Once you have a mesh, each triangle defines a normal (the cross product). It is important to note that a mesh isn't just a collection of independent faces. The faces are connected and this connectivity enforces a coherent orientation across the mesh.
pcl::PolygonMesh is an "half edge data structure". This means that every triangle face is defined by an ordered set of vertices, which defines the orientation:
order of vertices => order of cross product => well defined unambiguous normals
You can either use the normals from the mesh (nearest neighbor), or calculate a low resolution mesh and just use it to orient the cloud.

Generating coordinates for abstract triangulation

I have a piece of abstract triangulation, made entirely out of equilateral triangles, that describes a curved 2d space. As such, some vertices have for example 7 equilateral triangles attached to them. Now I want to draw this as a terrain.
This has to be done in 3d, so I expect a lot of saddle nodes and some cone-like structures. I am currently trying to find a nice algorithm that does this for me, but as of yet I have come out empty handed. In principle you could 'just' solve a large set of quadratic equations that fixes all the distances, but this is unfeasible. I would be content with an algorithm that gives a best approximation.
Any advice?

Fastest available Delaunay triangulation algorithm for GPU

Which is in your opinion the fastest available Delaunay triangulation algorithm for GPU? Or more general, in parallel
2D Delaunay triangulation
GPU-DT is the fastest 2D Delaunay implementation for the GPU.
It constructs a digital Voronoi diagram in 2D using the GPU Parallel Banding Algorithm. Next it fixes and dualizes this to obtain a 2D triangulation. Finally, it performs edge-flipping in parallel on the GPU to obtain the 2D Delaunay triangulation.
3D Delaunay triangulation
gStar4D is a fast and robust implementation of 3D Delaunay for the GPU.
Similar to GPU-DT, this algorithm constructs the 3D digital Voronoi diagram first. However, in 3D this cannot be dualized to a triangulation due to topological and geometrical problems. Instead, gStar4D uses the neighborhood information from this diagram to create stars lifted to 4D and performs star splaying on them efficiently on the GPU. By extracting the lower hull from this, the 3D Delaunay triangulation is obtained.
A faster alternative is gDel3D, which is a hybrid GPU-CPU algorithm.
It performs parallel insertion and flipping on the GPU. The result is close to Delaunay. It then fixes this result using a conservative star splaying method on the CPU.
All these methods are robust, so they can handle any kind of degenerate input.
Be careful with GPU's: Delaunay Triangulations require orientation tests. These do not work reliably with floating point arithmetic, and it might be hard to cope with that
problem using a GPU. Also the memory management is crucial.
You might want to try http://www.geom.at/fade2d/html/ which is among the fastest robust
single threaded implementations.

The difference between triangulation and mesh

I have done some computer graphical programming recently, and I have no experience before. I used the library call CGAL(computer geometry algorithm library). Also, I noticed that there is class for triangulation and also class for mesh. Is mesh just a kind of triangle net? Do they have any differences?
Thanks!
Triangulation is one way to mesh the geometry. And it is also possible to represent geometry in different shapes.

How do I derive a Voronoi diagram given its point set and its Delaunay triangulation?

I'm working on a game where I create a random map of provinces (a la Risk or Diplomacy). To create that map, I'm first generating a series of semi-random points, then figuring the Delaunay triangulations of those points.
With that done, I am now looking to create a Voronoi diagram of the points to serve as a starting point for the province borders. My data at this point (no pun intended) consists of the original series of points and a collection of the Delaunay triangles.
I've seen a number of ways to do this on the web, but most of them are tied up with how the Delaunay was derived. I'd love to find something that doesn't need to be integrated to the Delaunay, but can work based off the data alone. Failing that, I'm looking for something comprehensible to a relative geometry newbie, as opposed to optimal speed. Thanks!
The Voronoi diagram is just the dual graph of the Delaunay triangulation.
So, the edges of the Voronoi diagram are along the perpendicular bisectors of the edges of the Delaunay triangulation, so compute those lines.
Then, compute the vertices of the Voronoi diagram by finding the intersections of adjacent edges.
Finally, the edges are then the subsets of the lines you computed which lie between the corresponding vertices.
Note that the exact code depends on the internal representation you're using for the two diagrams.
If optimal speed is not a consideration, the following psuedo code will generate a Voronoi diagram the hard way:
for yloop = 0 to height-1
for xloop = 0 to width-1
// Generate maximal value
closest_distance = width * height
for point = 0 to number_of_points-1
// calls function to calc distance
point_distance = distance(point, xloop, yloop)
if point_distance < closest_distance
closest_point = point
end if
next
// place result in array of point types
points[xloop, yloop] = point
next
next
Assuming you have a 'point' class or structure, if you assign them random colours, then you'll see the familiar voronoi pattern when you display the output.
After trying to use this thread as a source for answers to my own similar question, I found that Fortune's algorithm — likely because it is the most popular & therefore most documented — was the easiest to understand.
The Wikipedia article on Fortune's algorithm keeps fresh links to source code in C, C#, and Javascript. All of them were top-notch and came with beautiful examples.
Each of your Delaunay triangles contains a single point of the Voronoi diagram.
You can compute this point by finding the intersection of the three perpendicular bisectors for each triangle.
Your Voronoi diagram will connect this set of points, each with it's nearest three neighbors. (each neighbor shares a side of the Delaunay triangle)
How do you plan on approaching the edge cases?

Resources