Search code examples
cgal

How to traverse all the cells in a 3D CGAL mesh by using BFS?


I have created the 3D mesh. I just wonder whether I can search for the adjacent cells for one special cell.


Solution

  • Given a Cell_handle, you can access its neighbors cells using the neighbor function:

    Cell_handle n = cell->neighbor(i); //  0<= i < 4
    

    If you want to restrict to cells in the complex, you can use the function is_in_complex(Cell_handle c).