Welding Triangles In A Mesh Using Thrust 2016-02-29
This algorithm is designed to weld together triangle vertices with a certain tolerance and remove duplicated triangles. Thrust will be used making the algorithm parallel on the CPU using OpenMP or on the GPU using CUDA. Additionally, I assume that the code is run on the CPU.
This example is based on the Welding Vertices example in the Thrust GitHub examples folder. I used the following to merge vertices and triangles for a marching cubes code which generated an unoptimized triangle mesh.
Input:
The input to this procedure is a list of triangles and vertices, vertices
is a three dimensional vector with the locations of each vertex in a triangle and indices
is an array of indices for the vertices that make up a specific triangle. Note that the input to the algorithm must not be merged already, meaning that vertices
will contain unique entries for every vertex and indices
will reference 3 unique vertices. No vertex will be shared by a triangle.