Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Function for finding the index of a neighboring cell when adjacency relations haven't been set?

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Function for finding the index of a neighboring cell when adjacency relations haven't been set?


Chronological Thread 
  • From: Adam Getchell <>
  • To:
  • Subject: Re: [cgal-discuss] Function for finding the index of a neighboring cell when adjacency relations haven't been set?
  • Date: Fri, 26 Jun 2015 10:53:55 -0700

Hi Pranav,

Thanks for the suggestion.

I need the geometric features in the Delaunay Triangulation, so I don’t think Combinatorial maps will work for me.

However, I wrote a function which finds the neighboring index of an unlinked neighboring cell by looking for 3 common vertices and separating the uncommon one into a std::vector<Vertex_handle> disjoint_vector.

This is then used in the set_adjacency(Cell_handle, index, Cell_handle, index) function to set the two cells as neighbors of each other.

This seems to work so far.

I’m now dissecting/reusing the code in the is_valid() and change_orientation() functions to verify and fix orientations.

Thanks again!


On Jun 22, 2015, at 11:04 PM, Pranav Kant Gaur <> wrote:

Hi Adam,

AFAIK there is no such function in Triangulation class. But have you tried Combinatorial maps in CGAL...you can create d-cells and check if two d-cells are adjacent to each other using a predicate is_sewable<d>(c1, c2).
Here is the documentation:
http://doc.cgal.org/latest/Combinatorial_map/index.html

On Tue, Jun 23, 2015 at 5:22 AM, Adam Getchell <> wrote:
Hello all,

I might have missed it, but I’m looking for a function that finds the index of a neighboring cell with respect to the first cell.

The catch is I have just created these cells.

I can use something like:

int neighbor_index;
first->has_neighbor(second, neighbor_index)

But that only works when adjacency relationships are set. (When they are not set, these ints seem to point to memory addresses.)

I’m working on the opposite problem, setting adjacencies by finding cells with overlapping sets of vertices.

So far I’m using std::set_difference and set::union from <algorithm> to do this by brute force.

That is, given a list of newly created 3D cells, pairwise find those that have exactly 3 vertices in common using set::union, and then use set_adjacency(first, neighbor_index, second, neighbor_mirror_index) to set adjacency relations.

(In higher dimensions I would change the criteria accordingly.)

BTW, it seems these want sorted ranges. Are Vertex_handles sortable (is operator< defined)?

Thank you for any comments.








Archive powered by MHonArc 2.6.18.

Top of Page