Mesh merging

When placing the tree on the terrain we want to make sure that the resulting mesh keeps its good property (no self-intersections, no overlapping faces, water-tight, etc.). To ensure it does we’re going to merge the tree mesh with the terrain mesh and check the resulting mesh using the is_valid(bool verbose=false) const function from the CGAL library.

Additonnaly, to remove the overlapping intersections between the trees and the terrain, we’re going to use the autorefine_triangle_soup() function from the CGAL library modified to keep our markers. You can see the result with the following example:

Table 1. autorefine before and after
autorefine before
autorefine after

Before

After

References